Skip to content

test(divergence): flip load-toplevel-echo to a hard agreement (#40)#16

Merged
pyrex41 merged 2 commits into
mainfrom
fix/fasl-load-echo-agreement
Jul 21, 2026
Merged

test(divergence): flip load-toplevel-echo to a hard agreement (#40)#16
pyrex41 merged 2 commits into
mainfrom
fix/fasl-load-echo-agreement

Conversation

@pyrex41

@pyrex41 pyrex41 commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Companion to pyrex41/shen-lua#41 (fixes pyrex41/shen-lua#40).

What

shen-lua's warm-fasl (load) echo divergence is fixed: a warm cache hit now re-emits each top-level form's value, so (load FILE) stdout no longer depends on cache state and agrees with shen-rust / shen-go on both cold and warm caches.

  • Flip the case to a hard agreement. Drop known_divergence: shen-lua-fasl-load-echo from load-toplevel-echo, so a disagreement is now a real FAIL rather than a documented DIVERGE — the same lifecycle hush-file-write went through. Doc updated to RESOLVED with the PR ref.
  • Complete the run-time banner strip in normalize(). The kernel banner is (cn "\nrun time: " ...); its leading newline leaves a blank line ahead of the text line. We stripped only the text, leaving the blank as residue — which diverged against a port that omits the whole banner (shen-lua on a warm hit re-emits the value echo but not the cosmetic banner). Now the blank preceding a stripped run time: line is dropped too, so the entire cosmetic banner normalizes away symmetrically across ports. (Harmless for ports that emit the banner — the strip is symmetric.)
  • README: refresh the divergence status (load-toplevel-echo now resolved; the list is all hard agreements) + a light intro trim.

The first commit (test(divergence): add load-toplevel-echo cross-port case) is the tracking case; it was authored on a sibling branch and is cherry-picked here so this PR is self-contained against main.

Verification

Full corpus 31 pass / 0 diverge / 0 FAIL across shen-rust, shen-go, shen-lua — on both a warm and a cold shen-lua fasl cache:

load-toplevel-echo       PASS      PASS      PASS      PASS
hush-file-write          PASS      PASS      PASS      PASS
SUMMARY: 31 pass, 0 diverge (known), 0 FAIL  across 3 impls

🤖 Generated with Claude Code

Reuben Brooks and others added 2 commits July 21, 2026 18:32
…n-lua#40)

Bifrost surfaced a real divergence found while running a Shen spec across
shen-rust/shen-go/shen-lua: the canonical kernel load (klambda/load.kl
shen.eval-and-print) prints each toplevel form's value before returning
`loaded`. shen-rust and shen-go do; shen-lua does on a cold fasl cache /
SHEN_FASL=off but DROPS the echo on a warm fasl-cache hit (documented degrade,
boot.lua ~796). So (load file) stdout is cache-state dependent -- a cross-port
divergence and an intra-port nondeterminism.

- programs/load-echo-probe.shen: minimal probe ("PROBE" / (+ 40 2) / (define p))
- cases/divergences.json: load-toplevel-echo, mode eval, expect agreement +
  known_divergence shen-lua-fasl-load-echo (reports DIVERGE, not FAIL, until it
  converges -- then drop the marker for a hard agreement, as hush-file-write did)

Verified: bifrost --only load-toplevel-echo across shen-rust,shen-go,shen-lua
reports KNOWN DIVERGENCE: '"PROBE"\n42\n\nloaded' <- shen-go,shen-rust vs
'loaded' <- shen-lua. Filed pyrex41/shen-lua#40 with root cause + fix options.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
shen-lua's warm-fasl `(load)` echo divergence is fixed (pyrex41/shen-lua#40,
PR #41): a warm cache hit now re-emits each top-level form's value, so `(load
FILE)` stdout no longer depends on cache state and agrees with shen-rust/
shen-go cold and warm. Drop the `known_divergence` marker so the case is now a
HARD agreement (a real FAIL if any port regresses), mirroring the lifecycle
hush-file-write went through. Doc updated to RESOLVED with the PR ref.

Also complete the run-time banner strip in normalize(): the kernel banner is
`(cn "\nrun time: " ...)`, whose leading newline leaves a BLANK line ahead of
the text line. We stripped only the text, so the residual blank diverged
against a port that omits the whole banner (shen-lua on a warm hit re-emits the
value echo but not the cosmetic banner). Drop that blank too, so the entire
cosmetic banner is normalized away symmetrically across ports.

README: refresh the divergence status (load-toplevel-echo now resolved; the
list is all hard agreements) and a light intro trim.

Verified: full corpus 31 pass / 0 diverge / 0 FAIL across shen-rust, shen-go,
shen-lua, on both warm and cold shen-lua fasl caches.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pyrex41
pyrex41 merged commit 51d24d8 into main Jul 21, 2026
20 checks passed
@pyrex41
pyrex41 deleted the fix/fasl-load-echo-agreement branch July 21, 2026 23:39
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.

load: warm FASL-cache hit drops canonical per-form value echo (cross-port divergence + nondeterminism)

1 participant