Repository navigation
Stop the stocked-floor re-seed test assuming a fourth room - #399
Merged
Merged
Conversation
"re-seeding a laid-out floor leaves its supplies and its safe room" put its safe room and a draught in rooms.fourth. Location::Interior.lay_out! rolls from the story's and the place's ids and does not read the floor's `rooms: 4`, so some id pairs lay the floor out as two or three rooms and rooms.fourth is nil. Locally the ids are always the same, so it passed every time. In CI an earlier non-transactional test in the same worker moves the ids, which is how it failed once. The safe room and the draughts now go in the first and last non-entry rooms, which every layout has. The assertions are unchanged.
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.
What failed
On #398, CI attempt 1 failed with this error, and the PR did not touch the test:
Cause
The cause is in the test, not in the app. The test lays out "The Stocked Floor" with
Location::Interior.lay_out!and then usesrooms.fourth.lay_out!takes its roll fromRoll.generator(story: story.id, sequence: place.id, kind: Roll::INTERIOR). That is a deliberate choice: the interior's header says "KEYED ON THE PLACE'S ID". The Ruby layout also does not read the floor'srooms: 4; it rolls storeys and rooms per storey (ROOMS_PER_STOREY, at least 2). So the room count depends on which ids the rows get:use_transactional_tests = false) moves the sequence. The floor then gets a different place id.rooms.fourthis nil.Reproduction: before and after
A throwaway subclass of
LoaderTest(not committed) set thelocationsrow ofsqlite_sequencetoSHIFTbefore each test. It then ran only this test for shifts 0–39:NoMethodErroras CI.Fix
The test now puts the safe room and the two draughts in the first and last non-entry rooms, which exist in any layout. Before, it used
rooms.secondandrooms.fourth. The entry room is still never stocked, as the world file says. Every assertion is the same as before: the safe room keepssanctuary, each draught keeps its id, room andsupply, the floor's counts are cleared, and the landing's own draught is left alone. A comment on the test explains why it must not assume a room count.This change touches only the test: no app code, model-facing text, world file or engine.
Checks
Run with
OPENROUTER_API_KEYandTYPESAFE_API_KEYunset:bin/rails test: 5507 runs, 0 failures, 0 errors, 0 skipsbundle exec rubocop: no offensesbin/rails zeitwerk:check: all goodbin/brakeman --no-pager: 0 warnings