Skip to content

perf(markdown): coalesce draft version hashing with publication - #35107

Merged
OrcaWin merged 2 commits into
mainfrom
OrcaWin/coalesce-markdown-draft-hashes-pass2
Oct 28, 2026
Merged

OrcaWin merged 2 commits into
mainfrom
OrcaWin/coalesce-markdown-draft-hashes-pass2

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​235 $\color{#cf222e}{\Huge{\mathbf{−}}}$​45 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​190
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​60 $\color{#cf222e}{\Huge{\mathbf{−}}}$​34 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​26

ELI5

Markdown edits build the version stamp for the text being published. Edits superseded inside the existing 16ms publication window, and edits while mobile graph sync is disabled, no longer calculate full draft hashes.

Follow-up to merged #34775 (31f3c524221); rebased onto main at 2747079f94a3a9e91e863e2a96c69e5c48ae2830. Its Markdown/preview eligibility fix is retained.

What Changed

The runtime graph scheduling key holds the admitted source IDs and exact draft strings, using map/key/text equality to detect meaningful changes. FNV version stamps are calculated by the existing mobile snapshot capture after scheduling coalesces edits. The scheduler, trailing/inflight ownership, hash function, and wire version format retain their behavior. Scheduling and snapshots share the existing Markdown/preview source policy.

Why

The production path is Monaco's accepted content callback → setEditorDraft → the mounted useRuntimeGraphSync subscriber → scheduling key → 16ms publication coalescer. On the base, changed admitted Markdown text is hashed before that coalescer. Chunked large paste already suppresses intermediate callbacks, so this does not claim one hash per paste chunk.

Controlled bursts of 100 real draft actions at 40,000/400,000 initial characters previously made 100 FNV calls, processing 4,005,050/40,005,050 characters for one publication. The follow-up hashes the final 40,100/400,100-character draft once, with the exact same final version. Disabled edits reduce 100 FNV calls to zero. A simulated 32ms cadence produced 100 publications on base; no cadence/CPU/frame or typing-latency measurement is claimed. Exact string equality can still inspect equal-length text; these are FNV operation/character counts, not a claim of zero text comparisons.

Linked Issue

Maintainer performance audit follow-up to merged #34775.

Visual Proof

N/A — internal scheduling/hash work changes; visible Markdown content and mobile version protocol retain their behavior.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated

Linux deterministic mounted hook tests use the real store draft action, 16ms scheduler, source policy and mobile snapshot builder. They cover N/10N bursts, unchanged recreated drafts, disabled/re-enabled sync, pending unmount, an in-flight trailing edit across disable/re-enable, preview-source admission/clear, and Markdown eligibility changes. The corrected base fails 4 tests and passes the preview correctness control; fixed focused suites pass 35 tests across 3 files.

Required ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 passed all 21 checks in 1488.5 seconds at exact clean head 595ebf00414365b1a4651774b254580705d7a01f. Log: /home/neil/.local/state/orca-electron-audit/markdown-current-main-evidence/check-changed.log.

Maintainer review: rebased onto main c58591e56d9 without conflicts; follow-up commit 384ade0b51f replaces two map-identity assertions with content checks and removes the test-local reference baseline that no longer exercised production code (the 4,005,050/40,005,050 figures come from the mounted hook test, which is unchanged). Gate on 384ade0b51f: ORCA_BACKGROUND_LAUNCH=1 pnpm check:changed --maxWorkers=2 reported check:changed: 6 changed file(s) since origin/main (c58591e56d); running 21 check(s). / ✓ 21 check(s) passed in 812.6s. (exit 0).

All tests run with ORCA_BACKGROUND_LAUNCH=1; no app/window was launched. macOS, Windows and live SSH/mobile transport were considered but not executed locally.

Review

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Platform-independent renderer logic; no process, shortcut, or path handling changes. Folder-workspace identities use the same existing source admission. Remote/mobile peers receive the existing document version format, so mixed-version compatibility is retained. No new transport fields, persistence, or security boundary.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • Full build and cross-platform validation are covered by CI; local affected checks are recorded above

@OrcaWin
OrcaWin marked this pull request as ready for review October 28, 2026 14:38
@OrcaWin
OrcaWin force-pushed the OrcaWin/coalesce-markdown-draft-hashes-pass2 branch from 595ebf0 to 384ade0 Compare October 28, 2026 14:38
@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7cd98f80-0b0a-4775-9c67-1d88b412ab00
Commits

Reviewing files that changed from the base of the PR and between c58591e and 384ade0.

Files selected for processing: 6
  • src/renderer/src/app-shell/use-runtime-graph-sync-draft-hashing.test.tsx
  • src/renderer/src/runtime/sync-runtime-graph-projection-hot-path.test.ts
  • src/renderer/src/runtime/sync-runtime-graph/editor-draft-hash.ts
  • src/renderer/src/runtime/sync-runtime-graph/sync-key.ts
  • src/renderer/src/runtime/sync-runtime-graph/sync-projections.ts
  • src/renderer/src/runtime/sync-runtime-graph/types.ts
Files with no reviewable changes: 1
  • src/renderer/src/runtime/sync-runtime-graph/editor-draft-hash.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

Walkthrough

Draft projections now return maps of publishable source file IDs to draft contents. The code memoizes source IDs by openFiles identity and hashes draft version stamps when a mobile snapshot is built. Sync-key comparison checks map contents. Tests cover deferred hashing and publication, session readiness, in-flight publication, unmount cleanup, and Markdown draft eligibility.

Priority: Low

Merge Risk: Minimal · up to 384ad

No merge-blocking issue was identified in the deferred draft hashing change.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: coalescing Markdown draft version hashing with publication.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description follows the required structure and clearly explains the purpose, implementation, rationale, testing, visual proof, platform considerations, and checklist status. It identi…
Full details: Description check

Explanation

The pull request description follows the required structure and clearly explains the purpose, implementation, rationale, testing, visual proof, platform considerations, and checklist status. It identifies the work as a maintainer follow-up to merged #34775 and records that manual and cross-platform testing were not performed locally.

Full details: Docstring Coverage

Explanation

Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 5 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@OrcaWin
OrcaWin marked this pull request as draft October 28, 2026 14:48
@OrcaWin
OrcaWin marked this pull request as ready for review October 28, 2026 14:48
@OrcaWin
OrcaWin merged commit 4d8071a into main Oct 28, 2026
93 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.

1 participant