Skip to content

fix(cli): a preview older than the checkpoint route is not adopted as the history owner - #6218

Open
miguel-heygen wants to merge 3 commits into
mainfrom
fix/history-owner-capability
Open

miguel-heygen wants to merge 3 commits into
mainfrom
fix/history-owner-capability

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What changes for you

With a preview from an older HyperFrames still running on the project, check --json and snapshot no longer lose their reports. If the CLI can use the project's history without that preview, it does. If the old preview holds the history, the command now says which preview is too old and how to restart it, instead of Check report was not recorded: The preview answered 404.

Why

historyOwner.connect() adopted any running preview whose GET /history was not 404. Previews before v0.8.152 answer that route but have no POST /history/checkpoint (first shipped in #5524, v0.8.152), so every report-recording call returned 404 and the report was dropped.

How

connect() checks the preview's reported version against FIRST_PREVIEW_WITH_CHECKPOINT = "0.8.152" before adopting it. A dev server, or any version that is not a release number, is taken as current, so nothing else changes. A too-old preview is passed over: the CLI opens the history itself. If the old preview holds the history lock, the CLI reports the preview's port and version and tells the user to restart it with hyperframes preview.

Tests

New historyOwner.connect.test.ts with a fake old preview:

  • v0.8.151 preview that holds the history and has no checkpoint route: refused with the "older than this CLI ... hyperframes preview" message, and no POST reaches it.
  • v0.8.151 preview that does not hold the history: passed over, the CLI records directly.
  • v0.8.152 preview: adopted, and the checkpoint POST reaches it.

With the gate removed, the first two fail. 3 runs in a row green; the existing history, artifact-capture and check-artifact suites pass (66 tests with the new file). Lint, format and typecheck clean.

Not covered: a real v0.8.151 preview (I did not install one); the fake serves what it served on those routes.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE · 0 blocker · 2 important · 0 nits · head b05c0665

  • important — historyOwner.ts:244: the gate sits in connect(), so it also covers history list/show/peek/undo/restore/pin/begin/end. Against a v0.8.151 preview that holds the history, those commands used to work, because every route they call exists in v0.8.151. Now they fail with the restart message, and withReader doesn't fall back to its read-only view because the error is a Refusal, not a HistoryBusyError. Restarting the preview is a fair fix, but the PR body says "nothing else changes". Either say in the body that these commands now refuse, or limit the refusal to checkpoint.
  • important — the non-required Comments ratchet fails on this head: historyOwner.ts comment share 6.2% → 6.4% from the two added doc comments (:228, :231).
Scope

Confirmed /checkpoint first shipped in v0.8.152 (#5524 merge commit is in tags from v0.8.152 on), and the route set is unchanged from v0.8.152 to the current version, so one version gate covers every route the CLI calls. compare-versions is already a cli dependency. The new suite passes locally; on the base historyOwner.ts the first two cases fail and the third passes, matching the PR body. Required CI was still running at review time.

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 162 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant