Automerge backed Markdown editor for the Atmosphere
reams docs verification next-bounded-performance.md
4.2 kB
Markdown
at main

Next Bounded Performance Slice #

This slice broadens the shared incremental proof used by the production DocumentManager and CodeMirror line-attachment extension. It is not a general incremental Markdown parser. A failed proof always uses the existing full index/attachment path.

Incremental Coverage #

  • One insertion, deletion, or replacement with no newline or carriage return.
  • Single and multi-character text, including Unicode and surrogate-pair text.
  • IME-style replacement ranges that remain on one physical line.
  • Spaces and ordinary punctuation in proven paragraph, list-item, and ATX heading body content.
  • Edits strictly after the block prefix and, for ATX headings, away from the closing hash suffix.
  • Existing node geometry is translated with UTF-16 offsets; native identities and parent relationships are retained.

Explicit Fallback Coverage #

  • Any newline, CRLF boundary, or multi-line transaction.
  • Setext headings, fenced code, blockquotes, frontmatter, and other unsupported Markdown block kinds.
  • Block-prefix edits, including list promotion such as 1x item to 1. item.
  • ATX prefix and closing-suffix edits.
  • Edits touching code spans, comments, links, wikilinks, HTML delimiters, emphasis delimiters, or Type tags.
  • Surrogate-pair-splitting ranges and invalid ranges.
  • Multiple disjoint changes or stale/unavailable node projections.
  • Any edit on a syntax-bearing line, reference definition, table row, or a line coupled to a structural previous line is rejected unless the narrow plain-word proof remains intact.

The inventory is intentionally bounded to the proof contract above. A fast-check differential test generates small Markdown token grammars and uses the independent Lezer structure collector to verify every accepted edit's block topology and mapped geometry. Other Markdown constructs remain covered by the established full fallback and the existing structural test matrices; this slice does not claim complete support for every stateful Markdown edit.

Verification #

The manager tests count A.spans() calls for eligible and fallback cases and compare eligible cached nodes against an independent native buildNodeIndex. The CodeMirror tests spy on the Markdown parser and exercise the same matrix. The existing production harness was used for serialized ten-input diagnostics; no new benchmark framework was added. Baseline is checkpoint f9004882, not main. One warmup and one context were used per lane.

Target Baseline median Candidate median Baseline p95 Candidate p95
Heading, 10 KB 3083.0 ms 36.0 ms 3121.5 ms 51.9 ms
Paragraph, 10 KB 35.1 ms 35.0 ms 54.0 ms 61.7 ms
List item, list-heavy 100 KB 64.7 ms 43.5 ms 170.3 ms 143.2 ms

All ten inputs in each candidate and baseline lane passed exact-text, persistence, and native-index checks. Paragraph median is effectively unchanged; its higher p95 is not evidence of an improvement. All three p95 values still exceed the fixed 50 ms budget. These are diagnostics, not final Gate 4 evidence. The harness still records and excludes a resource 404 from its availability check, which remains a final-gate review item.

Raw reports are /tmp/opencode/expanded-lanes-heading.json, /tmp/opencode/expanded-lanes-paragraph.json, and /tmp/opencode/expanded-lanes-list.json.

Correctness verification on the expanded implementation:

  • Full npm test: 10,064 passed, three skipped, no type errors.
  • Original structural browser matrix: 18/18 passed.
  • Additional Gate 1 structural browser matrix: 16/16 passed.
  • Differential incremental-proof test: 2,000 generated cases against Lezer.
  • Stateful fast-check: all four seeds passed, 100 runs per seed.
  • Real Bombadil: desktop and mobile campaigns passed, 206 accepted mutations each; wrapper suite completed with two tests passing in 602.88 seconds.
  • Final adversarial review: no critical/high issues found in the edit proof.
  • Typecheck and git diff --check: passed.

Changes remain uncommitted. Broader edit coverage remains an explicit follow-up; neither these tests nor the fallback inventory imply exhaustive Markdown coverage.