0265. Harness VC rewrite: natives, syntax port, Rust VC deletion and budget
- Status: Accepted (maintainer, 2026-11-17)
- Date: 2026-11-17
- Plan: M17.16–M17.69 (
PLAN-vc-remoteVP, VR, HP, VS, PT, VF, VD steps) - Review: Making Tenon plugin-first
Context
ADR-0207 accepted
a full VC rewrite in Harness with byte-identical object hashes and
on-disk format (FMT_VERSION 1) and a no-regression
budget against Rust. It left four questions to the remote plan (§7
decisions 1, 2, 4 and 5):
- where the missing native mechanisms live (SHA-256, durable
file operations,
flock,stat, uid); - how the Harness VC gets canonical formatting and item
splitting. Rust
vc/split.rs,vc/merge.rs(header merge and old-fmtreformat) andvc/history.rs(reformat) callcrate::fmt,lexer,parser,outlineandr#gen::is_generated; - what happens to Rust
crates/harness/src/vc/*after cutover; - what "no regressions" means numerically.
M14-frozen files (crates/harness/src/interp*.rs,
interp/, plugins/cli/**,
plugins/agent*) may not change without the
maintainer's explicit OK. ADR-0176 keeps Rust as
the canonical 1.0 compiler. Its consequences describe a bounded
Harness implementation of a compiler phase, compared with the Rust
phase on the same inputs, as the way to evaluate a phase.
Decision
Maintainer decided on 2026-11-17:
- Natives are new FFI trusted-tier plugins.
plugins/sha256provides the digest.plugins/vcfsprovides root-handle durable file operations,stat,flocklocks anduid. Neither includesplugins/cli/nativeheaders, and no frozen file changes. Apps that use them carryffiin their ceiling. - Port the lexer, parser and formatter to
Harness. A new pure-Harness library,
plugins/hsyntax, portslexer.rs,tokens.rs, the AST andast::dump,parser.rsandfmt.rs.plugins/hvcuses it to split, join, merge headers and reformat. Its acceptance oracle is byte-identical output against the Rust formatter over the whole tracked.hncorpus and the pinnedtests/fmt-version.corpus(ADR-0182) digest, on both backends. AST dump parity and diagnostic-code parity are also required. The previously recommendedharness vc sourceRust compiler service is not built.- Scope: lexer, parser and formatter only.
Names, types, IR, the backends and
harness fmtstay Rust. - Relation to ADR-0176: this is the bounded
phase implementation that 0176's consequences anticipate, not a
change of canonical compiler. Rust remains the bootstrap and
canonical 1.0 compiler, and 0176 is not superseded. Rust
fmtstays the formatting authority. Any change to Rust lexer, parser or formatter output must land inhsyntaxin the same PR (the parity suite enforces this), andFMT_VERSIONmoves for both together.
- Scope: lexer, parser and formatter only.
Names, types, IR, the backends and
- Delete Rust VC after cutover.
- During the transition, Rust
harness vcis the shipping local CLI and the live parity oracle. - Before cutover, a fixture-freeze step records golden object hashes, on-disk store fixtures, split/merge results and wire transcripts, all produced by Rust VC. Tests keep an oracle after it is gone.
- Cutover switches
harness vcdispatch to the launched Harness client. - Rust package tooling (
pack,release,registry_render,deps) then stops reading throughcrate::vc. - A final PR deletes
crates/harness/src/vc/*. That PR needs the maintainer's explicit yes at that time. It is a[human]-gated task and is never auto-merged.
- During the transition, Rust
- Speed budget. On every
bench/vc-port/row (C backend, best of 5, byte-identical output checked first), Harness/Rust is at most 1.05× wall time and 1.10× peak RSS, or within the measured run-to-run variation if that is larger.harness interpis held to correctness, not time. After deletion, the frozen Rust numbers and the cutover Harness numbers are the no-regression baseline.
Alternatives considered
- Platform
Fsmethods and SHA-256 inplugins/cliplusinterp_fs.rs: capability-attenuable, but it edits M14-frozen files. harness vc sourcestateless Rust compiler service: the smallest change, but it keeps a Rust process on every commit and merge path, and Harness VC could not split or format on its own.- Self-hosting the whole compiler: out of scope. ADR-0176 stands.
- Keep Rust VC as a test-only oracle through 1.0: two VC implementations to maintain. Frozen fixtures give a durable oracle without that cost.
- Keep a thin Rust hvc read adapter for package tooling: kept as the fallback if the directory hand-off in the remote plan (PT1, PT2) misses the speed budget. It needs the maintainer's yes at the deletion step.
- Exact parity within run-to-run variation only: too strict to measure reliably across machines.
Consequences
- New plan tasks M17.16–M17.69 in PLAN.md. The HP steps
(M17.37–M17.47) precede every VS step that needs source splitting,
and
harness vc source(old VS1) is gone. - Lexer, parser and formatter changes cost twice as much: each
lands in Rust and
hsyntaxtogether, guarded by the corpus parity test. New syntax thathsyntaxcannot parse would split asrawin Harness but asmodin Rust, which changes object IDs. The parity suite blocks that. affected(VP17) still needs the compiler's dependency graph and canonical signature forms. It uses existing public Rust compiler commands as pinned child processes. That is a compiler query, not a VC service.- Package tooling reads hvc through Harness-exported directories (PT1, PT2). If that fails the budget, the thin read adapter is the fallback, and it needs the maintainer's yes.
- Rust
vc/fsck.rsandgc.rslearn the remote roots in VR3 and are deleted with the rest at VD1. harness host-storeis retired at VR12, as ADR-0264 anticipated.