Repository navigation
Phase 1.1: Enhanced ContentProcessor with Dual-Representation - #76
Merged
malibio merged 3 commits intoAug 19, 2025
Merged
Conversation
- Create comprehensive ContentProcessor service with Logseq-inspired dual-representation - Implement lossless Source ↔ AST ↔ Display conversions for future backlinking - Add wikilink detection foundation for [[text]] syntax (Phase 2 preparation) - Refactor TextNode to use ContentProcessor, removing scattered content logic - Add comprehensive testing suite with >95% coverage and performance benchmarks - Maintain full backward compatibility while establishing foundation for Epic #69 Key Features: - Dual-representation pattern enabling advanced text editing features - AST-based architecture ready for AI integration and collaboration - Security validation with XSS prevention and content sanitization - Performance optimized for 1000+ node documents (<500ms parse time) - Extensible foundation for Phase 2 backlinking and Phase 3 rich decorations Addresses #70 - Phase 1.1 of Text Editor Architecture Enhancement Epic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Remove unused updateNodeContentById function from BaseNodeViewer.svelte - Remove unused transferChildren function from BaseNodeViewer.svelte - Ensures code passes ESLint quality checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
- Add ADR-005: Node Reference Decoration System architectural decision - Create comprehensive node-reference-system.md component documentation - Update node-types.md to include node reference system section - Add ADR-005 to system-overview.md architectural decisions list 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
malibio
deleted the
feature/issue-70-contentprocessor-dual-representation
branch
August 19, 2025 20:15
malibio
added a commit
that referenced
this pull request
Feb 4, 2026
* Implement Enhanced ContentProcessor with Dual-Representation (Phase 1.1) - Create comprehensive ContentProcessor service with Logseq-inspired dual-representation - Implement lossless Source ↔ AST ↔ Display conversions for future backlinking - Add wikilink detection foundation for [[text]] syntax (Phase 2 preparation) - Refactor TextNode to use ContentProcessor, removing scattered content logic - Add comprehensive testing suite with >95% coverage and performance benchmarks - Maintain full backward compatibility while establishing foundation for Epic #69 Key Features: - Dual-representation pattern enabling advanced text editing features - AST-based architecture ready for AI integration and collaboration - Security validation with XSS prevention and content sanitization - Performance optimized for 1000+ node documents (<500ms parse time) - Extensible foundation for Phase 2 backlinking and Phase 3 rich decorations Addresses #70 - Phase 1.1 of Text Editor Architecture Enhancement Epic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix: Remove unused functions to resolve linting errors - Remove unused updateNodeContentById function from BaseNodeViewer.svelte - Remove unused transferChildren function from BaseNodeViewer.svelte - Ensures code passes ESLint quality checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Document universal node reference system architecture - Add ADR-005: Node Reference Decoration System architectural decision - Create comprehensive node-reference-system.md component documentation - Update node-types.md to include node reference system section - Add ADR-005 to system-overview.md architectural decisions list 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
malibio
added a commit
that referenced
this pull request
Feb 26, 2026
* Implement Enhanced ContentProcessor with Dual-Representation (Phase 1.1) - Create comprehensive ContentProcessor service with Logseq-inspired dual-representation - Implement lossless Source ↔ AST ↔ Display conversions for future backlinking - Add wikilink detection foundation for [[text]] syntax (Phase 2 preparation) - Refactor TextNode to use ContentProcessor, removing scattered content logic - Add comprehensive testing suite with >95% coverage and performance benchmarks - Maintain full backward compatibility while establishing foundation for Epic #69 Key Features: - Dual-representation pattern enabling advanced text editing features - AST-based architecture ready for AI integration and collaboration - Security validation with XSS prevention and content sanitization - Performance optimized for 1000+ node documents (<500ms parse time) - Extensible foundation for Phase 2 backlinking and Phase 3 rich decorations Addresses #70 - Phase 1.1 of Text Editor Architecture Enhancement Epic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Fix: Remove unused functions to resolve linting errors - Remove unused updateNodeContentById function from BaseNodeViewer.svelte - Remove unused transferChildren function from BaseNodeViewer.svelte - Ensures code passes ESLint quality checks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * Document universal node reference system architecture - Add ADR-005: Node Reference Decoration System architectural decision - Create comprehensive node-reference-system.md component documentation - Update node-types.md to include node reference system section - Add ADR-005 to system-overview.md architectural decisions list 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
5 tasks done
mstomar125
pushed a commit
that referenced
this pull request
May 27, 2026
Daemon-broadcast events arrive on the gRPC WatchNodes stream after every
local UpdateNode RPC confirms. With the existing 500ms persistence
debounce in PersistenceCoordinator, the user types optimistically, the
debounced write fires, the daemon broadcasts the confirm, and the
front-end's setNode() races back in and overwrites the editor with the
*older* confirmed state — destroying characters typed in the meantime.
Add a guard: when source.type === 'database' and the incoming node is
either focused (focusManager.editingNodeId === node.id) or has an
in-flight or pending persistence operation, keep the local optimistic
copy untouched. Stash the server-confirmed version in a non-reactive
`serverConfirmedVersions` Map so the next UpdateNode RPC carries the
freshest version for OCC — without mutating any reactive state.
Why non-reactive: mutating the reactive `nodes` Map (or mutating a
property of a node inside it) triggers Svelte re-renders that remount
the focused textarea via the `{#if isEditing}` block in
base-node.svelte. That has its own observable side effects on cursor
state and we want zero observable change from the guard path.
Adds PersistenceCoordinator.hasPending(nodeId) so the guard can ask the
coordinator directly rather than reaching into its private state.
Fixes nodespace-sync#76 (typing corruption: characters dropped or
replaced under sustained input).
nodespace-sync#77 (Enter on a non-empty node creates an empty node
above instead of below) was initially suspected to share this root
cause but verified separately by the user — the bug reproduces in
single-window mode and after this fix lands. Tracked separately; the
root cause is in the Enter handler / insertion path, not in setNode.
Tests: 7 new cases in
src/tests/services/shared-node-store-skip-while-editing.test.ts
covering focused-clobber-skip, pending-clobber-skip, the regression
case (no focus, no pending → apply normally), viewer-source still
authoritative for focused nodes, never-seen nodes accept fresh state,
local node.version unchanged when guard fires, and the
server-confirmed-version cache is cleared when a non-guarded setNode
applies (no shadowing).
Test deltas vs origin/main:
- shared-node-store family: 245 → 252 passing (+7 new)
- full frontend suite: 3832 → 3839 passing, same 93 pre-existing
localStorage-env failures unchanged
Manually verified end-to-end against the two-window same-device demo
(scripts/run-two-daemons.sh + the worktree's vite dev server +
nodespace-app windows for alice and bob). Sustained typing in alice
no longer corrupts characters; bob continues to receive alice's
writes within ~1s.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
malibio
pushed a commit
that referenced
this pull request
Jun 22, 2026
Daemon-broadcast events arrive on the gRPC WatchNodes stream after every
local UpdateNode RPC confirms. With the existing 500ms persistence
debounce in PersistenceCoordinator, the user types optimistically, the
debounced write fires, the daemon broadcasts the confirm, and the
front-end's setNode() races back in and overwrites the editor with the
*older* confirmed state — destroying characters typed in the meantime.
Add a guard: when source.type === 'database' and the incoming node is
either focused (focusManager.editingNodeId === node.id) or has an
in-flight or pending persistence operation, keep the local optimistic
copy untouched. Stash the server-confirmed version in a non-reactive
`serverConfirmedVersions` Map so the next UpdateNode RPC carries the
freshest version for OCC — without mutating any reactive state.
Why non-reactive: mutating the reactive `nodes` Map (or mutating a
property of a node inside it) triggers Svelte re-renders that remount
the focused textarea via the `{#if isEditing}` block in
base-node.svelte. That has its own observable side effects on cursor
state and we want zero observable change from the guard path.
Adds PersistenceCoordinator.hasPending(nodeId) so the guard can ask the
coordinator directly rather than reaching into its private state.
Fixes nodespace-sync#76 (typing corruption: characters dropped or
replaced under sustained input).
nodespace-sync#77 (Enter on a non-empty node creates an empty node
above instead of below) was initially suspected to share this root
cause but verified separately by the user — the bug reproduces in
single-window mode and after this fix lands. Tracked separately; the
root cause is in the Enter handler / insertion path, not in setNode.
Tests: 7 new cases in
src/tests/services/shared-node-store-skip-while-editing.test.ts
covering focused-clobber-skip, pending-clobber-skip, the regression
case (no focus, no pending → apply normally), viewer-source still
authoritative for focused nodes, never-seen nodes accept fresh state,
local node.version unchanged when guard fires, and the
server-confirmed-version cache is cleared when a non-guarded setNode
applies (no shadowing).
Test deltas vs origin/main:
- shared-node-store family: 245 → 252 passing (+7 new)
- full frontend suite: 3832 → 3839 passing, same 93 pre-existing
localStorage-env failures unchanged
Manually verified end-to-end against the two-window same-device demo
(scripts/run-two-daemons.sh + the worktree's vite dev server +
nodespace-app windows for alice and bob). Sustained typing in alice
no longer corrupts characters; bob continues to receive alice's
writes within ~1s.
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
malibio
pushed a commit
that referenced
this pull request
Jun 22, 2026
- Foreign-write OCC defeat: the guard previously stashed `node.version` from any database broadcast, including cloud-relayed writes from another client. The next UpdateNode would then carry the foreign writer's version against the local content, silently overwriting the foreign change. Add an `isPlausibleOwnEcho` heuristic — only stash when local content equals or extends the incoming content (exact echo, or echo+more-typed-chars). For genuine foreign writes, leave the cache empty so the next RPC uses the local version and the backend's OCC surfaces the conflict. - hasPending race + repeated calls: the coordinator transitions a node between its pending/executing/queued maps, so `hasPending` can flip between the guard condition and the log message. Compute `isFocused` and `hasPending` once into locals, use those for both the condition and the log. - Persistence consumes the cache — covered: extracted `computeOccVersionForUpdate(nodeId)` as the single source of truth for "what version does the next UpdateNode RPC carry?". The persistence closure routes through it; a new test asserts that after the guard fires, `computeOccVersionForUpdate` returns the stashed version (5), not the local node.version (1). Future refactor that drops the cache read fails this test instead of silently re-introducing nodespace-sync#76. - Foreign-write detection — covered: new test plants a divergent optimistic content, fires a database broadcast with a different content + higher version, and asserts the cache stays empty. - `UpdateSource = 'database'` contract: added a comment naming the intended producers (tauri-sync-listener / browser-sync-service) so the next refactor that adds a new 'database' producer knows to audit the guard's assumption. - persistedNodeIds invariant: added a one-line comment naming the "database event for existing node ⟹ persisted server-side" invariant so a future refactor that drops the `existingNode` check doesn't accidentally start marking unseen nodes as persisted. - Fixed an issue cross-reference (#77 → #76) in setNode's doc comment. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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.
Closes #70