Skip to content

Send Modern riders stuck an hour in one line another way - #2272

Merged
maniator merged 2 commits into
mainfrom
claude/project-thread-u5g4vi-jam
Nov 15, 2026
Merged

maniator merged 2 commits into
mainfrom
claude/project-thread-u5g4vi-jam

Conversation

@maniator

@maniator maniator commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What & why

In Modern towers, riders stuck an hour in one elevator line now look for another way, and the Bulletin says where the lines are jammed. On the owner's tower the Metro line under the basement express kept hundreds of riders for hours every weekday morning, because the express runs full both ways in the rush.

  • Re-route after an hour. A rider whose wait in one line passes an hour (GIVE_UP) is routed again, once per line, from where they stand (line_count::rethink_long_wait). If the quickest way still starts with this line, they keep their place. Otherwise they walk to the new way up, and their hour counts in the trip's wait. Housekeepers keep to their cars, and riders on the floor they set out from still turn back on their own patience.
  • Measured line waits. The lines the router reads (Crowd::shaft_lines) now hold a line_count::Line per landing: the riders and the longest wait in the line. A boarding costs the longer of the expected wait and that measured one, so a line that barely moves stops drawing new riders.
  • Bulletin warning. Each hour, Modern names the worst landing where someone passed an hour in line, in red: "Riders on floor B2 have waited over an hour for the Express Elevator there. Add cars, or another way up, to clear the line." The warning reads the people themselves, whose waits a save carries, so a reload warns the same.
  • routing::plan returns a route without joining its line, so a rider who weighs another way and stays is counted once.
  • The motion pass refills the last count's map instead of allocating one each pass.
  • The help page "People" gets a Modern paragraph under "When people wait too long".

This was stacked on #2246 (route search speed-up), as the owner chose; #2246 has merged and this is rebased onto main after it.

Closes: n/a (no issue)

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • Classic-canon fix (matches the 1994 original for all towers)
  • Modern-mode feature (opt-in, "what the original couldn't do")
  • New player-facing feature (mode-agnostic)
  • Refactor / internal-only (no player-facing behavior change)
  • Docs / tooling

Game mode impact

  • This change is classic-canon (affects all towers, stays faithful to the 1994 original)
  • This change is modern-only (gated behind Modern mode, does not alter Classic behavior)
  • This change is mode-agnostic (identical in both modes)
  • Any mode-divergent behavior is isolated in the mode rule-set (resolved once at founding), not smeared into the simulation with ad-hoc mode checks

All three parts read routes_by_expected_time(), the Modern router rule. Classic counts no lines, re-routes nobody and warns about nothing; classic_riders_and_housekeepers_keep_their_line and classic_makes_no_line_bulletin pin that.

Quality gates

  • npm run typecheck
  • npm run lint
  • npm test (CI runs it)
  • npm run build (CI runs it)

Engine: cargo fmt --check, cargo clippy --all-targets --features tooling,conformance -D warnings and cargo test --features conformance pass. I regenerated the conformance lock, the fuzz corpus golden, frame-days.json, the card-text record and the compat record.

The rule tests in crowd/line_count_tests.rs:

  • the_router_counts_a_lines_longest_wait
  • the_motion_pass_counts_the_longest_wait_in_each_line
  • an_hour_in_a_stuck_line_sends_a_rider_another_way: the rider walks to the local from the lobby, with their hour counted in the trip.
  • a_rider_keeps_their_place_while_their_line_is_still_the_quickest
  • a_rider_weighs_another_way_once_per_line
  • classic_riders_and_housekeepers_keep_their_line
  • weighing_another_way_and_staying_joins_no_line_twice
  • a_reload_counts_the_same_lines: riders and longest waits match after a save and load.
  • a_line_past_an_hour_makes_the_bulletin_once
  • classic_makes_no_line_bulletin

Versioning

  • Added a .changes note with the right app: and crate: levels, or this PR changes no deployed path
  • Engine change: updated packages/verticopolis-engine/README.md and/or engine-rs/CRATE_README.md, or read both and put readmes: unchanged in the note, or this PR changes no engine source

