Skip to content

Keep riders aboard when their stop is turned off (#2324) - #2328

Merged
maniator merged 2 commits into
mainfrom
claude/project-thread-yuh4c2-stop-edit-riders
Nov 15, 2026
Merged

maniator merged 2 commits into
mainfrom
claude/project-thread-yuh4c2-stop-edit-riders

Conversation

@maniator

@maniator maniator commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

What & why

Closes #2324. Turning off an elevator stop made everyone riding to that floor disappear from the car on the next step: the Riding arm in engine-rs/src/crowd/motion.rs saw !shaft.stops_at(dest) and called give_up, which ends a rider's trip with finish. That breaks the no-warping rule (nobody vanishes mid-tower). Found by the independent review of #2304 and deferred there as pre-existing.

Now such a rider stays aboard, gets off at the nearest stop and finds a new way on from there (Naftali: "make sure the npc gets off at the closest stop and then has to reroute itself"). crowd::walk::ride_on_or_step_out points the rider at the shaft's stop nearest their floor (ties go to the stop nearer the car), and the car's cab call follows (elevator_calls reads floors[leg + 1]). When they step off short, walk::stepped_off_short hands them to walk::find_way_on, which routes again from that floor:

  • housekeepers go through staff_shift::way_on: the staff network (service elevators and stairs), and the passenger network only for the In and Out commute;
  • anyone else takes a passenger route; with none, they head to the ground lobby and leave (returning), so nobody vanishes mid-tower;
  • only someone who cannot reach the lobby either falls to give_up, which ends the trip at the floor they stepped off at.

A rider whose car or shaft went still steps out of the trip as before (3.7.3).

Docs: the elevators help page says what happens to riders when you turn a stop off. Backlog row stop-edit-riders-vanish added as done.

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

Quality gates

  • npm run typecheck (no TypeScript changed; CI runs it)
  • npm run lint (CI)
  • npm test: all 1,942 Rust lib tests pass locally, plus the backlog mirror test; the conformance, frame-day, port-edit and fuzz goldens re-recorded with no change
  • npm run build (CI)

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

Complexity

Hot paths and call frequency (tier), sizes, complexity before and after, remaining scans and why, caches kept or replaced (HP-8), invalidation evidence, measurements: n/a: the per-step Riding arm keeps the same stops_at check; the new work (one pass over the shaft's memoized stop list via Tower::stops_of and one route search) runs only on the step a rider's floor stops being a stop, a player edit, not per frame or per tick.

Hot-path record (section 6): to follow from the review.

Screenshots / recordings

n/a: no rendering change; the gallery does not stage a stop edit with riders aboard.

Notes for reviewers

Three rule tests in rule_tests::crowd: a rider rides on to the nearest stop and walks the rest (fails on main, where the rider vanishes); a housekeeper stays on the staff network; a rider with no way on leaves through the lobby. The last two fail with the first head's code. is_still_setting_out and turn_back moved to walk.rs unchanged to keep motion.rs under 500 lines (488).

Soak (5 game days, both maxed towers, 4 stop-toggle seeds, main vs PR): cab vanishes 59 to 82 (Classic) and 230 to 856 (Modern) went to 0, nobody stayed stuck aboard, and 4-hour waits match main. Housekeepers waiting 4 to 8 hours for service elevators also happens on main, and is #2332.

https://claude.ai/code/session_01Ms7traFk8vS886Znni3dx3


Generated by Claude Code

@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 8:39pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

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-15T20:30:45.019749Z
We couldn’t complete this review. Comment @codex review to try again.
ed080ce 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.

@github-actions github-actions Bot added this to the 4.x milestone Nov 15, 2026
@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 enabled auto-merge November 15, 2026 19:46
@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.

@maniator
maniator disabled auto-merge November 15, 2026 19:47
@maniator
maniator force-pushed the claude/project-thread-yuh4c2-stop-edit-riders branch from b280704 to cac45d6 Compare November 15, 2026 19:48

@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 #2328 at b280704 (stand-in-pr-review + /gds-code-review, one lean pass, with Hot-Path Auditor)

Verdict: CONDITIONAL GO. The passenger fix is right and its test is honest. One patch finding on housekeepers, and CI needs a fresh run (the engine rust and rust-coverage jobs were cancelled, so the engine-rs roll-up failed; nothing in the code failed).

What I checked

  • Indexing. floors.truncate(leg + 1) keeps the boarding floor at leg, and on.floors[0] is the new stop, so floors[leg + 1] becomes that stop. shafts.truncate(leg + 1) keeps the shaft being ridden at leg, and on.shafts follows it, so shafts[k] still links floors[k] to floors[k + 1]. When the nearest stop is the trip's last floor, the rider alights with leg == shafts.len() and goes to ToDest, as the alight arm expects.
  • Can the car ever let them off? Yes. routing::elevator_calls rebuilds the cab calls every step from each rider's floors[leg + 1], so the car gets a call to the new stop on the next step. That stop is a current stop, so the Riding arm does not fire again unless the player edits the stops again, and each edit reroutes once.
  • No loop. stops_of and stops_at read the same skip list (Transport::stop_floors filters the same whole floors stops_at rejects), and stops_of is keyed on tower.revision, so the chosen stop can never be the floor that just stopped being one. When the route fails, the code falls to give_up, which ends the trip as before.
  • Test honesty. rule_tests::crowd passes at the head (15 of 15). With main's crowd/motion.rs put back, a_rider_whose_floor_stops_being_a_stop_rides_on_to_the_nearest_stop fails, so the test does guard the fix.
  • Docs and versioning. The help line in elevators.mdx matches the behavior. The new functions are pub(super) or private, so crate: patch is correct, and readmes: unchanged holds. The backlog row is marked done.

Findings

  1. patch: a housekeeper's work trip can switch to the passenger network. ride_to_nearest_stop always routes on with crowd.route, the passenger network. Before this PR, a staff rider went to staff_shift::stuck. Now a housekeeper on a Job, Home or Base trip whose service-elevator stop is turned off goes on by passenger elevators and escalators. That breaks the rule in staff_shift.rs that work trips keep to the staff network (service elevators and stairs). walk::find_another_way already treats staff on their own for this reason.

    The fix is not to go back to stuck. stuck puts a rider back at p.floor (fy = p.floor, state ToDest), so a housekeeper jumps from the cab to the floor they boarded on, which breaks the no-warping rule. Route a staff rider the way staff_shift::route does: staff_route for work trips, and for the In and Out commute, staff first and then passenger. Give up only when neither finds a way. Add a rule test with a housekeeper on a service elevator whose stop is turned off.

  2. Note (non-blocking): when the new route's first leg is the same shaft (for example, the nearest stop is below the turned-off floor and the way on rides the same shaft up past it), the rider gets off and waits for the same shaft again. This is correct and they don't get stuck, but staying aboard would read better. Optional.

Hot-path record (docs/performance/hot-path-review.md, section 6)

Item Result
HP-1 Surface crowd/motion.rs Riding arm, per rider per step: hot
HP-2 Common path Unchanged: the new call sits behind !shaft.stops_at(dest), the same branch as before
HP-3 New scans stops_of (memo hit, one Vec clone) and one crowd.route search, once per affected rider per stop edit
HP-4 Repeat cost None: after the reroute, dest is a stop, so the branch does not fire again on later steps
HP-5 Allocation Two Vec extends on the edge path only
HP-6 Callers traced motion::step only; give_up callers are unchanged
HP-7 Tier budget Within budget: an edit-driven event, not per-frame work
HP-8 Caches None dropped or bypassed; uses the existing stops_of memo and route cache
HP-9 Determinism Tie-breaks are total: distance, then nearness to the car (total_cmp), then the lower floor
HP-10 Save impact None: no new fields
HP-11 Measured Not needed: the common path is unchanged (see HP-2)
HP-12 Outcome Pass

To reach GO

  • Fix finding 1 and add its test.
  • Rerun CI to green.
  • Fold in the stuck-forever soak the author thread is running on both maxed towers.

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


Generated by Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

📸 Screenshot drift check

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

Copy link
Copy Markdown
Owner Author

Independent stuck-forever check (asked for by the owner), head c9789db

Scope: can this change leave anyone stuck forever, vanishing, or riding with no end? This is not the full review; the "Review triage fix PRs" thread has that. The probes are scratch files, never committed.

Method. 5-day soaks of both maxed towers on main (faafa48) and on this head. A seeded stream turns one elevator stop off every 10 minutes, and each comes back 30 minutes later (about 600 toggles per run, rush hours included). Four toggle seeds per tower. Each minute, the probe records:

tower cab vanishes, main → PR stuck aboard > 2 h frozen > 4 h, main → PR (mean of 4 seeds) longest frozen, main → PR
maxed-classic 59–82 → 0 0 / 0 818 → 809 269 → 269 min
maxed-modern 230–856 → 0 0 / 0 3,246 → 3,352 (+3%, inside the seed spread of 3,122–3,372 on main) 469–509 → 436–508 min

Verdict: GO on the stuck-forever question. Nobody vanishes from a cab any more, nobody rides on with no stop to get off at, and long waits are the same as main within seed noise.

My earlier note about 4+ hour waits rising was not caused by this PR. On the earlier head, the PR run happened to draw a bomb search (a Security tower freezes everyone but the guards), and the main run did not. The car I traced, at floor 32.24 with a rider for 1, was frozen by that search.

Code read of ride_to_nearest_stop, stepped_off_short and find_way_on:

  • A rider whose second stop is also turned off re-targets again.
  • A stop turned back on mid-ride lets the rider ride on normally.
  • Housekeepers use staff_shift::way_on: the staff network, and the passenger network only for In/Out. This fixes the earlier head, where a housekeeper on a Job leg got a passenger elevator.
  • A walker with no way on heads for the lobby. Only someone with no route anywhere (an isolated floor) still ends the trip there.

Pre-existing, on main too, not from this PR: on both maxed towers, housekeepers wait 4 to 8 hours for a service elevator. They wait at the lobby (In) and at floor 20 (Home), with wait sitting at 482. This deserves its own issue.


Generated by Claude Code

@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 re-review of #2328 at c9789db: GO

The earlier patch finding is fixed. The redesign holds, and CI is green on this head (37 passed, 8 skipped).

What changed and what I checked

  • Ride on, then reroute on foot. ride_to_nearest_stop no longer routes inside the cab. It rewrites the trip to [.., boarding, stop, to] on the same shaft. When the rider gets off at stop, stepped_off_short sees the next leg on that same shaft going to a floor it no longer stops at, and hands the rider to find_way_on. When stop == to, the rider gets off and goes to ToDest as usual. stepped_off_short only fires for the same shaft to a non-stop floor, a leg no router produces, so ordinary trips are unaffected.
  • Housekeepers (my finding 1): fixed. find_way_on routes staff through staff_shift::way_on: the staff network, and the passenger network only for the In and Out commute, the same choice spawn_commuter and send_out make. A housekeeper with no way on goes to give_up, then stuck, which sets fy = p.floor. That is the stop they just stepped off at, so there is no jump out of the cab.
  • Nobody with no way on vanishes. A non-staff rider leaves through the ground lobby by route_out_nearest, or by a plain route to floor 1, with returning set, so the trip ends at the lobby door. Only someone who cannot even reach the lobby falls to give_up.
  • Test honesty. rule_tests::crowd passes at this head (16 of 16). With the first head's motion.rs, walk.rs and staff_shift.rs put back, two tests fail: a_housekeeper_whose_floor_stops_being_a_stop_stays_on_the_staff_network and a_rider_whose_floor_stops_being_a_stop_with_no_way_on_leaves_by_the_lobby. I already showed the original test fails on main.
  • Soak. The stuck-forever soak by the other thread is on the PR: cab vanishes drop to 0, and 4-hour waits match main.
  • Sizes and notes. walk.rs is 228 lines and motion.rs is 488, both under 500. The change note and help line describe the lobby exit and the housekeeper rule. crate: patch holds, since the new items are pub(super) and staff_shift::way_on sits inside a private module.

Hot-path record (section 6)

Item Result
HP-1 Surface crowd/motion.rs, the arrive branches of Riding and Climbing: hot (per alight)
HP-2 Common path Adds stepped_off_short per alight: one Vec::get, an id compare and, only on a same-shaft leg, stops_at (bounds plus a skip-list contains). O(1) in practice, no allocation
HP-3 New scans stops_of (memo hit) and the rewrite in ride_to_nearest_stop, once per affected rider per stop edit. find_way_on runs one route search, or two for In/Out staff and for the lobby fallback, once per rider who steps off short
HP-4 Repeat cost None: after the rewrite the next floor is a stop, and after find_way_on the rider holds a fresh route
HP-5 Allocation Two small pushes on the edge path only
HP-6 Callers traced motion::step only. give_up, turn_back and is_still_setting_out moved to walk.rs unchanged
HP-7 Tier budget Within budget
HP-8 Caches None dropped or bypassed
HP-9 Determinism Total tie-breaks: distance, car nearness (total_cmp), floor. The lobby tile comes from the person's seed
HP-10 Save impact None: no new fields
HP-11 Measured Covered by the soak's wait comparison against main. The common-path addition is O(1)
HP-12 Outcome Pass

Nit (optional): the help line says "With no other way up, they head back down". The rider may have been going down, so "With no other way on" would cover both directions.

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


Generated by Claude Code

@maniator
maniator force-pushed the claude/project-thread-yuh4c2-stop-edit-riders branch from c9789db to ed080ce Compare November 15, 2026 20:30
@maniator
maniator marked this pull request as ready for review November 15, 2026 20:30
@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 #2328 at ed080ce: GO (carried from c9789db)

git range-diff against c9789db shows:

  • The first commit is identical.
  • The second commit has the same code. The only changes are the help nit I raised ("With no other way on, they head for the lobby and leave."), a fuller done-row for #2324, and a new open backlog row housekeeper-service-elevator-waits linked to the open issue #2332 (pre-existing waits found by the soak).

The section 6 record and the test-honesty checks from my c9789db review carry unchanged.

Main has gained #2329 since this rebase. git merge-tree shows no conflict, and the files don't overlap (the menu UI against engine-rs/src/crowd). Per the up-to-date rule, rebase onto main once more before merging, then wait for CI to go green.

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


Generated by Claude Code

A rider whose destination stopped being a stop mid-ride left the crowd on
the next step, vanishing from the car. Now they ride on to the car's stop
nearest that floor and reroute from there; a rider whose car went, or with
no way on from any stop, still steps out of the trip as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7traFk8vS886Znni3dx3
A rider whose floor stops being a stop now rides to the nearest stop,
gets off there and routes again from that floor. Housekeepers stay on
the service elevators and stairs; a passenger with no way on leaves
through the lobby instead of vanishing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ms7traFk8vS886Znni3dx3
@maniator
maniator force-pushed the claude/project-thread-yuh4c2-stop-edit-riders branch from ed080ce to f23ff06 Compare November 15, 2026 20:32
@maniator
maniator merged commit 9970d6c into main Nov 15, 2026
46 checks passed
@maniator
maniator deleted the claude/project-thread-yuh4c2-stop-edit-riders branch November 15, 2026 20:43

This branch was successfully deployed

1 active and 1 inactive deployments
github-pages — f23ff060 Deployed Nov 15, 2026 by maniator via docs-preview (remove) / docs-pages (deploy) #794
Preview — f23ff060 Deployed Nov 15, 2026 by vercel[bot]
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.

Riders vanish when the stop they are riding to is turned off

2 participants