Skip to content

Emit-determinism floor gate: raw 'gunbc compile dsl --target rust' corpus x2 diff=0 — the durable wall regen --verify structurally CANNOT be (rustfmt-masks it + both .rs/.dag are no-sort). Host-side effectful batch-2 gate (spawn compiler twice + diff trees, NOT a pure test fn; structure it like the - #5922

Merged
briansrls merged 8 commits into
mainfrom
session/smart-newt-232
Jun 29, 2026

Conversation

@briansrls

@briansrls briansrls commented Jun 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds EmitDeterminismGate as a batch-2 CI floor gate: runs gunbc compile --source-root dsl --dependency-pool-index primary-precedence --target rust twice on the dsl corpus, writes each output to a mktemp -d tree, and asserts diff -r exits 0. Any nondeterminism in the emitter — variant-owner disambiguation order, map-key sort order, import-set ordering — makes the two trees diverge and the gate exits 1.

Corpus scope: dsl only. witness_layer_roots ([dsl, src/v2]) is the witness-discovery roster, not a whole-tree emit target. src/v2 contains intentionally-invalid negative-test fixtures (e.g. bogus_scheme/plant.dag) that fail compilation by design; including them would make the gate permanently RED. The dsl corpus is the correct emit-determinism target: it is not rustfmt-normalized, so raw ordering churn is visible, and src/v2's emit determinism is already covered by the regen_stage0 --verify seed path.

This is the durable wall that regen --verify structurally cannot be: regen_stage0 --verify byte-compares the committed seed against a single-pass regen, but rustfmt normalises whitespace/order in the committed .rs files, and both .rs and .dag outputs are produced by map-iteration that is not guaranteed sorted. Comparing two fresh runs from the same binary eliminates those masking effects and catches true non-determinism by construction.

The gate is wired identically to RegenVerifyGate: gate_runnable_profile classifies it heavy_whole_tree_resolve=true, spawns_host_compiler=true, memory=per_shard+host_compiler. The shell transport is modelled through the extdeps.languages.bash.program bash AST and rendered via serialize_bash — not a hand-written string. Carries Scaffold { dissolves_to: RealizationDispatch, bind: serialize_bash } disposition per §6.

Test plan

A — GREEN: current main, dsl corpus × 2, diff = 0

$ ROOT=/home/briansrls/.worktrees/smart-newt-232
$ GUNBC=$ROOT/target/release/gunbc   # built from d60dc964b6 (this branch head)
$ OUT1=$(mktemp -d) && OUT2=$(mktemp -d)
$ $GUNBC compile --source-root dsl \
    --dependency-pool-index primary-precedence --output-dir "$OUT1" --target rust
resolved 624 sources (transitive import closure)
compiled: 631 files emitted, 0 diagnostics
$ $GUNBC compile --source-root dsl \
    --dependency-pool-index primary-precedence --output-dir "$OUT2" --target rust
resolved 624 sources (transitive import closure)
compiled: 631 files emitted, 0 diagnostics
$ diff -r "$OUT1" "$OUT2" && echo "DIFF=0 GREEN"
DIFF=0 GREEN

B — RED: pre-#5913 binary (fierce-badger-409 @ 8e47a4d), dsl corpus × 2, diff ≠ 0

$ GUNBC_PRE=/home/briansrls/.worktrees/fierce-badger-409/target/release/gunbc
$ OUT1=$(mktemp -d) && OUT2=$(mktemp -d)
$ $GUNBC_PRE compile --source-root dsl \
    --dependency-pool-index primary-precedence --output-dir "$OUT1" --target rust
compiled: 631 files emitted, 0 diagnostics
$ $GUNBC_PRE compile --source-root dsl \
    --dependency-pool-index primary-precedence --output-dir "$OUT2" --target rust
compiled: 631 files emitted, 0 diagnostics
$ diff -r "$OUT1" "$OUT2"
diff -r .../src/extdeps_cache_buildbuddy.rs .../src/extdeps_cache_buildbuddy.rs
58c58
<   ) -> Rc<(... AuthScope, ...)> {
---
>   ) -> Rc<(... Rc<AuthScheme>, ...)> {
# ... (exit code 1 → set -e aborts → result.success=false → gate RED)

The gate catches the variant-owner disambiguation nondeterminism that #5913 fixed: AuthScope vs Rc<AuthScheme> flips between runs with the pre-fix binary.

Brian Searls and others added 2 commits June 28, 2026 21:57
Add EmitDeterminismGate as a batch-2 CI floor gate. Runs
'gunbc compile --target rust' twice on the full corpus and
diffs the output trees — any non-determinism in the emitter
exits 1. Marked gate_is_heavy_resolve=true (full resolve
per run); does not invoke rustc, so gate_spawns_host_compiler=false.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gunbai-bot
gunbai-bot Bot marked this pull request as ready for review June 28, 2026 21:59
Brian Searls and others added 6 commits June 28, 2026 22:09
Spawns gunbc compile twice; must serialize against other
corpus-touching work. false was a scheduling lie (§5).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
emit_determinism_transport.dag imports extdeps.languages.bash.program
to build its ShellProgram. All dsl/tools/*_transport.dag files that
do this are on the roster; this one was missing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@briansrls
briansrls merged commit af8f72d into main Jun 29, 2026
2 checks passed
@briansrls
briansrls deleted the session/smart-newt-232 branch June 29, 2026 01:47
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