Skip to content

fix(runtime): report retired 0.1.x compaction checkpoints as superseded - #4853

Closed
Astro-Han wants to merge 1 commit into
mainfrom
fix/history-compact-retired-checkpoint-diagnostic
Closed

fix(runtime): report retired 0.1.x compaction checkpoints as superseded#4853
Astro-Han wants to merge 1 commit into
mainfrom
fix/history-compact-retired-checkpoint-diagnostic

Conversation

@Astro-Han

Copy link
Copy Markdown
Contributor

Summary

#4779 retired the unmarked v0.1.x text summary contract: every V2 checkpoint now has to carry a summaryFormat: 'sections_v1' stamp, and a checkpoint without one no longer passes validateHistoryCompactCheckpointShape. That is the right call, and every consumer already fails open on the retired records — Compaction re-summarizes, conversation-copy drops the checkpoint, the ledger load path skips it.

Diagnostics did not get the message. execution-inspect grades an unrecognized checkpoint compaction_checkpoint_invalid at error severity unless isSupersededHistoryCompactCheckpoint recognizes it — and that classifier keys on source.policyVersion, a field v0.1.x never wrote (source arrived in #955, long after). So every Session carrying a checkpoint from before the stamp now reports durable corruption on inspect, and the records that really are damaged stop standing out.

The retired generation cannot name itself: it predates both the source policy and the format stamp. The only thing separating it from a damaged record is that restoring the stamp would make it valid — so that is the test. A V2 checkpoint with no stamp that validates once the stamp is injected is history; one that stays invalid is still corruption.

Refs #4791

Verification

node --test --test-concurrency=4 "dist/__tests__/history-compact-checkpoint.test.js" "dist/__tests__/execution-inspect.test.js" "dist/__tests__/effective-history-compaction.test.js"
# tests 36  pass 36  fail 0

npm --workspace @maka/runtime run build, npm run format, npm run lint all clean. The new test fails on main's classifier (it returns false for the unmarked checkpoint, so the assertion expecting true fails).

Not run: the rest of the runtime suite, E2E. No user-visible surface changes — this only moves one inspect diagnostic from error to info.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code — found the gap while reviewing #4779's execution quality, wrote the classifier change and the regression test. Reproduced against built dist before writing the fix.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

#4779 retired the unmarked v0.1.x text summary contract by requiring a
`summaryFormat` stamp on every V2 checkpoint. Every consumer already fails
open on the retired records — compaction re-summarizes, copy drops them, the
ledger load path skips them — but `execution-inspect` graded them
`compaction_checkpoint_invalid` at error severity, because the superseded
classifier keys on `source.policyVersion`, a field v0.1.x never wrote.

So every Session carrying a checkpoint from before the stamp reports durable
corruption on inspect, and the records that really are damaged no longer
stand out.

Classify the retired generation the only way it can be recognised: a V2
checkpoint with no stamp that would validate if the stamp were restored is
history, not damage. A record that stays invalid with the stamp injected still
grades as corruption.

Generated-by: Claude Code
@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 5, 2026
@Astro-Han Astro-Han closed this Sep 5, 2026
@Astro-Han
Astro-Han deleted the fix/history-compact-retired-checkpoint-diagnostic branch September 5, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant