Repository navigation
Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits - #368
Merged
Conversation
…people and thing limits Stage 1 of the dungeon plan, server half. A story may name its own stories.people_limit and stories.things_limit; where it names none they are null and the limits are the ordinary 12 and 60, so every stored story plays as before. No checked-in story world turns one on. - Migration 20261030120000 (the engine's version, applied to its parity world dumps byte for byte): two nullable integers, people first. - WorldSeed::Loader reads `story.limits.people` / `.things`, written in both directions on every load, and refuses anything but a whole number above zero and any key other than people and things. The exporter writes `limits:` back, omitted when the story has none. - Character::Registry.story_limit / Item::Registry.story_limit are the one reader of which limit applies; the registries and Story::Doctor's two story-cap checks read through them, and the doctor names the story's own limit when it has one. - Sweep: world a-crowded-cellar (limits: people 20) and script a-thirteenth-person-is-born, with the golden vendored and its checks file written. The eleven people beside Nell are given stat blocks the engine's copy of the world lacks, because a sweep world must load healthy (EngineSweepTest); the golden is unchanged by them. - engine_vectors plan and kept_requests gain the two null columns in their stories rows.
44bd3ce adds to the head pinned before only the engine's CI and parity/worlds/a-crowded-cellar.sql rebuilt from this branch's loader (f0c5a9b), so the world dump now carries the stat blocks this repository's world file gives the cellar's eleven people. No golden, script or vector portion changed: bin/rails engine:vendored passes, engine:rust_gates passes all 104 scripts.
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.
Stage 1 of the dungeon plan, server half: world limits for people and things. This implements items 1–7 of "What the server pin PR must change" in renderedstep/engine#90, pinned to that PR's merge commit
44bd3ce6785813e63ee432051426c3a03ca68fca.A story may name its own
stories.people_limitandstories.things_limit. Where it names none, both are null and the limits are the ordinary 12 and 60 (Character::Registry::MAX_PER_STORY,Item::Registry::MAX_PER_STORY), so every stored story plays as before. No checked-in story world sets a limit; only the new sweep world does.What changed
db/migrate/20261030120000_add_limits_to_stories.rbadds two nullable integers with no default, people first. The version is the engine's, not a generated one, because the engine's parity world dumps carry exactly this version row. It was checked against a freshly fetched main: the latest migration there is20261029154235, so there is no collision.db/schema.rbmoves to2026_10_30_120000. The schema change was edited by hand, the way earlier pins did it, because a redump reorders every table.story.limits.people/.thingsare taken out of the story document and written topeople_limit/things_limit. Both are written in both directions on every load, so droppinglimits:and re-seeding restores 12 and 60.validate_limits!refuses a value that is not a positive Integer ("20",2.5,0,-1andtrueare all tested) and any key other thanpeopleandthings.story_documentemitslimits:with whichever limits are set, and omits it when neither is set. There is a round-trip test.Character::Registry.story_limit(story)andItem::Registry.story_limit(story)returnpeople_limit || MAX_PER_STORYandthings_limit || MAX_PER_STORY. They are the only code that decides which limit applies.world_for_people,world_for_itemsand both refusal messages read through them. There are tests at the default and at a raised limit.story_over_the_cast_capand thestory_over_item_capcheck compare against the story's own limit. When the story has its own limit, the message names it (its own limits: people) instead of the constant. A doctor test loadsthe-salt-assizes.ymlwithlimits: { people: cast - 2 }and asserts the finding fires. A second test does the same for things.lib/engine_sweep/worlds/a-crowded-cellar.ymland the scriptlib/engine_sweep/scripts/a-thirteenth-person-is-born.yml, both from the engine PR's description, plus the golden vendored from358bd96and a checks file written withbin/rails engine:checks.ext/renderedstep/Cargo.tomlandCargo.locknow point at44bd3ce. It was first pinned at the PR head358bd96; the merge adds only the engine's CI anda-crowded-cellar.sqlrebuilt from this branch's loader.Also: the
storiesrows intest/engine_vectors/plan.jsonandkept_requests.jsongain the two null columns.bin/rails engine:vectorsregenerated them; that is the whole of their diff.One deviation from the engine's world file
The engine's
a-crowded-cellar.ymlgives the eleven people besides Nell nostats:.EngineSweepTest#test_a_world_of_the_sweep's_own_loads_and_is_healthyrequires every sweep world to load with no doctor findings other thanno_arc/room_without_a_layout, so it failed on 22character_without_a_stat_block/character_without_abilitieswarnings. Here each of the eleven hasstats: {level: 3, hit_die: 8, strength: 12, dexterity: 12, will: 12}. The golden is unchanged by it:engine:rust_gatespasses the script against the vendored golden with or without the stats, and only the checks file differs (5 warnings instead of 27). The engine rebuiltparity/worlds/a-crowded-cellar.sqlfrom this branch's loader before merging (f0c5a9b), so its world dump now carries these stats too.Verification
Both provider keys were unset for every command, and no model was called.
bin/rails test: 5405 runs, 0 failures, 0 errors (includes the sweep)bin/rails engine:rust_gates: PASSED, all 104 scriptsbin/rails engine:vendored: goldens, scripts and engine vector portions byte for byte at44bd3cebundle exec rubocop: no offenses;bin/rails zeitwerk:check: all good;bin/brakeman --no-pager: 0 warningsIt adds no post-update step: the migration is the only change existing rows need, and
bin/updatealready runs migrations.