Repository navigation
feat(T13842): read-only docs projection preview (previewDocUpdateThroughSections) - #2358
Merged
Merged
Conversation
…tion preview Runs the exact projection inside its transaction and rolls it back, so docs-update can write the fetch-visible row from the merged text before the projection commits (review-2253 on #2338, option a). No leases are acquired; conflict version uids name rolled-back rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
review-2253 blocked #2338's ordering, where the projection commits before docs-update writes its row. Lead chose option (a): compute the merged text without committing, write the blob and row from it, then commit the projection. This PR adds the read-only entry point that #2338 stacks on.
What
previewDocUpdateThroughSections(projectRoot, input: ProjectDocUpdateInput): Promise<DocUpdatePreview>inpackages/core/src/docs/section-write-path.ts, returning{ mergedText, wouldAdvance, conflicts }.BEGIN IMMEDIATEtransaction, then rolls it back via an internalPreviewRollback. SowouldAdvanceis the realhead.advanced, not an estimate.conflictsname rolled-back rows, so callers should use onlysectionId.projectDocUpdateThroughSectionsis unchanged; both functions share a privateprojectDocUpdate(…, preview).Evidence
section-write-path.test.ts, "T13842: previewDocUpdateThroughSections returns the merged text the projection lands, and writes nothing". It covers a stale-base append merge: the preview's merged text equals what the real projection then lands, and the version count, head uid, section state and leases are all unchanged after the preview.tsc --noEmitwith 0 errors, and gate 38--base origin/mainOK. Biome is clean on both files. GitHub CI is the authoritative evidence.🤖 Generated with Claude Code