Skip to content

Pin the event roll in the foundering-voyage test (flake) - #201

Merged
dmccoystephenson merged 1 commit into
mainfrom
fix/founder-test-flake
Sep 21, 2026
Merged

dmccoystephenson merged 1 commit into
mainfrom
fix/founder-test-flake

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

test_a_voyage_that_founders_ends_early patched random.randint and random.random in adventures but not rollEvent, which draws the leg's event with random.choice. A run that drew only harmless events (driftwood, calm, good grounds) never took damage and never foundered — red about one run in forty, including on main at b68b09a (run 35554330178), which is currently blocking the gateway's watched-submodule bump of FishE. The test now pins every leg to the leak event, whose first choice always damages.

Closes #200

Test plan

  • The test run thirty times consecutively: 30 passed
  • ./test.sh → 910 passed
  • CI

drafted by Claude on behalf of Daniel Stephenson

🤖 Generated with Claude Code

https://claude.ai/code/session_01KaGDnS44p4wsoDADXhyh9M

The test patched randint and random but not rollEvent's random.choice, so
a run that drew only harmless events never foundered - red about one run
in forty, including on main at b68b09a. Every leg now presents the leak,
whose first choice always damages. Thirty consecutive runs green.

Closes #200

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KaGDnS44p4wsoDADXhyh9M
@dmccoystephenson
dmccoystephenson merged commit a9fba27 into main Sep 21, 2026
1 check passed
@dmccoystephenson
dmccoystephenson deleted the fix/founder-test-flake branch September 21, 2026 03:09
dmccoystephenson added a commit that referenced this pull request Sep 22, 2026
#201 patched rollEvent on src.business.adventures, but docks imports
adventures as business.adventures - pytest.ini puts both . and src on
the path, so those are two module objects and the patch never reached
the call site. The flake it meant to fix survived it: main went red
again on the very next run (35556530705).

The roll is now pinned with patch.object on docks.adventures, and the
day assertion is exact (she founders on leg one), so a roll that isn't
pinned fails five runs in seven instead of one in forty. Forcing the
real roll to driftwood every leg fails on main's version of the test
and passes here; 200 consecutive plain runs, 0 failures.

Co-authored-by: Claude Opus 5 (1M context) <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.

Flaky test: test_a_voyage_that_founders_ends_early fails about one run in forty

1 participant