Skip to content

fix(main): guard the seam call sites instead of stubbing the seams - #1346

Merged
DeusData merged 1 commit into
mainfrom
fix/seam-callsites
Jul 29, 2026
Merged

fix(main): guard the seam call sites instead of stubbing the seams#1346
DeusData merged 1 commit into
mainfrom
fix/seam-callsites

Conversation

@DeusData

Copy link
Copy Markdown
Owner

What

cppcheck blocked release run 30498150408 at the lint gate — correctly:

src/main.c:283:  Condition '!main_test_worker_project_lock_marker(mutation)' is always false
src/main.c:2049: Condition '!worker_start_watchdog_test_descendant()' is always false

#1344 compiled the test seams out by leaving stubs that returned true unconditionally, which makes negating them provably constant. Refactored, not suppressed (repo rule): the stubs are deleted and the call sites are guarded, so a release build doesn't contain the call at all — which is what "the seam isn't in the artifact" should have meant to begin with.

The part that needed care

The probe was one term in a five-term || chain, and its position is load-bearing: it must fork after the isolated process group exists (it inherits that group) and before the parent-death watchdog thread starts, because forking a multithreaded process is exactly the bug that ordering avoids.

Hoisting the call out of the chain would compile, pass tests, and silently break that invariant. So the chain is split into three ordered steps — process group → (test builds only) probe → watchdog — sharing one worker_containment_unavailable() failure path so all three still fail identically, using write()/_exit() rather than stdio and atexit handlers because this runs after fork-sensitive setup.

Verification

Checked in both directions, since a guard that's always off is as wrong as one always on:

  • TEST_SEAMS=1 build: probe string present, tests/test_worker_watchdog.sh passes against it.
  • Release build: no seam string (the composition gate's A2 assertion).
  • make -f Makefile.cbm lint-ci passes locally — cppcheck, clang-format, NOLINT check.

Process note

I skipped make lint-ci before the previous push, which is why CI found this rather than me. cppcheck isn't part of the test suite, so a fully green 3-OS ladder (macOS 5166/0/0, Linux 6606/0/4, Windows suites + guards, smoke SMOKE_EXIT=0) says nothing about it. Running it pre-push from here.

cppcheck blocked the release run, correctly:

  src/main.c:283:  Condition '!main_test_worker_project_lock_marker(mutation)' is always false
  src/main.c:2049: Condition '!worker_start_watchdog_test_descendant()' is always false

Compiling the seams out left behind stubs that returned true unconditionally, so
negating them was provably constant. Refactored rather than suppressed (repo
rule): the stubs are deleted and the CALL SITES are guarded, so a release build
does not contain the call at all -- which is what "the seam is not in the
artifact" should have meant in the first place.

The worker path needed care. The probe was one term in a five-term `||` chain,
and its POSITION is load-bearing: it must fork AFTER the isolated process group
exists (it inherits that group) and BEFORE the parent-death watchdog thread
starts, because forking a multithreaded process is the bug that ordering avoids.
Hoisting the call out of the chain would compile, pass tests, and silently break
that invariant. So the chain is split into three ordered steps -- process group,
then (test builds only) the probe, then the watchdog -- sharing one
worker_containment_unavailable() failure path so every step still fails
identically, with write()/_exit() rather than stdio and atexit handlers.

Verified in BOTH directions, since a guard that is always off is as wrong as one
always on: a TEST_SEAMS=1 build still contains the probe and
tests/test_worker_watchdog.sh passes against it, while the release build carries
no seam string. `make -f Makefile.cbm lint-ci` now passes locally -- the step
skipped before the last push, and the reason CI found this instead of me.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
@DeusData
DeusData merged commit f0c65fb into main Jul 29, 2026
11 checks passed
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