app: minor (a new Modern behavior and Bulletin line) and crate: patch (the conformance lock moves; no save, layout or interface change). readmes: unchanged.

Complexity

  • Hot paths touched:
    • motion::advance runs every chunk of every step. It calls rethink_long_wait per person: a few compares, and a route search only for a Waiting rider whose wait just passed an hour.
    • LineCount::see per person: one map entry per line, as before, with the wait folded into it.
    • cost_of per boarding link in every Modern search: one map lookup, as before (riders and wait share the entry).
    • warn_long_lines once per game hour: one pass over the people.
  • Before and after: no new per-step scan and no new cache. The only new work that grows with the tower is one route search per rider whose line passes an hour, and none on a tower without hour-long lines. The motion pass now allocates nothing for its line count once the map has grown.
  • Measurements (owner's tower, release build, the save's time through 1 PM the next day, instruction counts from callgrind, which are steady run to run where wall time on this machine is not):
Build Instructions vs main
main 8.16 G
#2246 alone 5.60 G -31%
#2246 + this PR 6.56 G -20%

On that tower this PR adds about 8,400 route searches over the run (one per rider whose line passes an hour). The owner chose to ship it stacked on #2246, so the game stays faster than today.

  • Effect on the jam (same run, the second morning):
Time Riders waiting over an hour, main With this PR
10:30 AM 626 75
11:30 AM 649 115
1:00 PM 327 134

The commuters' mean wait at 1 PM drops from 364 to 267 crowd seconds.

Hot-path record (section 6): this comes with the review.

Screenshots / recordings

features/metro-line-east.png shows a different mix of riders on the Metro platform, since riders who passed an hour in line now look for another way. Rendered in the pinned Playwright image (full Chromium) and checked against main: only that platform's riders differ.

