Skip to content

fix(api): apply paper reviews at validated source offsets - #459

Merged
mikamikasuki merged 1 commit into
mikamikasuki:mainfrom
Ehsan-hash:fix/review-span-offsets
Oct 27, 2026
Merged

mikamikasuki merged 1 commit into
mikamikasuki:mainfrom
Ehsan-hash:fix/review-span-offsets

Conversation

@Ehsan-hash

Copy link
Copy Markdown
Contributor

Saved manuscript revision proposals can identify an exact occurrence of repeated text, but applying them currently rejects the proposal as ambiguous.

Resolve every selected edit against the original source, validate its stored character span, and apply non-overlapping edits from right to left. This preserves unselected occurrences and prevents earlier replacements from shifting later edits. Unique legacy edits without offsets, revision conflicts and generation reviews retain their existing behavior.

Validation: reproduced the original rejection through the real SQLite/API path. Both new API scenarios fail against the original function and pass with the fix. Nine affected checks also pass, covering legacy edits, generation/manual-edit protection, Files/Studio publication and writing contracts. Complete failure traces were retained. No full backend suite, browser, PostgreSQL or live model/provider run was performed for this change.

Fixes #398

@mikamikasuki
mikamikasuki merged commit b6e1d9d into mikamikasuki:main Oct 27, 2026
2 checks passed
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.

Review apply rejects repeated-span edits with valid offsets

2 participants