Repository navigation
chore(deps): bump accountant to v0.7.0 (charge a rewrite to the new change, #1351) - #1403
Conversation
…hange, #1351) accountant v0.7.0 charges a cache rewrite to the operation whose change is new at the first changed position. A repeated fold no longer pays for a new sweep cut on the same message. Totals do not change. Add a recorder test for #1351: a repeated searchfold fold plus a new sweep cut on the same message. The break goes to the sweep. Fixes #1351 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 2 (glm, user of @amiddavid) | GLM rits/zai-org/glm-5-3 via Claude Code 2.1.332 | offload-review skill, @amiddavid's session | fresh | 2 of 2 | 1 of 2 | d1998f2857eb |
approve |
Verdict: approve
Findings
None. I could not prove a defect.
Non-blocking
accrec/recorder_test.go:301— The test covers only the "fold stays active" shape: run 3 reports the sweep alone. The real proxy reports every op on every turn, replays included (accrec/recorder.go:100, theEndcomment). So production traffic matches the "fold reported again" shape, which only the accountant's ownbreakblame_test.gocovers. The accountant repo tests both shapes, so the cover exists. A replayed-fold variant here would guard the path the proxy actually takes.accrec/recorder_test.go:336(PR body, "How it was tested") — The notes saygo test -race -run 'Accountant|Accrec|Shared'ran fordashandproxy. The interim rule says "Do not use-raceon the big suitesproxyanddash". The-runfilter keeps it light and no full suite ran, so I read this as within the rule's intent. Please confirm that reading.
What I checked
- The full diff. Three files:
go.mod,go.sum,accrec/recorder_test.go. One commit,d1998f28. DCO sign-off present,Assisted-By:used, conventional-commit title. - What accountant v0.7.0 changes. I diffed the module cache, v0.6.0 against v0.7.0. Only
internal/engine/compute.go,docs/design.md, and a newinternal/engine/breakblame_test.godiffer. The code change is narrow: a newbreakItemAtpicks which operation pays for a break at the first changed position. It skips an operation that an earlier request already applied (active, orFirstApplied <= Requests) and picks the new change. The olditemAtkeeps its old behavior, sochangeAtand every other caller are unchanged. No public API change. - The bug and the fix match. Issue #1351: a repeated searchfold fold plus a new sweep cut; the rewrite was charged to searchfold. In the accountant,
itemsare ordered active-first (compute.go,items()), so the olditemAtreturned the repeated fold. The fix returns the new sweep. I traced the new test through this path: run 3 items are [active fold, reported sweep];repeatsPreviousis true for the fold (active) and false for the sweep (FirstApplied=Requests+1 fromEndRequest,state.go:219), so the sweep pays. - The test fails on v0.6.0, as the PR body claims. I could not run tests (not approved), so I proved it by reading: bodies diff at position granularity, message 1 is the first differing entry in run 3, both ops' spans sit at
{messages, 1}, and v0.6.0'sitemAtreturns the first covering item in pipeline order — the active fold. The assertioncharged["cg:searchfold:f1"] != 0then fails. - The test compiles against the repo API.
recMsg,recBody,recMeta,mustRecMsg,recFacts,ThreadOf,Recorder.Begin/End/Compute,Usage{CacheWrite, CacheRead},accountant.Result.CacheEffects,EffectBreak,CacheEffect.ChangeID— all exist and are used the same way as the tests above the new one. - go.sum is correct. The v0.7.0 ziphash in the module download cache is
h1:4OkdL4c6UC1Tj1Frih5uBXI5KpSDDn5Jcj/FsRLd+ng=, equal to the new go.sum line. The nestedmetricsmodule is byte-identical between v0.6.0 and v0.7.0, so its unchanged require is right. - No consumer breaks. No repo code pins the old charge behavior: no dash or proxy test asserts a searchfold break charge, and
dashimportsaccountant/test/cases, which v0.7.0 does not change. - Repo rules. The behavior change is named at the top of the PR with the owner's yes (2026-11-25) and totals unchanged — accounting only. Data dependence: none stated and none found (sizes and ChangeIDs only). The commit carries the sign-off. Tests ran on macOS, Go 1.27.4, targeted packages only, per the interim rule.
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.332 | offload-review skill, @amiddavid's session | fresh | 1 of 2 | 1 of 2 | d1998f2857eb |
approve |
Verdict: approve
Findings
None. The change is accounting attribution only. No request, cache decision or fail-open path changes.
Non-blocking
accrec/recorder_test.go:303— the test covers only the branch where the fold stays active and is not reported again on request 3. In production the recorder reports replays (accrec/recorder.go:109), so the common shape is the fold reported again next to the sweep. That branch (repeatsPreviousviaFirstApplied, compute.go:1622) runs only in the accountant's own test, not through this repo's recorder. A second run with[]accountant.Operation{fold, sweep}on request 3 would cover it end to end.accrec/recorder_test.go:303— the name says "repeated searchfold", but the test never re-reports the fold. What repeats is the active change. Same root as the point above.
What I checked
- The full diff:
go.mod,go.sum,accrec/recorder_test.go. One commit,d1998f28. Nothing else changed. - The accountant v0.6.0 → v0.7.0 source, from the local module cache. Only
internal/engine/compute.go,docs/design.mdand a newbreakblame_test.godiffer.go.modand the sharedtest/casesdirectory are identical, sodash/accountant_agree_test.gokeeps its meaning. - The fix itself: row 1 of the cache-break table now charges the break through
breakItemAt, which skips operations that repeat a previous request (active, orFirstApplied <= Requests) and falls back to the first covering item.itemAtandchangeAtkeep their old behavior, so nothing outside row-1 blame moves.addBreaktakes the same tokens regardless of the ChangeID, so totals do not change, as the PR says. - The new test, traced through the engine: request 3 differs from request 2 at flat message 1, the client body is unchanged, the entry is hot (10 s gap, 5 m TTL), so row 1 fires. Both the active fold and the reported sweep cover the position;
breakItemAtpicks the sweep. On v0.6.0itemAtreturns the fold, so the test fails there — it is a real regression test. The fold is not ended in request 3 (restoredandtakenOverboth keep it: the sweep'sSizeBeforeis the fold's output, a chain), so the old code path is truly exercised. - Other repo tests that touch
accountant.EffectBreak(dash,proxy,proxyapp): they buildCacheEffectsby hand or assert that no break fires, so the re-attribution cannot break them. - Repo rules: the behavior change is named at the top of the PR with the owner's yes (2026-11-25) and the old and new behavior. Data dependence: none, sizes and ChangeIDs only. No binaries or LFS. DCO sign-off and
Assisted-By:are correct. Test notes say where they ran (macOS, Go 1.27.4), and only targeted suites ran, per the interim rule. - No other reference to accountant v0.6.0 remains; the nested
accountant/metricsrequire is unchanged and v0.7.0 asks for the same version.
…weep The proxy reports every operation on every turn. Run the #1351 test for both shapes: the fold stays active, and the fold is reported again. Assisted-By: Claude Opus 5.5 <[email protected]> Signed-off-by: DAVID AMID <[email protected]>
|
Round 1 reply.
|
|
Correction to my earlier reply on the -race question.
|
|
A correction to the reply above, about That reply is wrong.
|
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.332 | offload-review skill, @amiddavid's session | resumed | 2 of 2 | 2 of 2 | 92a753999b34 |
approve |
Verdict: approve
Findings
None. I could not prove a defect in the new commit.
Earlier findings
- My non-blocking note 1 (fold-reported-again variant missing): fixed. Commit
92a7539turns the test into a loop overreportAgainand adds the[]accountant.Operation{fold, sweep}shape on run 3. I traced it through the accountant: a reported op with the ChangeID of an active one replaces it (compute.go,items()), so both items are reported and the fold comes first;repeatsPreviousstill skips it (FirstApplied= 2 ≤Requests= 2), andbreakItemAtcharges the sweep. On v0.6.0 the first covering item is the fold, so this shape also fails there. The author's claim that both shapes fail on v0.6.0 holds. - My non-blocking note 2 (
-raceondashandproxy): answered, then corrected by the author. The author first called the filtered run within the rule's intent, then corrected themselves twice (comments at 12:28:34 and 12:28:41 — same text, a double post): the rule's text gives no exemption for a-runfilter, anddashandproxywill run without-racefrom now on. I accept the correction. The rule text supports it. Nothing in this PR needs a code change for it. - Reviewer 1's two non-blocking notes: fixed by the same commit. The first is the same coverage gap as my note 1 — I checked it myself, proof above. The second (the name said "repeated searchfold" while the fold was never re-reported) is fixed by the rename to
...NotChargedToARepeatedFoldplus the newreportAgainvariant, which does re-report it.
Non-blocking
- The author posted the
-racecorrection twice (.review-in-comments.txt, 12:28:34 and 12:28:41). The two posts say the same thing. Harmless; noted only so the record is clean.
What I checked
- Last review: round 1, d1998f2, 2026-11-25T12:26:39Z.
- New commits read: 1 (
92a7539, "test(accrec): cover a fold that the proxy reports again next to the sweep"). - Read in full: 2 reviews, 3 comments, 0 inline comments (from the three files; the inline file is empty).
- New items since my last review: reviewer 1's round-1 review (approve, two non-blocking notes, both same-root as mine); the author's round-1 reply (variant added,
-raceanswer); the author's two correction comments on-race; commit92a7539. I checked each one, as above. - The new commit in full. Only
accrec/recorder_test.gochanges;go.modandgo.sumare untouched since round 1, so my round-1 verification of the dependency bump stands. The test keeps its three-run shape and its assertion. Each subtest builds its ownRecorder, so the two shapes cannot share state.fmtis already imported. The subtest names render asfold reported again=false/=true. No timing, no sleeps. - The reported-again shape against the engine. As traced above: replacement of the active fold by the reported one,
FirstAppliedkept from the earlier request (state.go:31,withFirstApplied), sorepeatsPreviousis true for the fold and the sweep pays. The size chain (big→folded→cut) matches the ops'SizeBefore/SizeAfter, the same chain the accountant's ownbreakblame_test.gouses. - Commit rules. DCO sign-off present,
Assisted-By:used, conventional-commit title, test-only change.
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.332 | offload-review skill, @amiddavid's session | resumed | 1 of 2 | 2 of 2 | 92a753999b34 |
approve |
Verdict: approve
Findings
None. The new commit is test-only. It changes no product code, no dependency and no behavior.
Earlier findings
- Reviewer 1, round 1, non-blocking (fold not re-reported): fixed. Commit
92a7539turns the test into two subtests. Run 3 now reports[sweep]alone and[fold, sweep], the shape the proxy sends each turn. I traced the new branch through the engine:EndRequestreplaces the active fold with the reported one andwithFirstAppliedkeeps its first count (2), so at request 3repeatsPreviousis true for the fold and false for the sweep. The sweep pays in both shapes. - Reviewer 1, round 1, non-blocking (test name said "repeated searchfold"): fixed. The name is now
TestARewriteFromANewSweepCutIsNotChargedToARepeatedFold, and the fold is really repeated in the second subtest. - Reviewer 2, round 1, non-blocking (the
-racequestion): addressed by the author. The author first called the filtered-racerun allowed, then corrected themselves twice: the interim rule forbids-raceondashandproxywith no exemption for-run, and those suites run without-racefrom now on. I checked the rule text inCLAUDE.md; the correction is right. The runs already happened and passed, and the rule guards laptop load, not result correctness, so nothing in the PR needs to change.
Non-blocking
- The PR body still lists
go test -race -run 'Accountant|Accrec|Shared'fordashandproxyunder "How it was tested". The author's correction lives in the comments below it. A body edit would keep the record in one place. Nothing depends on it.
What I checked
- Last review: round 1,
d1998f2857ebf3d83dfbf22de8e32a733cdbf6aa, 2026-11-25T12:27:01Z. - New commits read: 1 (
92a7539"test(accrec): cover a fold that the proxy reports again next to the sweep"). - Read in full: 2 reviews, 3 comments, 0 inline comments (from the three files
.review-in-reviews.txt,.review-in-comments.txt,.review-in-inline.txt). - New items since my last review: the commit above (full diff read); the author's three comments of 2026-11-25T12:28:25Z, 12:28:34Z and 12:28:41Z (round-1 reply and two
-racecorrections, all checked as described above). - The new commit's diff: only
accrec/recorder_test.go, +39/−31.go.mod,go.sumand the rest of the PR are unchanged from the head I reviewed in round 1. - The two subtests build a fresh
Recordereach, so no state leaks between them.fmtis already imported. Both subtests assert the same contract: one break, charged tocg:extract_llm_sweep:c1, none tocg:searchfold:f1. - On v0.6.0 both subtests fail: in either shape the fold comes first in pipeline order (active first, or reported first), and v0.6.0's
itemAtreturns the first covering item. This matches the author's reply and my round-1 trace. - Commit conventions: sign-off present,
Assisted-By:used, conventional-commit title.
Behavior change
Approved by the owner on 2026-11-25.
searchfold.extract_llm_sweep.Summary
Bumps accountant from v0.6.0 to v0.7.0. Fixes #1351.
What changed
go.modandgo.sum: accountant v0.7.0. The nestedmetricsmodule is unchanged in v0.7.0, so its require stays.TestARewriteFromANewSweepCutIsNotChargedToARepeatedSearchfoldinaccrec/recorder_test.go. It folds a message, then cuts it again with the sweep. The break must go to the sweep and not to searchfold.Data dependence
None. The accountant uses sizes and ChangeIDs only.
How it was tested
go build ./...,go vet ./...andmake lintpass.cg:searchfold:f1) and passes on v0.7.0.go test -racepasses foraccrec,accwire,keepalive,thinkcount.go test -race -run 'Accountant|Accrec|Shared'passes fordash(includes the shared accountant cases),proxy,proxyapp,apply. Note: the interim rule inCLAUDE.mdforbids-raceondashandproxy, even with a-runfilter, so these 2 runs went against it. They passed. From now on these 2 packages run without-race.go test -race -count=1 -run TestARewriteFromANewSweepCutIsNotChargedToARepeatedFold ./accrecpasses on the final head, for both shapes (the fold stays active, and the fold is re-reported). Both shapes fail on v0.6.0.Assisted-By: Claude Opus 5.5 [email protected]