feat(ship): observe-a-run V-3 (part) — cost column on Home recent-runs - #459
Open
sarath-soman wants to merge 1 commit into
Open
feat(ship): observe-a-run V-3 (part) — cost column on Home recent-runs#459sarath-soman wants to merge 1 commit into
sarath-soman wants to merge 1 commit into
Conversation
Per V-3 acceptance ("per-run cost is visible") and design.md sub-flow 1
("History zone: columns include cost · run-id · rerun. Cost column is new
(V-3)").
Server side (`src/lib/run-dir.ts`):
- New `sumCostFromTelemetry(runDir)` helper sums per-stage `cost_usd` from
`telemetry.json`. Returns `null` when the file is missing, empty, or has
no rows with a numeric cost — null is "no signal" (distinct from a real
zero-cost run).
- `scanRuns` calls it once per run and sets `RunSummary.cost_usd` when
defined. No change for runs without telemetry (field stays absent).
- `RunSummary` (and wire-shape mirror in `src/web/types.ts`) gains a new
optional `cost_usd?: number` field.
Client side (`src/web/pages/Home.tsx`):
- New `Cost` column in the recent-runs table, between `Duration` and `Run ID`.
- `formatCost(c)` → `$X.YZ` (2 decimals) or `—` when undefined / non-finite.
- `data-testid="cost-cell"` on the latest-run cost cell for click-through tests
in follow-up PRs.
- `colSpan` on conflict/error banner rows bumped 7 → 8.
Tests: 4 new in `src/lib/run-dir.test.ts` (claim 1 — multi-stage sums; 2 —
missing telemetry leaves field absent; 3 — empty/malformed file leaves field
absent; 4 — non-numeric cost rows ignored, valid rows still summed).
Partial discharge of #430 — surfaces per-run cost on Home (one of the three
surfaces design.md specs). OutcomeHeader aggregate (depends on V-2 #453) and
UnifiedTimeline per-phase cost (depends on U-1 #432) remain.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Partial discharge of lambda-brahman/ship#20. Adds the Cost column to Home's recent-runs table per design.md sub-flow 1 ("History zone: columns include cost · run-id · rerun").
Server (`src/lib/run-dir.ts`):
Client (`src/web/pages/Home.tsx`):
Tests (4 new in `src/lib/run-dir.test.ts`):
What this is NOT
V-3 has three surfaces; this PR closes one. Out of scope here:
lambda-brahman/ship#20 stays open after this lands; close it only when all three surfaces ship.
Test plan
Rebased onto current main (includes #457, #458).
🤖 Generated with Claude Code