Repository navigation
Extract an explicit remote-update policy from the skip-while-editing logic - #1608
Conversation
…loses #1512) The skip-while-editing conflict policy was inlined in both setNode and batchSetNodes, branching on editing state, own-echo detection, and ai-chat message-count heuristics duplicated across both call sites. Extract decideRemoteUpdate / shouldSkipStaleAiChatUpdate into remote-update-policy.ts as pure functions with their own unit tests; setNode and batchSetNodes now call the shared unit instead of inlining the policy. Behavior is unchanged (existing skip-while-editing suite and full frontend suite pass). Co-Authored-By: Claude <[email protected]>
Code Review: Extract remote-update policy from skip-while-editing logicReview Type: Initial Review Requirements Check
All acceptance criteria met. Single, atomic commit; correctly scoped to the extraction only. Overall AssessmentThis is a clean, well-executed pure extraction. I verified the two highest-risk behavior-parity items line-by-line against 1. 2. 3. Test coverage delta — real, not redundant. 4. Extraction quality. 5. CI. FindingsCritical IssuesNone. Suggested ImprovementsNone — this PR does exactly what the issue asked, nothing more, nothing less. Nitpicks
Triage Matrix
Recommendation: APPROVEPure, atomic, behavior-preserving extraction that fully satisfies issue #1512's acceptance criteria. The two highest-risk correctness traps called out in review scope (notifyConflict asymmetry, own-echo equality semantics) were both verified preserved exactly against the pre-refactor code. New unit tests add genuine incremental coverage rather than restating the existing integration suite. CI is green. |
Code Review: PR #1608 — Extract remote-update policy from skip-while-editing logicNote on process: This is an independent second-party review. A prior review comment already exists on this PR, posted under the same account that authored the code — I did not take its claims (CI status, behavior-parity conclusions) at face value and re-verified everything below from the actual diff, actual file contents at both refs, and by actually running the test suite myself in an isolated worktree ( SummaryThis is a clean, behavior-preserving extraction. Verification of the four specific risk areas1. 2. private isPlausibleOwnEcho(_local: Node, incoming: Node): boolean {
const lastSent = this.lastPersistedContent.get(incoming.id);
if (lastSent === undefined) return false;
return lastSent === (incoming.content ?? '');
}New (pure function, export function isPlausibleOwnEcho(incoming: Node, lastSentContent: string | undefined): boolean {
if (lastSentContent === undefined) return false;
return lastSentContent === (incoming.content ?? '');
}Identical strict-equality semantics — only the lookup was hoisted to the caller ( 3. Tests actually run and passed by me.
4. Test coverage delta — real, incremental value, not redundant. FindingsCritical IssuesNone. Suggested ImprovementsNone blocking. One observation below is a nit, not a blocker. Nitpicks
Architecture/SRP AssessmentClean extraction. The new module imports only Recommendation: APPROVE |
Closes #1512