You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
build.sh already supports module directories nested to any depth, but nothing pins that
behaviour. The two properties the distributable depends on are untested, so a future change
to build::process_file could break the released binary without any suite going red.
Current behaviour (verified, not assumed)
build::process_file is a depth-first walk of source statements, not a directory walk:
it emits a file's body (shebang stripped via tail -n +2), then recurses into every ^source line, dedupes on the repo-relative path (#923), and the final artifact has all source lines stripped.
Verified on main (7eecc45) with a throwaway three-level module:
Result: all three bodies embedded, in DFS order, 0source lines remaining in the output,
and the depth-3 function present in the single-file binary. So the flat→module migration
(#924, #925, and the rest) needs no build work — but that is currently an undocumented,
untested property.
Why it is worth pinning
Two regressions have already shipped through this exact seam:
Both were build-graph bugs invisible to the normal suite, because the normal suite runs from src/, not from the built artifact.
Proposal
Add regression tests to tests/unit/build_test.sh (which already holds test_module_aggregators_hold_only_source_lines_and_comments), building into a temp dir from
a fixture tree rather than touching real src/:
Arbitrary nesting is embedded. A three-level fixture
(aggregator → mid aggregator → leaf) ends up fully embedded, leaf included.
DFS order is preserved. A file's own body precedes the bodies of the files it sources —
this is the property that makes the "aggregators hold only source lines" rule load-bearing,
and nothing currently asserts it.
Fixtures under tests/**/fixtures/ must not end in *test.sh — the runner would collect
them as test files.
Build into a temp dir ($(bashunit::temp_dir)); never write to bin/ from a test.
tests/unit/build_test.sh sources build.sh to exercise its functions directly — follow
that existing pattern rather than shelling out to a full build where possible, and keep the
test off the fork-budget hot paths.
Acceptance criteria
Tests added to tests/unit/build_test.sh covering the four properties above
Each fails for the right reason when the corresponding behaviour is broken (verify by
temporarily inverting the logic, then reverting)
Summary
build.shalready supports module directories nested to any depth, but nothing pins thatbehaviour. The two properties the distributable depends on are untested, so a future change
to
build::process_filecould break the released binary without any suite going red.Current behaviour (verified, not assumed)
build::process_fileis a depth-first walk ofsourcestatements, not a directory walk:it emits a file's body (shebang stripped via
tail -n +2), then recurses into every^sourceline, dedupes on the repo-relative path (#923), and the final artifact has allsourcelines stripped.Verified on
main(7eecc45) with a throwaway three-level module:Result: all three bodies embedded, in DFS order,
0sourcelines remaining in the output,and the depth-3 function present in the single-file binary. So the flat→module migration
(#924, #925, and the rest) needs no build work — but that is currently an undocumented,
untested property.
Why it is worth pinning
Two regressions have already shipped through this exact seam:
src/watch.shwas missing from the release build entirely.would have collided
src/parallel.shwithsrc/runner/parallel.shthe moment a moduledirectory appeared.
Both were build-graph bugs invisible to the normal suite, because the normal suite runs from
src/, not from the built artifact.Proposal
Add regression tests to
tests/unit/build_test.sh(which already holdstest_module_aggregators_hold_only_source_lines_and_comments), building into a temp dir froma fixture tree rather than touching real
src/:(
aggregator → mid aggregator → leaf) ends up fully embedded, leaf included.this is the property that makes the "aggregators hold only
sourcelines" rule load-bearing,and nothing currently asserts it.
sourcelines survive in the artifact.src/<a>/parallel.shandsrc/<b>/parallel.shboth embed — the exact fix(build): key embed markers on repo-relative paths so src/ can hold module dirs #923 regression, currently only implicitlycovered because
src/parallel.shandsrc/runner/parallel.shhappen to coexist.Constraints
tests/**/fixtures/must not end in*test.sh— the runner would collectthem as test files.
$(bashunit::temp_dir)); never write tobin/from a test.tests/unit/build_test.shsourcesbuild.shto exercise its functions directly — followthat existing pattern rather than shelling out to a full build where possible, and keep the
test off the fork-budget hot paths.
Acceptance criteria
tests/unit/build_test.shcovering the four properties abovetemporarily inverting the logic, then reverting)
./bashunit tests/·./bashunit --parallel tests/·./bashunit --parallel --simple --strict tests/greenmake sa && make lintgreenbash build.sh bin -vstill prints✅ Build verified ✅Do not
build.shbehaviour — this issue only pins what it already doestests/unit/build/;make testglobs one level onlyshfmt -w;make lintis the format gate