Skip to content

Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits - #368

Merged
calebl merged 2 commits into
mainfrom
fm/ta-floors-s1
Oct 30, 2026
Merged

calebl merged 2 commits into
mainfrom
fm/ta-floors-s1

Conversation

@calebl

@calebl calebl commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

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_limit and stories.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

  1. Migration db/migrate/20261030120000_add_limits_to_stories.rb adds 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 is 20261029154235, so there is no collision. db/schema.rb moves to 2026_10_30_120000. The schema change was edited by hand, the way earlier pins did it, because a redump reorders every table.
  2. Loader. story.limits.people / .things are taken out of the story document and written to people_limit / things_limit. Both are written in both directions on every load, so dropping limits: and re-seeding restores 12 and 60. validate_limits! refuses a value that is not a positive Integer ("20", 2.5, 0, -1 and true are all tested) and any key other than people and things.
  3. Exporter. story_document emits limits: with whichever limits are set, and omits it when neither is set. There is a round-trip test.
  4. Registries. Character::Registry.story_limit(story) and Item::Registry.story_limit(story) return people_limit || MAX_PER_STORY and things_limit || MAX_PER_STORY. They are the only code that decides which limit applies. world_for_people, world_for_items and both refusal messages read through them. There are tests at the default and at a raised limit.
  5. Doctor. story_over_the_cast_cap and the story_over_item_cap check 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 loads the-salt-assizes.yml with limits: { people: cast - 2 } and asserts the finding fires. A second test does the same for things.
  6. Sweep. It adds the world lib/engine_sweep/worlds/a-crowded-cellar.yml and the script lib/engine_sweep/scripts/a-thirteenth-person-is-born.yml, both from the engine PR's description, plus the golden vendored from 358bd96 and a checks file written with bin/rails engine:checks.
  7. Pin. ext/renderedstep/Cargo.toml and Cargo.lock now point at 44bd3ce. It was first pinned at the PR head 358bd96; the merge adds only the engine's CI and a-crowded-cellar.sql rebuilt from this branch's loader.

Also: the stories rows in test/engine_vectors/plan.json and kept_requests.json gain the two null columns. bin/rails engine:vectors regenerated them; that is the whole of their diff.

One deviation from the engine's world file

The engine's a-crowded-cellar.yml gives the eleven people besides Nell no stats:. EngineSweepTest#test_a_world_of_the_sweep's_own_loads_and_is_healthy requires every sweep world to load with no doctor findings other than no_arc / room_without_a_layout, so it failed on 22 character_without_a_stat_block / character_without_abilities warnings. Here each of the eleven has stats: {level: 3, hit_die: 8, strength: 12, dexterity: 12, will: 12}. The golden is unchanged by it: engine:rust_gates passes the script against the vendored golden with or without the stats, and only the checks file differs (5 warnings instead of 27). The engine rebuilt parity/worlds/a-crowded-cellar.sql from 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 scripts
  • bin/rails engine:vendored: goldens, scripts and engine vector portions byte for byte at 44bd3ce
  • bundle exec rubocop: no offenses; bin/rails zeitwerk:check: all good; bin/brakeman --no-pager: 0 warnings

It adds no post-update step: the migration is the only change existing rows need, and bin/update already runs migrations.

…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.
@calebl calebl changed the title Pin renderedstep/engine#90's head (358bd96): let a story set its own people and thing limits Pin renderedstep/engine#90's merge commit (44bd3ce): let a story set its own people and thing limits Oct 30, 2026
@calebl
calebl merged commit 3d357bd into main Oct 30, 2026
4 checks passed
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