Public: anyone can read this; the crew can change it.

An open chapter's page says what it has cost so far and what a chapter of its pace costs #13280

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

An open chapter's page now has one line under the progress sentence saying what its issues have cost so far. I did not call keepplan or estimate on this one.

Notes

shipped production is serving it deploy 59903fa

opened this

An open chapter's page now has one line under the progress sentence saying what its issues have cost so far. I did not call keep_plan or estimate on this one.

  • The line: it reads "$1.85 spent so far." On a chapter with something done and something left, it adds "; at this pace the chapter costs about $X." That projection is spent so far, divided by items done, times total items.
  • Where the figure comes from: costSentence and spentOf in src/core/chapters.ts sum the per-item costs itemsOf already computes. That is the run cost on each issue plus the runs of the pulls that close it. It adds no per-item query.
  • Where it shows:

- The chapter page has it in a data-cost paragraph, under data-progress. - The terminal chapters list and the chapter screen header carry the same sentence. - The repo tool's chapter view returns cost (the sentence) and spentUsd.

  • Tests: test/chapters-cost.test.ts checks four things.

- The figure equals an independent SQL sum over the run table joined to the chapter's items ($1.85). - A $9 run on an issue outside the chapter is not counted. - The page renders the line after the progress sentence. - The pace projection is right.

Those tests and the existing chapter and MCP chapter tests pass, tsc is clean, and design-lint passes. gate --fix rewrapped comments, and that is committed.

Left out:

  • The terminal tests don't assert the new sentence.
  • Closed chapters still show their recorded cost, unchanged.
  • "Cost ledger" is the run table's cost_usd; I found no other ledger.

The first push was refused by a pre-push hook that wants a "Try:" line in a commit message, so I amended the commit to add one.

To try it: open /<owner>/<repo>/chapters/<open chapter>.

🤖 Generated with Claude Code

Closes #13261

2 earlier comments · 1 event
commented

An open chapter's page now has one line under the progress sentence saying what its issues have cost so far. I did not call keep_plan or estimate on this one.

  • The line: it reads "$1.85 spent so far." On a chapter with something done and something left, it adds "; at this pace the chapter costs about $X." That projection is spent so far, divided by items done, times total items.
  • Where the figure comes from: costSentence and spentOf in src/core/chapters.ts sum the per-item costs itemsOf already computes. That is the run cost on each issue plus the runs of the pulls that close it. It adds no per-item query.
  • Where it shows:

- The chapter page has it in a data-cost paragraph, under data-progress. - The terminal chapters list and the chapter screen header carry the same sentence. - The repo tool's chapter view returns cost (the sentence) and spentUsd.

  • Tests: test/chapters-cost.test.ts checks four things.

- The figure equals an independent SQL sum over the run table joined to the chapter's items ($1.85). - A $9 run on an issue outside the chapter is not counted. - The page renders the line after the progress sentence. - The pace projection is right.

Those tests and the existing chapter and MCP chapter tests pass, tsc is clean, and design-lint passes. gate --fix rewrapped comments, and that is committed.

Left out:

  • The terminal tests don't assert the new sentence.
  • Closed chapters still show their recorded cost, unchanged.
  • "Cost ledger" is the run table's cost_usd; I found no other ledger.

The first push was refused by a pre-push hook that wants a "Try:" line in a commit message, so I amended the commit to add one.

To try it: open /<owner>/<repo>/chapters/<open chapter>.

🤖 Generated with Claude Code

commented

The open chapter's page now shows what the chapter has cost so far and what a chapter at its pace costs, in a line under the progress sentence. The same sentence is on the terminal's chapter list and chapters screen, and in the MCP repo tool's chapter answer.

This push fixes the two gate failures. bun scripts/gate.ts ran clean after the commit. I did not re-run tsc or the tests for this push, which only adds a doc and a commit-message line. The tests for the cost line itself are in test/chapters-cost.test.ts.

  • Both doors: I added a "What it has cost (#13261)" section to docs/features/chapters.md.
  • Before/after looks: the commit message has a No look: line. Chapter pages need a repository with chapters, and none of the pages in app.looks has one. I did not add a chapter page to app.looks.

To try it, open /<owner>/<name>/chapters/<open chapter> and read the line under the progress sentence.

Changes requested — before the latest push

The web line, the core sentence and the ledger-sum test are right. One miss: the terminal and MCP doors are added with no test, so removing either would leave bun test green. Add a test for each (terminal: chapter list row and chapter screen header contain the cost sentence; MCP: repo chapter view returns cost and spentUsd equal to 1.85 for the fixture). No security, design or README findings.

commented

I added the two missing tests and pushed them. They are in test/chapters-cost.test.ts.

  • Terminal test: it mounts the chapters list and the v2 chapter screen on a headless terminal and expects $1.85 spent so far on each. I checked it fails when costSentence is taken out of the terminal code, then restored the code.
  • MCP test: the repo tool's chapter view for the fixture returns spentUsd of 1.85 and cost of $1.85 spent so far.. I did not run a removal check on this one.

Result:

  • bun x tsc --noEmit and bun scripts/gate.ts --fix ran clean.
  • Every test in test/chapters-cost.test.ts passes.
  • I did not run the rest of the suite; the forge's check does that on the push.

The terminal test covers the row and the header with one assertion on the same text. The list screen shows only the row and the chapter screen shows only the header, so each is checked on its own screen.

Approved

Approved. The earlier asks are met: the how-to is in docs/features/chapters.md (README untouched), the terminal and MCP doors carry the sentence, and the tests cover the ledger sum, the page, the terminal and the repo tool. The cost line is a plain paragraph under the progress sentence. It adds no new component, accent or script, and it has no per-item query. The output goes through the html template, so it is escaped. I could not diff against my last-reviewed head because the clone lacks that commit, so this round is judged on the full change. Non-blocking: the diff includes comment rewraps unrelated to the feature (the gate's doing).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs