Skip to content

Pin renderedstep/engine#100's head (6bf995e): rest an hour in a safe room with no foe in it, and mend eight - #376

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

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

Conversation

@calebl

@calebl calebl commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Stage 8 of the dungeon plan, server half: rest. The engine half is renderedstep/engine#100. This pins its head, 6bf995e. Once it merges, a follow-up commit will re-pin to its merge commit.

A wait is a rest when three things hold: the room is a safe room (locations.sanctuary), nobody in it is a foe, and the player is alive with a stat block. A rest mends 8 hit points (one healing thing's worth), up to the game's maximum, and on the told path its scene spends an hour. A rest is never refused, even when it runs past a floor's countdown; the player then falls with the floor. The notice is engine copy for the player only, and no model is told. A world with no sanctuary plays exactly as before.

No model was called. Every command ran with OPENROUTER_API_KEY and TYPESAFE_API_KEY unset. No prompt or request builder changed, and nothing that builds a request reads the new table.

What changed

This follows the engine PR's section "What the server pin PR must change", item by item.

  1. Migration 20261031180000_create_playthrough_rests.rb. It uses the engine's version and declaration, with the "THE VERSION AND THE DECLARATION ARE THE ENGINE'S" header. db/schema.rb moves to 2026_10_31_180000. I placed the table into the schema by hand, because Rails' dumper would otherwise reorder unrelated columns. The version still follows main's latest (20261031150000, checked against a freshly fetched origin/main).

  2. Playthrough::Rest (playthrough_rests):

    • associations, plus validations for recovered and hp_after (whole numbers from 0) and story_timestamp;
    • #to_s, word for word the engine's Game::rest_to_s. It says 1 hit point in the singular, and reads the maximum at the rest's own time;
    • factory :playthrough_rest, which rolls nothing;
    • model test test/models/playthrough/rest_test.rb.
  3. Associations: has_many :rests on Playthrough (destroy), Location (destroy) and Scene (nullify), each with a reasoning comment like its floors_reached neighbour's.

  4. Log:

    • Playthrough#turn_log preloads rests: [:location, {playthrough: [:character, :floors_reached]}];
    • turns/_turn.html.erb shows this game's rests after its floors, as <p class="notice" id="playthrough_rest_N">.
  5. Protocol: Protocol::V1#entry appends this game's claimed rests to notices, after the floors. openapi.json is unchanged: notices is an array of strings. One test, test/controllers/playthrough_toll_notices_test.rb, covers both the log entry and the protocol entry, including that another game's rest on the same scene is left out.

  6. Playthrough::SqlitePackage::PLAYTHROUGH_TABLES adds playthrough_rests. The package test checks that the row travels.

  7. Vendored at the pin:

    • script resting-in-a-safe-room.yml, with its why: notes, and world a-place-to-rest.yml, both from the engine PR body;
    • golden test/engine_parity/resting-in-a-safe-room.json;
    • checks file resting-in-a-safe-room.checks.json, written by engine:checks.

    The engine's parity/records/ files are not vendored in this repository, as with every earlier stage.

One thing not in the engine's list: Location::OneRoomFold now moves a rest's location_id with the room (REFERENCES), and counts a rest in the place row as history (PLACE_HISTORY, beside tolls). Its schema-walking test fails on any location foreign key the fold does not move.

Gates (all local, both provider keys unset)

  • bin/rails test: 5494 runs, 0 failures, 0 errors, 0 skips (includes rake game:sweep)
  • bundle exec rubocop: no offenses
  • bin/rails zeitwerk:check: all good
  • bin/brakeman --no-pager: 0 security warnings
  • bin/rails engine:vendored: VENDORED at 6bf995e
  • bin/rails engine:rust_gates: PASSED, 114 scripts (goldens, invariants, doctor and audit)
  • bin/rails engine:kept_requests: ok, 45 passed
  • SCRIPT=resting-in-a-safe-room bin/rails engine:parity GOLDENS=/tmp/...: the extension's dump is byte-identical to the vendored golden

For the engine's follow-up

  • Point the engine's SERVER_COMMIT at this branch's head.
  • Rebuild parity/worlds/a-place-to-rest.sql from this branch's loader, with the migration in its schema (item 8 of the engine's list).

No Update::REGISTRY step is needed. bin/update already runs pending migrations, and the new table starts empty.

…room with no foe in it, and mend eight

Stage 8 of the dungeon plan, server half ("Rest"). A `wait` in a safe room
(`locations.sanctuary`) with nobody in it a foe, by a living player with a
stat block, is a rest: it mends one healing thing's worth (8) up to the
game's maximum, and on the told path its scene spends an hour. It is never
refused, even past a floor's countdown; the player then falls with the
floor. The notice is engine copy for the player only; no model is told. A
world with no sanctuary plays as before.

- Migration 20261031180000 CreatePlaythroughRests, the engine's version and
  declaration. schema.rb moves to 2026_10_31_180000.
- Playthrough::Rest (playthrough_rests): validations, and #to_s, word for
  word the engine's Game::rest_to_s, its maximum read at the rest's time.
  Factory :playthrough_rest, rolling nothing.
- Playthrough, Location and Scene gain has_many :rests (destroy, destroy,
  nullify), as their floors_reached neighbours.
- The log: Playthrough#turn_log preloads rests; the turn partial shows this
  game's rests after its floors; Protocol::V1#entry appends them to notices.
- Playthrough::SqlitePackage::PLAYTHROUGH_TABLES adds playthrough_rests.
- Location::OneRoomFold moves a rest's location with the room, and counts a
  rest in the place row as history (its schema-walking test requires the
  move).
- Sweep: world a-place-to-rest, script resting-in-a-safe-room, golden
  vendored and checks file written.
calebl added a commit to renderedstep/engine that referenced this pull request Oct 30, 2026
… cfe509a

The game's pin PR (renderedstep/server#376) carries migration
20261031180000, so the dump is now the one its own loader writes from a
schema load, with playthrough_rests in the schema rather than migrated
on after. The rows are the same; only timestamps, the schema digest and
the order the dump lists them in moved. No golden or records file moves.
@calebl
calebl merged commit d6f05b8 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