Repository navigation
Let a story set its own people and thing limits - #90
Merged
Merged
Conversation
A story may name how many people (stories.people_limit) and how many distinctly named things (stories.things_limit) it holds. Where it names none, the limits are today's 12 and 60, so every stored story plays and replays exactly as before. The slot draw (cast::slots, through the new Room::story_limit), the room writer's people and item allowances, and the admission of a written person or thing all read the story's own limit (realization::people_limit / things_limit) instead of the constants. Migration 20261030120000 adds both columns to stories (integer, nullable, no default). Every world dump carries it, applied through sqlite as Rails' SQLite adapter issues it (ALTER TABLE "stories" ADD "people_limit" integer, then things_limit). SCHEMA_VERSION does not move and shape.txt does not gain the columns: store::OPTIONAL_COLUMNS leaves them out of the shape, so a database from before the migration (the game at its current pin) still opens and reads both as null, while either column declared any other way is still a difference. New world a-crowded-cellar (written by the game's loader at f6458b9, then the migration and people_limit = 20): Nell and eleven others in a coaching inn, twelve people in all, and a stub cellar whose word is `a crowd`. New script a-thirteenth-person-is-born, in PASSING with goldens and records: the room writer is asked for exactly three people and all three are born, the thirteenth to fifteenth of the story. Every other golden and records file is unchanged; vectors/cast.json is unchanged at the default.
…r ccc92ed The game's pin PR gives the inn's eleven people stats, so the world loads healthy. The dump is now the one its loader writes, with the limits migration and people_limit 20 its own. No golden or records file moves.
…redstep/server ccc92ed)
calebl
added a commit
to renderedstep/server
that referenced
this pull request
Oct 30, 2026
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.
calebl
added a commit
to renderedstep/server
that referenced
this pull request
Oct 30, 2026
Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits
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, engine half: world limits for people and things. A story may name its own
stories.people_limitandstories.things_limit; where it names none, the limits are today's 12 and 60, so every stored story plays and replays exactly as before.What changed
realization::people_limit(story)/things_limit(story)read the nullable columns, withcast::MAX_PER_STORY(12) andrealization::ITEMS_PER_STORY(60) as the fallback. Every place that used to read the constants now reads them:cast::slots, through a newcast::Room::story_limit(src/turn/told/realize.rspasses the story's limit);realization.rs,items_instructions) andrealization::room_for_people;realize.rs, formerly:828and:997).stories.people_limit integerandstories.things_limit integer(nullable, no default). Every world dump inparity/worlds/carries it, applied through sqlite exactly as Rails' SQLite adapter issues it (ALTER TABLE "stories" ADD "people_limit" integer, thenthings_limit), plus itsschema_migrationsrow. A plain re-dump of each world was byte-identical before the migration was applied.SCHEMA_VERSIONdoes not move andshape.txtdoes not gain the columns. Insteadstore::OPTIONAL_COLUMNSnames the two exact facts (column stories.people_limit integer pk=0, same for things), andstore::shapeleaves them out. So a database with or without them opens, and one without reads both as null, which means the ordinary limits. A column declared any other way (for exampleNOT NULL DEFAULT 12) is still a difference and is refused.SERVER_COMMITnow points at the server pin PR's head, Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits server#368 (ccc92ed), which carries the migration. So CI playsa-thirteenth-person-is-bornthrough the real server half.a-crowded-cellar(story A Crowded Cellar): Nell and eleven others in a coaching inn, twelve people in all, and a stubCellarwithpopulation: a crowd,danger: safe. The dump is what the game's own loader writes at Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits server#368's headccc92ed, with the migration andlimits: { people: 20 }. There the inn's eleven people also have stats; no golden moves for them. New scripta-thirteenth-person-is-born, inPASSINGwith a golden and a records file: walking into the cellar, the writer is asked forEXACTLY 3 people, and all three are born (the 13th–15th people of the story).vectors/cast.jsonis unchanged at the default.Tests
cast::tests: the slot draw at the default (11 → 1 slot, 12 → none) and at a raised limit (12 of 20 → the crowd's full 3, with the same dice as an empty story; 19 of 20 → 1; 20 of 20 → none).realization::tests:room_for_peoplewith twelve people:(3, 0)with no limit of its own,(3, 8)at 20.tests/engine.rs, walking into the crowded cellar with a scripted writer that names three people and two things:EXACTLY 3); 13: 13 people (EXACTLY 1);AT MOST 3); at 1: one admitted (AT MOST 1).people_limitdeclaredNOT NULL DEFAULT 12is refused as a difference.a_database_at_an_older_schema_is_refusednow deletes every version fromSCHEMA_VERSIONon, since the worlds carry a later one.Local runs:
cargo fmt --check,cargo clippy --workspace --all-targets --locked -- -D warnings,cargo test --workspaceandparity --check parity(100 of 104 agree; the other four are runner-only, as before) all pass. I ran the CI runner job locally against the game at its pin (f6458b9, extension built from this checkout):parity/runner.sh103 of 104 agree, witha-thirteenth-person-is-born"not in the checkout yet", andengine:rust_gatesPASSED for 103 scripts.What the server pin PR must change
db/migrate/20261030120000_add_limits_to_stories.rb, with this exact version so the dumps here stay byte-true:db/schema.rbmoves to2026_10_30_120000.lib/world_seed/loader.rb). Todayload_story!passesdocument["story"]whole toassign_attributes, so alimits:key would raise. Takelimitsout of the story document and writepeople_limit/things_limitfromlimits.people/limits.things. Write both in both directions on every load: an absent key writes nil, so deletinglimits:and re-seeding restores 12 and 60. Invalidate!, refuse a value that is not a positive Integer ("20",2.5,0,-1,trueare all refused) and any key underlimitsother thanpeopleandthings. Loader tests: seeds withlimits, refuses a non-integer, and an absent key is nil.lib/world_seed/exporter.rb,story_document). Emit"limits" => { "people" => …, "things" => … }.compact, and omit the key when both are nil, like the other omitted-when-default keys. Round-trip test.Character::Registry(#world_for_people,registry.rb:321), usestory.people_limit || MAX_PER_STORY. InItem::Registry(registry.rb:136), usestory.things_limit || MAX_PER_STORY. Registry tests at the default and at a raised limit.app/models/story/doctor.rb).story_over_the_cast_cap(:887) and thestory_over_item_capcheck (:1123) compare against the story's own limit (people_limit || MAX_PER_STORY,things_limit || MAX_PER_STORY), and their messages name the story's limit rather than the constant.story_over_the_cast_capis the plan's "seeded cast over its limit" note. Make it fire when the world file's own cast is over the story's limit (for examplelimits: { people: 5 }with seven people in the file), and add a doctor test for it. Rooms the engine writes in that world are born with nobody.lib/engine_sweep/worlds/a-crowded-cellar.ymland the scriptlib/engine_sweep/scripts/a-thirteenth-person-is-born.yml(with comments andwhy:; both are in this PR's description below). Then vendor the goldens, the script andtest/engine_parity/a-thirteenth-person-is-born.*from this commit. The world'sstory:carrieslimits: { people: 20 }.SCHEMA_VERSIONto 20261030120000 and put the two columns intoshape.txtin place ofOPTIONAL_COLUMNS.Out of scope here, as the brief says: per-floor keys, a population or density lever, any other stage, and any prompt change. No model was called.
lib/engine_sweep/worlds/a-crowded-cellar.yml
lib/engine_sweep/scripts/a-thirteenth-person-is-born.yml