Skip to content

emit-portable: make streamEq self-check opt-in (S6a, #57)#68

Merged
johnsoncodehk merged 1 commit into
masterfrom
portable-validate-s6a
Jul 12, 2026
Merged

emit-portable: make streamEq self-check opt-in (S6a, #57)#68
johnsoncodehk merged 1 commit into
masterfrom
portable-validate-s6a

Conversation

@johnsoncodehk

Copy link
Copy Markdown
Owner

Summary

Slice 6a of #57. The streamEq self-check (full relex + field-by-field comparison after every edit()) was acceptance scaffolding for the windowed-relexing slices (S3–S5b) and cancelled their lexing win. It is now opt-in:

  • TS createDoc(src, { validate? }), Go Doc.SetValidate, Rust Doc::set_validate — default off. With validation off, the post-edit rescan is skipped and the alignment JSON omits the streamEq key ({oldN,newN,prefix,suffix,relexed}); no fabricated streamEq: true.
  • The edit-session runner protocol keeps validation ON, so the gate and all adversarial corpus scripts continue to exercise the checked path unchanged. A new edit-session-fast protocol runs with validation off.
  • The gate now runs every edit scenario in both modes and asserts the five alignment fields, CST bytes, and exit codes are identical — catching flag-plumbing divergence between the paths.
  • The windowed-relex logic itself (windowRelexStep, state restoration, resync) is untouched line-for-line.
  • Perf reference (informational): 30k-char calc doc, 100 single-char edits, TS target — 418 ms validated vs 206 ms fast. Full reparse still dominates; tree reuse is the next milestone.

Validation

  • node test/portable-targets.ts — 34 scenarios × 3 targets × 2 modes, fast ≡ validated everywhere
  • node test/check.ts emit-parity — 5/5; node test/newline-mode.ts — 29/29; npx tsc --noEmit — clean; 5 corpus scripts ALL PARITY (validated path, zero changes)
  • Mutation test: making the fast path keep a stale token stream fails the multi-batch fast≡validated assertions, reverted before commit
  • Independent probe: multi-batch inheritance chains (javascript / templatejs / envspec) × 3 targets — five fields equal, no streamEq key in fast mode, byte-identical stdout and exit codes

Default Doc/createDoc off; edit-session keeps validate on, edit-session-fast skips the full rescan; gate asserts fast ≡ validated five-field align.

Co-authored-by: Cursor <cursoragent@cursor.com>
@johnsoncodehk johnsoncodehk merged commit 9ca4178 into master Jul 12, 2026
3 checks passed
@johnsoncodehk johnsoncodehk deleted the portable-validate-s6a branch July 12, 2026 07:24
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