Add module governance engine parity test - #117
Merged
Merged
Conversation
Traced skip_main_ (compiler.cpp:89/97/399/1129/1267) and
module_loading_depth_ (interpreter.cpp:975-1151). The guards match:
both engines skip checkNaabFunctionBody() during module import and
still run checkFunctionBehavioralContract(). The count asymmetry
(3 VM sites vs 8 tree-walker sites) is benign — the tree-walker
guards lifecycle events (hooks, summary, scanner) handled elsewhere
in the VM path.
14 assertions across 5 groups:
A. Module placeholder NOT blocked on import (both engines)
B. Same placeholder BLOCKED in main file (both engines, exit 3)
C. must_call contract fires during module load (both engines)
D. Module main{} block NOT executed on import (both engines)
E. Controls: placeholder check is live, not vacuously passing
Every assertion observed failing when inverted (degraded-case check
confirmed for MOD-A1, MOD-B1, MOD-C1, MOD-D1).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
NAAb Governance Report
All governance checks passed! Generated by NAAb Governance Engine v4.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
skip_main_guards match tree-walkermodule_loading_depth_ == 0guards for function-body governance during module loadingWhat was traced
VM (
compiler.cpp):skip_main_at lines 89, 97, 399, 1129, 1267skip_main_!skip_main_→checkNaabFunctionBody()(full),skip_main_→checkFunctionBehavioralContract()(lightweight)Tree-walker (
interpreter.cpp):module_loading_depth_ == 0at lines 975, 982, 995, 1027, 1032, 1037, 1067, 1151module_loading_depth_ == 0→checkNaabFunctionBody(), else →checkFunctionBehavioralContract()Result: The guards match. The 3-vs-8 site count asymmetry is different granularity, not different behavior.
Test groups
must_callfires during module load on both enginesmain{}not executed on importDegraded-case validation (guard removal, not expectation inversion)
Broke the property in the source: replaced both
if (!skip_main_)guards incompiler.cpp(lines 1129, 1267) withif (true), removing the VM's module-loading skip while leaving the tree-walker's intact. Rebuilt and ran the test.engines disagree— VM matches=3 tree-walk matches=0engines disagree— VM matches=0 tree-walk matches=1exit code divergence— VM=3 tree-walk=0engines disagree— VM matches=0 tree-walk matches=2engines disagree— VM matches=1 tree-walk matches=0All 5 broken assertions reported "engines disagree", confirming the test measures parity, not just correctness. Restored
compiler.cpp, rebuilt, confirmed 14/14 pass.Suite results (clean tree, run to completion)
Branch (
claude/module-governance-parity-test): 441 tests, 4 unexpected failuresMaster (
origin/master): 441 tests, 4 unexpected failures (identical set)Pre-existing failures on this platform (Termux/ARM64):
The branch introduces 0 new failures. Line 3308 of the suite log:
test_module_governance_parity.sh: ALL PASSED.Committed diff is exactly 2 files:
🤖 Generated with Claude Code