Skip to content

Extract an explicit remote-update policy from the skip-while-editing logic #1512

Closed

Description

@malibio

Overview

The "skip-while-editing" conflict policy is load-bearing but embedded inline in setNode, branching on editing state plus ai-chat message-count heuristics plus foreign-write stashing.

Problem Statement

The policy that decides whether a remote update is applied is spread through setNode and paired controller code, making it hard to reason about and a recurring source of the echo-clobbers-local-state bugs.

Proposed Solution

Extract an explicit shouldApplyRemoteUpdate(node, source, editingState) unit with its own tests (the skip-while-editing test suite already exists). Relates to ADR-026/042.

Acceptance Criteria

  • Remote-update decision logic extracted into a tested unit
  • setNode calls the unit rather than inlining the policy
  • Code passes bun run quality:fix; tests pass

Technical Specifications

Reference Files

  • shared-node-store.svelte.ts (~1389-1517 setNode), textarea-controller.svelte.ts (~425)
  • Context: ADR-026, ADR-042

Related Issues

Activity

  1. malibio commented on Jul 10, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 156 test files, 3991 tests passed.

  2. self-assigned this
    on Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions