Repository navigation
refactor(status): share store summary calculations (#168 slice) - #261
Conversation
There was a problem hiding this comment.
Head reviewed: 571a7f68a4761db3256974f7a4a8212c3d73450b (merge-base d286e7a). CI 4/4 green at this head (lint, test, test-windows, smoke).
Contract: #168 (authored by WhollyMindless, trusted). Governing bullet, verbatim: "Status assembly: share store-summary calculations between the chat report and status payload." Verification clause, verbatim: "Preserve tool schemas and responses, repository visibility, lock ordering, capture defaults, and the exact injected bytes/invalidation behavior … Preserve the existing hook-level regressions and run the project's checks."
Per-criterion evidence:
- Share store-summary calculations — new
src/status/store-summary.ts:8summarizeStore(rows, ledger, malformed); both former inline copies now call it:src/inject/epochs.ts:119andsrc/tools/status-tool.ts:33.grep -rn "superseded: " src/finds only theStoreCountstype atsrc/status/payload.ts:23— no third inline copy remains. - Behavior preserved — counts are field-for-field identical to both removed blocks, same literal key order (
active, superseded, open, scopes, malformed, neverRetrieved, ledgerSince), and sampling points unchanged:epochs.tsstill samplesmalformedCount()afterreadLedger();status-tool.tsstill samples it before. Differential: the new characterization test run against based286e7a(test file copied, no src change) → 1 pass / 0 fail, confirming the extraction preserves both surfaces. - Test is not vacuous — mutation
active: active.length→active: rows.lengthinstore-summary.ts:17fails the characterization test attest/status.test.ts:367(0 pass / 1 fail); reverted, tree clean. - Schemas/responses/injected bytes — no schema or format file in the diff (
git diff --numstat origin/main...HEAD:epochs.ts +4/−12,store-summary.ts +26/−0,status-tool.ts +6/−16,status.test.ts +42/−1). The −1 in the test file is the import line replaced by its expanded form; no assertion deleted, no.skip, no tolerance widened. - Run the project's checks — at head:
bun run typecheck0 errors;bun run lint498 warnings = baseline;bun run test875 pass / 14 skip / 0 fail;bun run test:e2e30 pass / 0 fail. - No new framework or dependency — no
package.jsonchange in the diff.
Fixture mechanism verified against the tree: the blocked row is dropped by loadAll via blockedTs (src/store/files/load.ts:12), so active: 2, superseded: 1, scopes: 2 are the real totals, not an assertion tuned to the helper.
Findings: none. No P0, no P1, no nit.
Human merges.
|
🎉 This PR is included in version 0.15.12 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Partial contribution to #168: shared status-summary calculation, following the maintainer's handoff and the claim/checklist on the issue.
The epoch payload and
memory_statusindependently compute the same active, superseded, open, scope, malformed and use-ledger counts. Both now callsummarizeStoreinsrc/status/store-summary.ts. The helper returns the active rows alongside the common counts so the chat report can retain its additional byte/growth/capture metrics and quarantine list.Callers still perform their own reads in the existing order and sample malformed-count state at their existing points. Existing aggregate visibility, payload shape, and chat-only metrics are preserved; #213's policy decision remains separate. This slice makes no performance claim and introduces no cache.
A mixed-repository characterization check exercises the actual chat tool and epoch controller with active, superseded, blocked and previously-used rows. It pins the existing aggregate totals and ledger coverage across both surfaces. The check passes on the base implementation as expected for a behavior-preserving extraction.
Validation on base
d286e7a, Bun 1.4.4:bun run gate: typecheck and lint pass (498 advisory warnings); unit 863 pass / 26 skip / 0 fail; E2E 30 pass / 0 fail.The checklist on #168 retains session-binding/call-context extraction and capture/hook orchestration as later independently reviewable stages. This PR does not close #168. Automation labels were left untouched. Please feel free to defer, narrow, or reject this contribution if you prefer a different sequence or boundary.