refactor: Phase 2 — less ceremony in the application layer - #90
Merged
Merged
Conversation
…oss mutations Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… shape Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e queued-replay test Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
4 tasks
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.
Summary
Phase 2 of the runtime refactor plan (
.agents/plans/13-runtime-refactor/README.md). Stacked on #89; retarget once that merges.Four behavior-preserving commits plus one small follow-up from the final review:
mutatespine inflow-service.ts.planApprove,runStart,featureReset, andreviewStartshare the parse → lock → load → transition → save → project sequence. The helper mapsapprovePlan'snullvalue toundefinedso theoperation.entityfield stays absent exactly as before.planSave,featureComplete,featureCompleteReplay,sessionClose,status, andrequestAnchorare untouched.repository.read()optimization is gone; the under-lock check was always the correct one. This is the one deliberate behavior change in the phase: an exactflow_feature_completereplay now acquires the session lock once where it previously did not. The response is byte-identical.featureCompleteReplaydeliberately stays lock-free: it is read-only and the operation ledger is append-only, so a stale read can only fail to find a replay, never fabricate one. TheMemorySessionRepositorytest double now serializestransactlike the production file lock; the bespokeCompletionRaceRepositoryis deleted and twotransactionCountassertions moved from N to N+1 accordingly.CloseStateshape with two builders (closeFailure,archiveLookupFailure) and onerecoveryResponseenvelope. Every summary,closeStatefield, projection,delivery/operationpresence, and recovery string was traced site by site against the old builders. The plan's brief deleted helpers that the status path still used; those were inlined.sameSessionhelper (canonical-JSON equality) replaces oneJSON.stringifycomparison insession-close.ts, three digest comparisons inworkspace.ts, and one in the test double. Thesession-close.tssite becomes key-order tolerant, which is non-manifesting: everySessionproducer converges on schema key order.CompactProjection), rename the queued-replay test to say what it now proves.No prompt text, guidance, Zod schema, tool name, tool response field, or Session v5 shape changes.
Test plan
bun run checkatf3494a2: 1230 pass, 1 skip, 0 fail across 81 filesDeferred follow-ups (not blocking)
closeFailureignoresdurableAcceptedon the non-collision path (unreachable today, gated byinstanceof ArchiveCollisionErrorat the onlyfalsecall site). Split into two functions so the type system carries the contract.mutate: constrainRequestto{ operationId: string }, drop the identicaloperationIdcallback at all four call sites and the unusedrequestparameter ofrespond.delivery/operationabsence on unconfirmed recovery responses moved from a compile-time?: neverto one runtime assertion intests/runtime-close.test.ts. Re-add a compile-time guard if a new close-failure path is introduced.🤖 Generated with Claude Code