Skip to content

fix(engine): a correction that does not rebuild costs no recording - #591

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/refusal-costs-no-recording
Sep 22, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/refusal-costs-no-recording

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

What

reloadAtCurrentPosition(applying:) opened with endRecordingIfRunning(reason: .sourceReset) (AE#560, PR #570, shipped 7.8.0). Correct for the rebuild at the bottom of the call, wrong for the four exits above it that never reach one:

  1. loadIdentityNotCorrectable , a field that names the session
  2. sessionNotReloadable(sessionReloadRefusal) , a session that cannot be rebuilt in place
  3. sessionNotReloadable(decodePathRefusal) , AE#461's decode-path refusal
  4. AE#464 round 4's early return, for a field the session owns

AE#460 rule 2 is that a correction which does not rebuild costs the session nothing, and the function's own documentation says the refusals "leave the session untouched". AE#461 round 2 moved the decode-path refusal ahead of stopInternal for precisely that reason. From the top of the call, all four exits instead finished the recording, published recordingState = .ended and left the session playing on, with nothing said.

Present in 7.8.0, 7.8.1, 7.9.0 and 7.10.0.

How

The teardown moves down to the rebuild it was written for, immediately after applySessionOptionCorrection(proposed), which is the last statement that can still refuse. AE#560's own requirement is untouched: the recording is still closed as a source reset before the source is re-opened, so stopInternal's own call stays a no-op.

Witness

The rule is an ordering inside one function, so there is no policy value to assert and no way to drive four refusals through a real session in a unit test. Issue460RefusalCostsNothingTests reads the site and compares POSITIONS rather than words, the same shape as the AE#588 observer test. Rewording any of the four exits keeps it honest; moving one below the teardown fails it. Three cases: every non-rebuilding exit precedes the teardown, the rebuild still ends the recording exactly once and after the options are installed, and the reason is still .sourceReset.

Verified failing on the four exits before the fix (5 issues), green after. Full suite: 3309 swift-testing tests in 444 suites plus the XCTest half, both green.

🤖 Generated with Claude Code

https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f

AE#560 put `endRecordingIfRunning(reason: .sourceReset)` on the first line of
`reloadAtCurrentPosition(applying:)`. That is right for the rebuild at the
bottom of the call and wrong for everything above it.

Four exits never reach that rebuild: the identity refusal, the
not-reloadable-in-place refusal, AE#461's decode-path refusal, and AE#464
round 4's early return for a field the session owns. AE#460 rule 2 says none
of them may cost the session anything, the function's own documentation says
the refusals leave the session untouched, and #461 round 2 moved the
decode-path refusal ahead of `stopInternal` for exactly that reason. From the
top of the call, all four finished the recording, published
`recordingState = .ended` and left the session playing on with nothing said.
Shipped in 7.8.0 through 7.10.0.

The teardown moves to the rebuild it was written for, after
`applySessionOptionCorrection`, which is the last statement that can still
refuse. AE#560's own requirement is unchanged: the recording is still closed
as a source reset before the source is re-opened, so `stopInternal`'s call
stays a no-op.

The rule is an ordering inside one function, so the witness reads the site and
compares POSITIONS rather than words, the way the AE#588 observer test does.
Rewording any of the four exits keeps it honest; moving one below the teardown
fails it.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
@superuser404notfound
superuser404notfound merged commit 5ce6803 into main Sep 22, 2026
7 checks passed
@superuser404notfound
superuser404notfound deleted the fix/refusal-costs-no-recording branch September 30, 2026 21:22
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