Repository navigation
feat(dash): show the top-level cache mark in the overview placement - #1285
Conversation
Anthropic automatic caching uses one top-level cache_control. No TTL reader looked at it. Add one list of every mark on the wire, root included (wireCacheControls). bodyAsksExtendedTTL and AllBreakpointsAskExtendedTTL use it. schema.CountBreakpoints counts the root mark (Breakpoints.Root), so the cap of four holds and ttlTier sees the body as cached. RelabelAllTTL1h relabels the root mark too. Fixes #1279 Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
- dash: new column cache_bp_root (additive migration). Meta.CacheBreakpoints() now sums the root mark, so it matches schema.Breakpoints.Total(). - proxy: envelopeOps reports a root-only 5m to 1h relabel as a headttl operation, so the accountant can book the premium and the rescue. - apply: fix two stale comments. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
- apply: say that schema.CountBreakpoints counts the cache_control spellings of the same set (it also counts cachePoint). - dash: the cache_bp_location dim has five columns, not four. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Add a Root slot to BreakpointTotals, the placement sums, the modal grouping and the modal string, and show it in the overview UI. A request whose only mark is the top-level cache_control now shows 1 in the top-level slot, and the placement sums add up to the total. Refs #1283 Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.330 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | 80f87154af0a |
approve |
Verdict: approve
Findings
None. The change reports an existing column; it stores nothing new.
Non-blocking
dash/overview.go:352— theBreakpointsfield comment says "These four columns" and its example lists four locations. The struct now has five. Commit dda06f fixed the same staleness indash/query.go; this one was missed.dash/ui/app.js:830-831— therenderCacheDetaildoc comment says "Four columns have recorded it per request". Same staleness as above.- Naming: the overview modal string says
top-level=1(dash/overview.go:1157), but the per-request breakdown dim saysroot=1(dash/query.go:1710). Two names for one slot, both user-visible. Pick one.
What I checked
- The net diff vs base is 6 files, all in
dash/. The branch also carries apply/proxy commits, but the merge80f87154resolved them to what main already holds (#1281), so they cancel in the diff. I confirmed base is an ancestor of HEAD and the two-dot and three-dot diffs match. - The
cache_bp_rootcolumn (dash/schema.go:396), the migration (dash/schema.go:949), theCacheBPRootevent field, andMeta.CacheBreakpoints()already include root. They landed before this PR. This PR only reads them. - First Overview query: the SELECT adds
SUM(r.cache_bp_root)between blocks and the requests CASE (dash/overview.go:667), and the Scan adds&o.Breakpoints.Rootat the same position (dash/overview.go:721). I read the full column list and the full Scan list; every position matches. - The requests denominator CASE already counted
cache_bp_rootbefore this PR, so its meaning ("requests that carried at least one") is unchanged. - Modal query: 10 columns selected,
GROUP BY 1..9covers the 9 non-count columns. Scan order matches. The sort tie-break gained therfield, and the winner assignment setsbr.Modalprintstop-level=%d. - The new test (
dash/overview_rootbp_test.go) usesmkEventwithModeActive, sets the bp fields directly, andinsertBatchstores them verbatim (dash/store.go:677). The asserted totals (root 2, system 1, blocks 2, requests 2, sum 5) follow from the two events. The solo modal string matches the new format exactly. - The three golden files were regenerated in the same commit that changed the format, and
TestGoldenEndpointscompares against them. - The UI adds
bp.roottobpTotaland one row, so a window with only the top-level mark now shows the panel instead of the empty state. - Fail-open and reversibility: not in scope. The change touches only the dashboard's read path.
- Data dependence: unchanged. The overview reads a count column that already exists; no row edit is needed. The PR adds no stored data.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.330 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | 80f87154af0a |
approve |
Verdict: approve
Findings
None. I found no defect in this change.
Non-blocking
- dash/ui/app.js:830 — the panel's docstring still says "Four columns have recorded it per request". The root column is the fifth, and this PR makes it first-class in this very panel. The wording was already stale in the base (the column landed with #1281), so it is not this PR's defect. Fix it in a follow-up or in this PR while touching the panel.
- PR body — no data-dependence statement. CLAUDE.md asks every PR that changes a feature to state its data dependence. This change only sums an existing count column (
cache_bp_root) that the dashboard-database row already covers as counts, so no row edit was needed and the top line "Adds a dashboard figure" says what changed. Say the dependence in one line if you re-edit the PR.
What I checked
- Read CLAUDE.md and the relevant parts of docs/design.md, then the full diff
14545559..HEAD. - The big aggregate (dash/overview.go:667, 721). The new
SUM(r.cache_bp_root)sits between the blocks sum and the requests count in the SELECT. The new&o.Breakpoints.Rootsits at the same position in the Scan. The order matches. The requests count already includedcache_bp_rootin the base, so the denominator is unchanged. - The modal-placement query (dash/overview.go:957-1011). The SELECT lists 9 group keys plus
COUNT(*);GROUP BY 1..9matches. Thebpstruct, the Scan, the sort comparator and the modal assignment all gained the root field together. The tie-break "smallest key wins" now includes root, so the modal choice stays deterministic. - The modal string (dash/overview.go:1157). The new
, top-level=%dmatches the test's expectation and the three golden files. - The UI (dash/ui/app.js:857-868).
bpTotalincludesbp.root, so the empty state no longer shows for a window whose only mark is the root one. The new tile's note ("the provider marks the last block") matches the semantics in schema/breakpoints.go:43-44. - The write path.
EventembedsMeta(dash/event.go:601),insertBatchpersistscache_bp_root(dash/store.go:603), and the schema column exists with a default of 0 (dash/schema.go:396, 949). All of this is base code, unchanged here. - The new test (dash/overview_rootbp_test.go). It covers a root-only request, a mixed request, the sum-equals-total check, and the root-only modal string.
mkEventleaves every CacheBP field at 0, so the test sets exactly what it asserts. - The golden files. All three stats goldens carry the new
root: 0field and the new modal string. The fixture in golden_endpoints_test.go sets no CacheBP fields, so 0 andtop-level=0are the values the code produces. The test compares the JSON semantically after unmarshalling, so the hand edits are safe. - Behavior and data dependence. The change reads one existing metadata column and displays it. It changes no proxy or library behavior, so the human-permission rule for behavior changes does not apply.
- I did not run the Go tests; live tests were not approved. I read the code only.
- The per-request placement breakdown says top-level, as the overview does. - Two comments said four columns; now five. - Add a test for the breakdown name. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 notes are fixed. Head: see the latest commit on
Tests (macOS, Go 1.27.4): gofmt, |
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.330 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | b55ca7fafb1c |
approve |
Verdict: approve
Findings
None. Every round-1 note is fixed, and the fix commit introduces no defect.
Earlier findings
- Mine, app.js "Four columns" docstring — fixed.
dash/ui/app.js:830now says "Five columns". - Mine, missing data-dependence statement in the PR body — fixed. The body now has a Data dependence section: "Metadata only; it sums the existing
cache_bp_rootcount column, so no data-dependence row changes." I read the body back from the server. The statement is right. - Reviewer 1,
dash/overview.go"four columns" field comment — fixed. The comment now says "These five columns" and names the fifth location (top-level). - Reviewer 1, app.js docstring — fixed. Same as my first item.
- Reviewer 1, two names for one slot (
top-level=vsroot=) — fixed, and I checked it myself.dash/query.go:1710now buildstop-level=N, matching the overview modal string atdash/overview.go:1158. I grepped the repo: no Go test,.mjstest, JS file or golden file pins the oldroot=string, so no golden change was needed. The golden endpoint list (dash/golden_endpoints_test.go:158-187) has nodim=cache_bp_locationURL, which confirms the rename cannot break a golden. The new testTestPlacementBreakdownNamesTheTopLevelSlotpins the new string.
New commit reviewed
b55ca7f "docs(dash): name the top-level slot the same everywhere" — 4 files, all verified:
dash/overview.go:351-352— comment only. It now names top-level as the fifth location.dash/ui/app.js:830— comment only. "Four" → "Five".dash/query.go:1708-1710— thecache_bp_locationbreakdown key changesroot=totop-level=. The observe-mode guard (CASE WHEN r.mode = observe THEN '') is kept, so observe rows still group under the empty key, which is whatTestBreakdownCacheBreakpointsUnknownForObservepins. This is a dashboard display string only; no proxy or library behavior changes.dash/overview_rootbp_test.go:43-62— new test. I traced it: one active-mode event withCacheBPRoot=1,Breakdown(Filter{}, "cache_bp_location")runs the SQL concat, SQLite casts the integer columns to text, and the key is exactly"system=0 tools=0 messages=0 blocks=0 top-level=1". TheBreakdownsignature (dash/query.go:1744) matches the call. One group is the right answer for one event.
Non-blocking
dash/overview.go:352-353— "These five columns have existed since the placement work" is now slightly off for the fifth:cache_bp_rootlanded later, with #1281. Prose only; the sentence above it already says where the fifth location came from.
What I checked
- Last review: round 1, 80f8715, 2026-11-22T18:09:50Z.
- New commits read: 1 — b55ca7f "docs(dash): name the top-level slot the same everywhere".
git log 80f87154..b55ca7falists only this commit. - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files; the inline file is empty).
- New items since my last review: the fix commit b55ca7f; the author's comment at 2026-11-22T18:23:09Z (fix list — each item verified above); reviewer 1's round-1 review at 18:09:35Z (read now for the first time, per the round-1 rule; all three of its notes are addressed by the same commit).
- Checked out head b55ca7f in this worktree and read the full diff
80f87154..b55ca7fa, plus the code around each change (dash/query.go:1685-1723,dash/query.go:1744-1780,dash/overview.go:346-356,dash/overview_rootbp_test.go). - Grepped for stale copies of the old string: no
root=remains in Go, JS,.mjsor testdata (minified vendor files excluded). No consumer parses the placement key format programmatically;dash/ui/tabs/usage.js:16maps the dimension name only, and the per-request drawer builds its own labels. - Confirmed the PR body's data-dependence line by reading the body back from the server.
- I did not run the Go tests; live tests were not approved. I read the code only.
amiddavid
left a comment
There was a problem hiding this comment.
| Reviewer | Kind | Started by | Context | Review | Round | Head | Verdict |
|---|---|---|---|---|---|---|---|
| Reviewer 1 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.330 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | b55ca7fafb1c |
approve |
Verdict: approve
Findings
None. The new commit fixes every round-1 note and adds a correct test.
Earlier findings
- Mine,
dash/overview.go:352("four columns" comment): fixed. The comment now says five and names the top-level location. - Mine,
dash/ui/app.js:830("Four columns" doc): fixed. It now says "Five columns". - Mine, naming split
top-level=vsroot=: fixed.dash/query.go:1710now saystop-level=, same as the overview modal. The new test pins it. - Reviewer 2,
dash/ui/app.js:830docstring: same as my second note, fixed. - Reviewer 2, missing data-dependence statement in the PR body: fixed. I read the body back from the server; it has a "Data dependence" section that says "Metadata only; it sums the existing
cache_bp_rootcount column, so no data-dependence row changes." That matches the code.
Non-blocking
dash/overview.go:352-353— the comment now says "These five columns have existed since the placement work". The root column landed later, with the top-level capture (#1279/#1281), not with the placement work. The four older columns did. One word of history is off; the numbers and names are right.
What I checked
- Last review: round 1,
80f87154af0a5d5dfd5028c3721cf812eafcdbe8, 2026-11-22T18:09:35Z. - New commits read: 1 —
b55ca7fa"docs(dash): name the top-level slot the same everywhere" (4 files: overview.go, overview_rootbp_test.go, query.go, app.js). - Read in full: 2 reviews, 1 comment, 0 inline comments (from the three saved files).
- New items since my last review: the author's comment at 2026-11-22T18:23:09Z (lists the four fixes; I verified each one, see above), and the commit
b55ca7fa(reviewed below). - The rename
root=→top-level=in thecache_bp_locationdim (dash/query.go:1710). I looked for anything that pinned or parsed the old string: no Go or JS code parses the key, no golden file records the key values (the goldens only list the dim name, which did not change), and no doc references it. Safe rename. - The new test
TestPlacementBreakdownNamesTheTopLevelSlot:mkEventusesModeActive, so the dim's observe-mode guard does not blank the key.Breakdown(dash/query.go:1744) groups one event into one row; the asserted key matches the SQL string concatenation exactly. - The full diff vs base is now 7 files, all in
dash/, still read-only reporting of an existing column. Fail-open, storage, and data dependence are unchanged from round 1. - I did not run the Go or node tests; live tests were not approved. The author reports them clean (macOS, Go 1.27.4,
./dash/...with-race, 678 s).
Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
|
chore(plugins): bump the plugin versions for v0.7.7 - Pi package: 0.1.5 -> 0.1.6 (#1294, one-command installer). - OpenCode plugin: pinned proxy v0.7.6 -> v0.7.7 (index.js, README, install how-to, commands and review1 tests). - Claude Code plugin 0.7.8, Codex 0.2.14, Bob 0.1.3: unchanged, no file in them changed since v0.7.6 (#1285 is dash only). Release owner (David Amid, 2026-11-23, integrator session): release v0.7.7 as a non-beta. The OpenCode CI job failed twice on failopen.test.mjs timing tests that this PR does not touch (5/5 pass locally); the owner chose to merge and report the flake (sent to flaky-tests, #1268). Assisted-By: Claude Opus 5.5 Signed-off-by: DAVID AMID <[email protected]>
Adds a dashboard figure; no other behavior change.
Fixes #1283
Summary
The overview placement panel now counts the top-level
cache_controlmark. A request whose only mark is the top-level one shows 1 in a new "top-level" slot. The placement sums add up to the breakpoint total.Data dependence
Metadata only; it sums the existing
cache_bp_rootcount column, so no data-dependence row changes.What changed
BreakpointTotalshas a newRootfield (JSONroot). The placement sums addcache_bp_root.Modal placement. The grouping now includes the root column. The modal string ends with
, top-level=N.Overview UI (
dash/ui/app.js). The panel shows a "top-level" slot next to system, tools, messages and blocks. The empty-state check counts it.One name. The per-request placement breakdown (
cache_bp_location) now saystop-level=N, as the overview does.Test.
dash/overview_rootbp_test.go: a root-only request shows 1 in the top-level slot, the sums add up to 5, and the modal string hastop-level=1.Golden files. I edited 3 files by hand for the new
rootfield and modal string:dash/testdata/golden/stats.jsondash/testdata/golden/stats_lean.jsondash/testdata/golden/stats_windowed.jsonCG_GOLDEN_UPDATE=1also rewrote unrelated goldens (kv_*,tools*,toolfilter) with float and ordering noise. I reverted that noise.How it was tested
macOS, Go 1.27.4.
gofmtandgo vet ./...: clean.go test ./internal/timingguard: pass.CGO_ENABLED=1 go test -race -timeout 30m ./dash/...: pass (689 s).node --test dash/*.test.mjs: 51 pass, 0 fail.Main is frozen until the v0.7.6 tag. This PR merges after it.
Assisted-By: Claude Opus 5.5 [email protected]