Skip to content

refactor(status): share store summary calculations (#168 slice) - #261

Merged
abogartz merged 2 commits into
abogartz:mainfrom
WhollyMindless:refactor/168-status-summary
Nov 3, 2026
Merged

abogartz merged 2 commits into
abogartz:mainfrom
WhollyMindless:refactor/168-status-summary

Conversation

@WhollyMindless

Copy link
Copy Markdown
Contributor

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_status independently compute the same active, superseded, open, scope, malformed and use-ledger counts. Both now call summarizeStore in src/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:

  • New characterization check on base: 1 pass / 0 fail.
  • Focused status/epoch/lifecycle suites on Windows and WSL Linux: 57 pass / 0 fail each.
  • Full Windows 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.

@ocsi-triager ocsi-triager Bot added the review:requested Human-admitted for autonomous review by ocsi-reviewer label Nov 3, 2026

@ocsi-reviewer ocsi-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Share store-summary calculations — new src/status/store-summary.ts:8 summarizeStore(rows, ledger, malformed); both former inline copies now call it: src/inject/epochs.ts:119 and src/tools/status-tool.ts:33. grep -rn "superseded: " src/ finds only the StoreCounts type at src/status/payload.ts:23 — no third inline copy remains.
  2. 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.ts still samples malformedCount() after readLedger(); status-tool.ts still samples it before. Differential: the new characterization test run against base d286e7a (test file copied, no src change) → 1 pass / 0 fail, confirming the extraction preserves both surfaces.
  3. Test is not vacuous — mutation active: active.length → active: rows.length in store-summary.ts:17 fails the characterization test at test/status.test.ts:367 (0 pass / 1 fail); reverted, tree clean.
  4. 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.
  5. Run the project's checks — at head: bun run typecheck 0 errors; bun run lint 498 warnings = baseline; bun run test 875 pass / 14 skip / 0 fail; bun run test:e2e 30 pass / 0 fail.
  6. No new framework or dependency — no package.json change 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.

@abogartz
abogartz merged commit f68e3b3 into abogartz:main Nov 3, 2026
7 of 8 checks passed
@abogartz-opencode-self-improvement

Copy link
Copy Markdown

🎉 This PR is included in version 0.15.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released review:requested Human-admitted for autonomous review by ocsi-reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proposal: separate responsibilities in plugin setup (src/index.ts)

2 participants