fix(gate): publish signal markers atomically - #499
Merged
Conversation
The grandchild announced its PID with a plain write, which creates the marker before it writes the content. The spawn-window wrapper gates on marker.exists(), so it raised the forwarded signal while the file was still empty, and the reader parsed an empty string. Stage each marker beside its target and os.replace it into place, so the marker appears only once complete and an existence check means what it claims. Both readers additionally treat an unparseable marker as not-ready rather than fatal. Refs: spx/15-validation.enabler/65-gate.enabler
The four signal-harness entry points hold every predicate for the node's level-2 scenarios while each linked test is a bare delegating call, so the harness rather than the executed test decides pass and fail. Restructuring the seam rewrites four entry points and the linked test file in code that drives real subprocess signal delivery, so it belongs on its own reviewed diff rather than bundled into the marker publication fix beside it. Refs: spx/15-validation.enabler/65-gate.enabler
|
|
Reviewed the atomic marker-publication fix in Cross-checks performed:
No findings. |
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
Background
The level-2 gate scenarios announce a grandchild PID and a delivered-signal value through filesystem markers. Both were written with
Path.write_text, which creates the file before writing its content, so the marker exists while still empty.Three sites treated existence as completeness. The spawn-window wrapper gates on
marker.exists()and therefore raised the forwarded signal while the PID marker was still empty;_read_grandchild_pidthen parsed an empty string and raisedValueErrorout of a retry loop guarding onlyFileNotFoundError. The delivered-signal reader carried the same guard against the same non-atomic write.Root cause
marker.exists()becomes true at file creation, not at write completion. Under load that window widens, which is whytest_signal_during_production_spawn_reaches_child_groupfailed inside a full 992-test run while passing in isolation.Changes
outcomeeng_testing/harnesses/gate_signal.py: stage each marker beside its target andos.replaceit into place, so publication is atomic and the existing existence gate means what it claims. Both readers additionally treat an unparseable marker as not-ready rather than fatal.spx/15-validation.enabler/65-gate.enabler/ISSUES.md: record that the harness holds every predicate for the level-2 scenarios while each linked test is a bare delegating call, inverting the seam the test-infrastructure decision requires.Test plan
just check-fullpasses on the head this PR opens with (pytest 544s, zero failures)spx/15-validation.enabler/65-gate.enabler/tests/test_gate.scenario.l2.pypasses across repeated runsValidation
/reload-pluginsconfirms the change loads in a running sessionRefs
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.