M2.2 story entries store, actions#349
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis PR implements Milestone 2 Slice 2.2 (entry-arms), adding story entry mutation and rollback operations alongside a new working-set store for synchronization. Edit-blocking logic moves to the generation store to eliminate circular dependencies, and comprehensive rejection codes and type extensions enable structured error handling throughout. ChangesEntry-arms and rollback core
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request establishes the entries working-set store and implements the rollback-to-entry functionality, including delta reversal and pruning, along with moving the user-edit gating logic to the generation store to prevent dependency cycles. The review feedback suggests optimizing the rollback delta selection query by replacing a correlated subquery with a leftJoin for better database performance. Additionally, it recommends validating rollback targets before modifying the reversalInProgress state, transitioning to a distinct error state upon failure, and ensuring that the delete handler consistently returns the notFound rejection code when a target is missing.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@lib/actions/delta/reverse-replay.ts`:
- Around line 103-114: The current catch lumps transaction failures and
post-commit patcher failures together; separate them so transaction errors (from
ctx.runInTransaction([...ops, ...pruneOps])) still throw
DeltaReplayError('Reverse-and-prune failed', ...) while errors thrown by the
subsequent patch loop (from patches and resolveByTable(...).patcher) are
reported distinctly to indicate the DB change committed already. Update
reverse-replay.ts to: run ctx.runInTransaction and catch/throw
DeltaReplayError('Reverse-and-prune failed', { cause, actionId }) for any
failure there; then execute the for (const p of patches) loop outside that
try/catch and if a patcher throws, throw a different DeltaReplayError (e.g.,
'Post-commit patch sync failed') that includes the original error as cause, the
actionId, and a flag/property (e.g., committed: true) so callers know the deltas
were pruned and should not retry unsafely; keep references to buildUndoOps,
pruneOps, ctx.runInTransaction, patches, resolveByTable, and DeltaReplayError
when making the changes.
In `@lib/pipeline/runtime/orchestrator.ts`:
- Line 55: newRunState can throw via getPipeline(kind) which may abort commitRun
before generationStore.finishRun runs and leave txState.runs in an inconsistent
state; fix by validating the pipeline kind before creating successor runs (move
the getPipeline(kind) lookup out of newRunState into commitRun or add a
non-throwing getPipelineSafe that returns undefined), and if the kind is
unknown, ensure you call generationStore.finishRun(...) / run cleanup (or abort
successor creation) before throwing or return a safe default gateBehavior;
update references newRunState, getPipeline, commitRun, generationStore.finishRun
and txState.runs accordingly so cleanup always executes prior to any thrown
error.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 595ef319-a347-458c-8278-592c9acd0956
📒 Files selected for processing (23)
docs/implementation/milestones/02-first-user-loop/milestone.mddocs/implementation/milestones/02-first-user-loop/slices/02-entry-arms.mddocs/implementation/roadmap.mdlib/actions/delta/registry.tslib/actions/delta/reverse-replay.tslib/actions/index.tslib/actions/story-entries/operational.test.tslib/actions/story-entries/operational.tslib/actions/story-entries/register.test.tslib/actions/story-entries/register.tslib/actions/types.tslib/pipeline/__tests__/chained-and-parallel.test.tslib/pipeline/index.tslib/pipeline/runtime/concurrency.test.tslib/pipeline/runtime/gate.test.tslib/pipeline/runtime/gate.tslib/pipeline/runtime/orchestrator.tslib/stores/__tests__/namespace-shape.test.tslib/stores/entries/entries.test.tslib/stores/entries/entries.tslib/stores/generation/generation.test.tslib/stores/generation/generation.tslib/stores/index.ts
💤 Files with no reviewable changes (3)
- lib/pipeline/runtime/gate.test.ts
- lib/pipeline/runtime/gate.ts
- lib/pipeline/index.ts
Summary by CodeRabbit
New Features
Enhancements
Tests
Documentation