Notes for reviewers

  • Rebased onto main at 5ba9bc0 (after Raise the install budget to 6 MiB #2275, the 6 MiB install budget, which clears the engine-wasm precache check).
  • Once per line. Re-routing at every hour of a wait cost 13% more searches and cleared the line no better, so a rider weighs another way once per line. A new line gets its own hour.
  • Lines kept until the pass ends. A rider weighing another way mid-pass can start the router's step, which reads the last count, so the crowd keeps it until the pass hands over the new one (keep_lines).
  • Save. The saved lines rows are unchanged ([shaft, floor, riders]). A load counts the longest waits again from the saved people (restore_oldest), so no save format moves.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ms7trYcRHkvnh6N2YZqqjw

@vercel

vercel Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
verticopolis Ready Ready Preview Nov 15, 2026 5:55am UTC

Request Review

Copy link
Copy Markdown
Owner Author

The milestone check fails for a reason outside this diff: .github/workflows/pr-milestone.yml on main still has CURRENT_RELEASE: "4.0.0", and that milestone closed when 4.0.0 shipped (#2270). The job refuses a closed milestone. It will pass once CURRENT_RELEASE names the open 4.x milestone, or once this PR has a milestone set (the job then has nothing to do). #2246 already has 4.x.


Generated by Claude Code

@maniator maniator added this to the 4.x milestone Nov 15, 2026 — with Claude
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

The docs preview for this pull request was removed when it closed.

Base automatically changed from claude/project-thread-u5g4vi to main November 15, 2026 04:54
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

📸 Screenshot drift check

No drift: the committed screenshots already match a fresh deterministic generation. ✅

@maniator
maniator force-pushed the claude/project-thread-u5g4vi-jam branch from e8f2602 to e3259ef Compare November 15, 2026 04:58
@maniator
maniator marked this pull request as ready for review November 15, 2026 05:00
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T05:00:08.781853Z
We couldn’t complete this review. Comment @codex review to try again.
e3259ef Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@maniator maniator left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent review of 8350f49: CONDITIONAL GO (CI is red: the install is over its 4.5 MiB budget)

Stand-in PR review plus a /gds-code-review lean pass (Blind Hunter, Edge Case Hunter, Acceptance Auditor, Hot-Path Auditor, triage), since Copilot, Codex and PR-Agent are down. This covers the whole diff over main at 4f4aa54 (#2246 merged). e3259ef and 8350f49 differ only by moving the four line functions into expected_lines.rs, and I checked that no line changed meaning.

Blocker: CI

engine-wasm fails on verify-precache: "the precache is 4.51 MiB, over its 4.5 MiB budget". main measures 4.49 MiB, so this PR's WASM growth tips it over. The e2e jobs fail with it. #2238 at 816f20b hits the same check at 4.50 MiB, so the two together will be further over. The 4.5 MiB budget is the owner's own number. Either shrink the engine back under it, or ask Naftali to raise PRECACHE_BUDGET_BYTES and record the reason, as the check asks.

What I checked myself

  • The tests bite. All 10 line_count tests pass. With the restore_oldest call taken out of adopt.rs, a_reload_counts_the_same_lines fails.
  • Same game after a reload, through a real jam. maxed Modern on a weekday: reloading a copy every minute from 9:20 AM to 1:20 PM and comparing it a minute later gave 0 mismatches in 240. At the end, 354 riders had waited over an hour. Without restore_oldest, the same probe gives 215 mismatches in 240, starting 3 minutes in. The 13-hour, 3-day hourly check had 0 divergences on maxed Modern and on the owner's tower.
  • The A* bound from #2246 stays admissible. A boarding now costs max(expected, oldest), which is at least the expected cost, so least_cost stays a lower bound and searches stay exact.
  • Once per line. passed_an_hour fires only on the step a wait crosses GIVE_UP. A rider who stays keeps the wait, so it never fires again. A rider who moves starts the new line at 0. plan no longer joins a line, so a rider who weighs another way and stays is not counted twice (weighing_another_way_and_staying_joins_no_line_twice). keep_lines keeps the last count with the crowd until the pass ends, so a route started mid-pass still reads it.
  • Classic is untouched. All three parts read routes_by_expected_time().

Cost (HP-2): within what the owner accepted

The owner chose "Stack it on the speed-up" on 2026-11-15 on a card that said "17% more than the speed-up alone". My whole-tick timings against main with #2246 (weekday, 8 to 10 AM, best of 7 per run, median of three interleaved rounds) fall inside that:

Tower Edit every minute 8-9 AM 9-10 AM
owner none 20.1 / 19.7 (-2%) 7.3 / 7.2 (-1%)
owner stop set and cleared 151.8 / 143.6 (-5%) 132.0 / 131.7 (0%)
split-tower-16 none 54.6 / 52.4 (-4%) 78.8 / 80.6 (+2%)
split-tower-16 stop set and cleared 186.2 / 194.3 (+4%) 295.8 / 303.0 (+2%)
maxed-modern none 165.6 / 173.4 (+5%) 297.4 / 316.7 (+6%)
maxed-modern stop set and cleared 331.1 / 329.4 (-1%) 610.5 / 616.3 (+1%)

The added cost shows where hour-long lines form (maxed Modern from 9 AM). That is the re-route searches the card named.

Notes, no change asked

  • The Bulletin warning can fire every hour while a jam lasts, which is up to four red lines over a morning rush. That is what was asked for. Say so if it turns out to be noisy.
  • Riders who re-route reset their wait, so a jam everyone escapes makes no Bulletin line. That reads right: the warning names lines people are still stuck in.

Conditions

  1. engine-wasm green: under the 4.5 MiB budget, or the owner raises it in his own words.
  2. All of CI green on that head.

Hot-path record (section 6), 8350f49, whole diff

Item Result What was checked Findings and resolution
HP-1 clear rethink_long_wait <- motion::advance (per person per step: an early return unless a Waiting rider's wait just crossed GIVE_UP). LineCount::see (per person per step). cost_of (per boarding link per Modern search). warn_long_lines <- the hourly pass. restore_oldest <- load. none
HP-2 clear No new per-step scan. One extra route search per rider whose line passes an hour, about 8,400 over the author's 1.5-day run. +5 to 6% on maxed Modern in the jam hours (table above), inside the 17% the owner accepted on the decision card accepted by the owner
HP-3 clear the motion pass refills spare instead of allocating a map each pass, and Line is Copy none
HP-4 clear no sort. warn_long_lines uses one max_by with a fixed tie-break none
HP-5 clear FastMap<(shaft, floor), Line> as before, with the wait folded into the same entry none
HP-6 clear cost_of is the same single lookup none
HP-7 clear reroute was split into take_route, re-read as new: same body none
HP-8 clear no cache. oldest is recounted from the saved people at load (restore_oldest), and the mutation above shows a reload diverges without it none
HP-9 n/a nothing over budget beyond the owner's acceptance none
HP-10 clear deterministic. Reload gives the same game through a live jam (0 of 240 per-minute reloads) and hourly over 3 days none
HP-11 finding (1) no binding change, but the WASM grows the install over its 4.5 MiB budget (4.51 MiB) Blocker above
HP-12 n/a no rendering change. The Bulletin line is engine text none

Reviewed against Verticopolis conventions (.github/copilot-instructions.md).


Generated by Claude Code

@maniator maniator mentioned this pull request Nov 15, 2026
7 of 12 tasks
@maniator
maniator force-pushed the claude/project-thread-u5g4vi-jam branch from 8350f49 to 8ed7a5d Compare November 15, 2026 05:25

Copy link
Copy Markdown
Owner Author

engine-wasm (and the e2e jobs that need its build) fail on verify-precache: the install is 4.51 MiB against the 4.5 MiB budget. Naftali asked for a party on the budget; the web room chose 6 MiB raw (8 to 3 to 1). The raise lands as its own small PR, since the menu bar work hits the same limit, and this PR rebases onto it then. 8ed7a5d is this change rebased onto main after #2257, with the locks regenerated.


Generated by Claude Code

On a tower whose Metro line under the basement express jams in the
morning rush, hundreds of riders stood in that line for hours. Now a
rider whose wait in one line passes an hour is routed again from where
they stand, once per line, and walks to another way up when it is
quicker. The router also counts how long each line has already kept its
riders, so a boarding costs the longer of the expected wait and the one
the line shows. Each hour the Bulletin names the worst landing where
someone passed an hour in line.

The lines keep one map, riders and longest wait together, and the
motion pass refills the last count's map instead of allocating a new
one. Planning a route no longer joins its line until the rider takes
it, so a rider who weighs another way and stays is counted once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trYcRHkvnh6N2YZqqjw
The Metro platform in metro-line-east holds a different mix of riders
now that riders stuck an hour in one line look for another way.
Rendered in the pinned Playwright image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7trYcRHkvnh6N2YZqqjw
@maniator
maniator merged commit bd77760 into main Nov 15, 2026
47 checks passed
@maniator
maniator deleted the claude/project-thread-u5g4vi-jam branch November 15, 2026 05:57
maniator pushed a commit that referenced this pull request Nov 15, 2026
It made the split tower's simulation up to 27% slower per game day than
before it landed (about 8% even with the planned route cache), and no
change may ship slower than 4.0. It returns in 4.2 with a re-route that
costs nothing. Nothing released carried it, so this note is internal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7traFk8vS886Znni3dx3
maniator pushed a commit that referenced this pull request Nov 15, 2026
It made the split tower's simulation up to 27% slower per game day than
before it landed (about 8% even with the planned route cache), and no
change may ship slower than 4.0. It returns in 4.2 with a re-route that
costs nothing. #2272's note stays, since only a release consumes notes;
its lines come out of the 4.1 changelogs when the release is cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7traFk8vS886Znni3dx3

This branch was successfully deployed

1 active and 1 inactive deployments
github-pages — 6ac7d9d3 Deployed Nov 15, 2026 by maniator via docs-preview (remove) / docs-pages (deploy) #672
Preview — 6ac7d9d3 Deployed Nov 15, 2026 by vercel[bot]
screenshot-approval — 8ed7a5db Deployed Nov 15, 2026 by maniator via commit-on-approval #5003
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.

2 participants