Repository navigation
fix(engine): a correction that does not rebuild costs no recording - #591
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
reloadAtCurrentPosition(applying:)opened withendRecordingIfRunning(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:loadIdentityNotCorrectable, a field that names the sessionsessionNotReloadable(sessionReloadRefusal), a session that cannot be rebuilt in placesessionNotReloadable(decodePathRefusal), AE#461's decode-path refusalAE#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
stopInternalfor precisely that reason. From the top of the call, all four exits instead finished the recording, publishedrecordingState = .endedand 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, sostopInternal'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.
Issue460RefusalCostsNothingTestsreads 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