Skip to content

Draw only valid node prose in the G5a A4 property test - #1160

Merged
MaxGhenis merged 1 commit into
mainfrom
fix/transport-a4-blank-prose
Oct 9, 2026
Merged

MaxGhenis merged 1 commit into
mainfrom
fix/transport-a4-blank-prose

Conversation

@MaxGhenis

Copy link
Copy Markdown
Contributor

Fixes an intermittent engine-free failure that #1159 (G5a) brought to main.

test_a4_description_and_citation_change_no_key (packages/microcosm-build/tests/engine_free/shared/test_transport_population_kernels.py) drew its prose from st.text(alphabet="abcdefghijklmnopqrstuvwxyz .", max_size=35). That strategy can produce a whitespace-only string such as " ", and graph/decl.py's _description correctly refuses it: a description "must be empty or contain non-whitespace text". So the test failed whenever Hypothesis drew one. Two of six local runs of the file at main failed this way, each with the falsifying case prose=' '. The engine-free job runs this file on every microcosm PR.

The fix maps the strategy through str.strip. Its output is either empty or contains a non-whitespace character, which is exactly what decl.py accepts. The property under test is unchanged: editing a node's description or citation moves no key and no artifact byte.

Invariant. Every generated prose value is a valid Node.description. This holds by construction, because str.strip() never returns a non-empty whitespace-only string.

Tests. The A4 test passed 8 of 8 runs, test_transport_population_kernels.py passed 27, and ruff check and format pass.

The NZ hub's G6 PR fixes the same latent pattern in its new composed-graph test.

🤖 Generated with Claude Code

test_a4_description_and_citation_change_no_key drew prose from
st.text(alphabet="a…z .", max_size=35), which can produce a
whitespace-only string such as " ". graph/decl.py's _description
rightly refuses that ("must be empty or contain non-whitespace text"),
so the test failed whenever Hypothesis drew it: 2 of 6 local runs of the
file at main, each with the falsifying case prose=' '. That makes the
engine-free job flaky for every microcosm PR.

Map the strategy through str.strip: the result is empty or contains a
non-whitespace character, which is exactly what decl.py accepts, and the
property (editing description/citation moves no key and no artifact
byte) is unchanged.

tests: the A4 test 8/8 runs passed; test_transport_population_kernels.py
27 passed; ruff check and format pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis merged commit d50220d into main Oct 9, 2026
10 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged by the NZ hub (session local_e407a527) at 136c068 with --merge. Gates: gh pr checks exit 0; MERGEABLE; not draft; no CHANGES_REQUESTED review. Reviewed head: 136c068. Independent review: in-session Opus 5.5 reviewer APPROVE_WITH_NITS, Needs Max: no (jobs/flake-pop/review/REPORT.md): every drawn value is a valid Node.description (str.strip never yields a non-empty whitespace-only string; 2000 draws checked); the old strategy fails deterministically on prose=' ' (matches the logged CI-style failures); no other test on main has the flaw. Optional nits (citation has no whitespace rule; strip drops leading/trailing-space coverage) not applied. All 10 checks green, MERGEABLE, no CHANGES_REQUESTED.

@MaxGhenis
MaxGhenis deleted the fix/transport-a4-blank-prose branch October 9, 2026 10:35
MaxGhenis added a commit that referenced this pull request Oct 9, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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