Repository navigation
Venue staff commute to work through the lobby or the Metro - #2238
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
c2dd0f7 to
42bda6a
Compare
42bda6a to
875f139
Compare
|
The docs preview for this pull request was removed when it closed. |
📸 Screenshot drift checkNo drift: the committed screenshots already match a fresh deterministic generation. ✅ |
875f139 to
3bfbd8a
Compare
maniator
left a comment
There was a problem hiding this comment.
Independent review of 875f139: CONDITIONAL GO (two small patches, the owner's call on cost, rebase)
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 c48616b (4.0.0). It is a save change, so I ran the reload same-game proof myself.
What I checked myself
- Same game after a reload. I played 13 hours, saved, reloaded, then hashed state and crowd every hour for 3 days. Maxed Modern, maxed Classic and the owner's tower all had 0 divergences in 72. A second probe reloaded a copy every minute from 8:20 AM to 1:20 PM on day 2, through the hours the staff ride in and the venues open, and compared it one minute later. The owner's tower and maxed Modern had 0 mismatches in 300.
desksStaleis load-bearing. With theUNSQUAREDmark taken out ofrestore_desks,a_reload_straight_after_a_bulldoze_keeps_the_crowdfails. All 9venue_stafftests pass with it in.- Desk bookkeeping. The full-office rule from #2268 now covers venues through
Workplace::crew, anddesk_from's clamp at an office's 6 covers the largest crew, whichno_venue_keeps_more_staff_than_an_office_holdspins.staff_inis synced at every desk change and at load (thestandingcheck inreconcile), so it cannot drift.is_operationaldoes not treat a closed venue'sEmptystate as gone, so staff can come in during the hour before opening. - Classic is untouched.
waits_for_staffis false there, andopen_for_businessreduces tois_open_at.
Patches
- Workers leaving a bulldozed office lose their card purpose (
commuters.rs:leaveand the full or gone branch ofat_destination). With the unit gone,Workplace::ofreturnsNone, sostampsets no errand, andtrip_factsshowsPurpose::Unknown. Onmain, the same worker is stampedErrandPlace::Officeand reads "from work". Office and Work map to the same purpose (ToWork/FromWork), so a fallback restores the card. Either stampErrandPlace::Workwhen the kind is unknown, or keep the kind on theCommuteor theDesk. Add a test that bulldozes an occupied office and checks the leaver's purpose. - The change note says "a save without the key loads as before", which is not quite right. Before this PR, the load's
reconcilesent stranded workers out at once. Now a save withoutdesksStalewhose desks are stranded (one from 4.0 taken between a bulldoze and the next step) loads with them still inside, and the next hourly pass sends them out. The window is one frame and nobody vanishes, so I'm not asking for a code change. Reword the note to say what happens.
The owner's call: per-tick cost of the new people (HP-2)
Whole-tick time, release build, zz_edit_bench2.rs, best of 7 per run, three interleaved rounds against main at c48616b (median, ms, main / this PR):
| Tower | Edit every minute | 7-8 AM | 8-9 AM |
|---|---|---|---|
| owner | none | 23.0 / 24.6 (+7%) | 10.0 / 11.4 (+14%) |
| owner | revision bump | 102.0 / 109.1 (+7%) | 162.0 / 152.1 (-6%) |
| owner | stop set and cleared | 101.3 / 110.0 (+9%) | 162.6 / 153.5 (-6%) |
| split-tower-16 | none | 62.4 / 59.3 (-5%) | 69.5 / 66.3 (-5%) |
| maxed-modern | none | 47.0 / 45.4 (-3%) | 198.7 / 212.8 (+7%) |
| maxed-modern | stop set and cleared | 130.8 / 133.3 (+2%) | 364.6 / 379.4 (+4%) |
The no-edit rows on the owner's tower are slower in every round. I traced it to the staff themselves. Day 2 on that tower is a weekend, so main has no commuters from 7 to 9 AM and about 186 people. This PR has up to 118 staff on the move and 305 people at 8 AM. On maxed Modern at 8:45 AM, the crowd is 4,215 people against 3,954. The code adds no per-step scan: open_for_business is one compare, and book(venues_only) runs once per edit over the rooms. So this is the cost of the feature's own trips, not overhead. Under the zero-slowdown rule, the owner has to accept it in his own words, as he did for #2228's rush and #2272's re-routes. #2246 lands first and is faster by more than this, but that is his decision to make.
Conditions
- Fix patch 1 and reword the note (patch 2).
- The owner accepts the per-person cost above in his own words.
- Rebase onto
main. The branch shows conflicts again after the latest merges. CI on 875f139 is green (38 passed, 8 skipped), and it needs to be green on the rebased head.
Hot-path record (section 6), 875f139, whole diff
| Item | Result | What was checked | Findings and resolution |
|---|---|---|---|
| HP-1 | clear | book_commutes (hourly) <- Simulation::tick. start_commutes (per step), which runs reconcile and book(venues_only) only on a revision change. open_for_business <- spawn_floors, walk_ins, spawn_venue_visit, meal_trips, traffic and presence. desks_stale <- serialize (per save). |
none |
| HP-2 | finding (1) | No new per-step scan. book(venues_only) is O(rooms) per edit. The added staff are new people with their own trips: +7% and +14% per tick on the owner's tower from 7 to 9 AM with no edits, and +7% on maxed Modern from 8 to 9 AM (table above). |
the owner accepts the cost, or the staff trips get cheaper |
| HP-3 | clear | shifts are pushed into the existing Vec. reconcile's id list is unchanged |
none |
| HP-4 | clear | sort_shifts is unchanged apart from a renamed key |
none |
| HP-5 | clear | desks stays a BTreeMap by id. staff_in is a u8 on Unit |
none |
| HP-6 | clear | open_for_business is is_open_at plus one byte compare |
none |
| HP-7 | clear | The office commute code moved into workplace.rs (hour_share, office_hours, sync_head_count) was re-read as new: same logic, with venues added beside offices |
none |
| HP-8 | clear | no cache. staff_in is state written from the desk at each change and at load, with no separate invalidation |
none |
| HP-9 | finding (1) | remedy for HP-2 named above | as above |
| HP-10 | clear | deterministic. Reload gives the same game on three towers (hourly for 3 days, and every minute through the morning). The desksStale mutation is caught |
none |
| HP-11 | clear | no binding or frame layout change. The compat record moves only its lock digest | none |
| HP-12 | n/a | no rendering change. presence reads open_for_business in the engine |
none |
Reviewed against Verticopolis conventions (.github/copilot-instructions.md).
Generated by Claude Code
3bfbd8a to
816f20b
Compare
maniator
left a comment
There was a problem hiding this comment.
Confirming pass on 816f20b: both patches fixed; GO once the owner accepts the cost and CI is green
Stand-in PR review plus a /gds-code-review lean pass, covering 3bfbd8a (the rebase) and 816f20b (the fixes).
- The rebase (3bfbd8a). I replayed 875f139 onto its new base and compared. Only regenerated goldens, the compat record's lock digest,
frame-days.jsonand theSTREAMEDcount differ. - Patch 1 is fixed.
stampnow falls back toErrandPlace::Workwhen the workplace is gone, so the card reads "from work" again.staff_leaving_a_bulldozed_shop_still_go_home_from_workchecks every leaver of a bulldozed shop, and it fails on 3bfbd8a, as you said. One side effect, which is fine: a worker leaving a bulldozed office now carriesWork, soon_the_jobkeeps their wait off the floor where the office stood. Onmainthat wait stressed the floor. The office is gone, so nothing there should be judged by it. - Patch 2 is fixed. The change note now says a save without the key keeps the stranded workers until the next hourly pass.
- The
fxSequencesre-pin (fire scenariofiresGutRooms10 to 12) comes from #2246's routing landing onmain, not from this diff.
No new findings. Still open:
- The owner's acceptance, in his own words, of the per-tick cost of the staff's trips (HP-2 in my review of 875f139). The hot-path record from that review carries to this head, with HP-2 and HP-9 waiting on that answer.
- Green CI on 816f20b.
Reviewed against Verticopolis conventions (.github/copilot-instructions.md).
Generated by Claude Code
|
Held out of 4.1 by Naftali (2026-11-15) because of the rush-tick cost of the staff's trips, so this is back to draft. The red Generated by Claude Code |
816f20b to
802df5b
Compare
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
c8be6a2 to
0014ef2
Compare
Independent review (stand-in-pr-review +
|
| tower | base Ir | PR Ir | change |
|---|---|---|---|
| maxed-classic | 6.732 G | 4.781 G | −29.0% |
| maxed-modern | 11.629 G | 8.554 G | −26.5% |
| split-tower-26 | 3.150 G | 3.043 G | −3.4% |
Most of the drop is dispatch_pass (Classic 168.4 M → 4.4 M, Modern 382.7 M → 15.4 M), bfs_route and accumulate. Two functions are slower on the small tower (F2, F3 below).
Findings
F1 (patch, NO WARPING and reload identity). A venue that becomes operational mid-hour, for example a shop whose construction finishes, gets no desk until the next hourly pass. Finishing construction does not move tower.revision, so start_commutes does not book it either. If the game is saved in that window (autosave included), the load runs reconcile's branch for saves from before this PR: no desk plus staffed_at(hour) puts staff_size inside at once. The crew appears inside without riding in, the shop opens, and the crowd diverges from the game that saved. The probe built a Modern shop at 6:00, 9:00 and 13:00, stepped until it turned operational (08:56, 11:56, 15:56) and saved at that step. Every reload loaded staff_in 2 with desk inside: 2, while the game had no desk, and crowd.view() differed from minute 4 on. The same window opens when a venue comes back after a fire. Fix: only fabricate staff on a load from a save that predates venue staff (a version or a marker the new writer always writes). Also have a venue that turns operational at a staffed hour call its crew in, as a newly built one does, rather than wait for the hour. Please add a regression test for a reload straight after construction finishes.
F2 (patch, HP-3). bfs_route now builds a SegSet on every call: 645 words (5.2 KB) allocated and zeroed for the whole lot, whatever the tower's size. On split-tower-26, bfs_route went from 0.82 M to 1.75 M Ir inclusive (+113%). The run is still faster overall, but NOTHING SLOWER covers each path. Remedy (HP-9): reuse one set kept on the crowd, clearing only the words a search touched, or size it to the tower's floor span.
F3 (patch, HP-2). dispatch_pass now scans crowd.people a second time (free_maid_count) right after free_maids built the same list. On split-tower-26, dispatch_pass went from 0.73 M to 1.35 M Ir. Remedy: sum the lengths of the lists in free.
F4 (patch, docs). In crowd/mod.rs, the closed_cars comment now says "never saved". crowd/save.rs:400 writes closedCars (#2240), so the comment should say so again.
Owner call, not mine. The 3.0% to 5.0% rise in waits over 30 minutes still needs Naftali's OK before merge, as the PR says.
Hot-path record (section 6), head 0014ef2
| item | result | traced | resolution |
|---|---|---|---|
| HP-1 | clear | accumulate_waiting ← ElevatorDispatch::accumulate ← sim step; book/reconcile ← book_commutes (hourly) and start_commutes (every step, edit-gated); bfs_route ← route search; dispatch_pass ← housekeeping step; desks_stale ← every save |
n/a |
| HP-2 | finding (1) | free_maid_count rescans people per pass; book(venues_only) walks rooms only on an edit; desks_stale is O(desks) per save |
F3 |
| HP-3 | finding (1) | SegSet::new alloc + memset per bfs_route; book no longer inserts idle desks |
F2 |
| HP-4 | clear | sort_shifts unchanged (hourly/edit); Banks sorts once per revision |
n/a |
| HP-5 | clear | AdjGraph, Memo.stops, cols, served set moved to FastMap/FastSet; checked for walks in hash order: adjacency(..).sorted() and passenger_parts sort before use |
n/a |
| HP-6 | clear | DispatchFloors::slot replaces a binary search; desks by id |
n/a |
| HP-7 | clear | moved accumulate_waiting reviewed as new; same fold order |
n/a |
| HP-8 | clear | no cache dropped; Banks keeps the per-revision memo with numbered landing lists |
n/a |
| HP-9 | done | remedies named for F2 and F3 | F2, F3 |
| HP-10 | finding (1) | Classic 48/48 hourly hashes identical across builds; Modern reload 26/26; bulldoze-then-save identical; the construction-done-then-save reload diverges | F1 |
| HP-11 | clear | staff_in is not exported; the save gains desksStale and the "work" errand only |
n/a |
| HP-12 | n/a | no rendering change | n/a |
Probes: zz_classic_hash.rs, zz_staff.rs (build, construction, hourly reload, bulldoze, no-warp) and zz_perf.rs in the project's review folder for this PR.
Generated by Claude Code
0014ef2 to
f44848d
Compare
505fe09 to
d5cd7ce
Compare
61ac0f5 to
1ea4d84
Compare
Every Modern shop, restaurant and venue now has a crew that commutes as real people: they ride in from the ground lobby or a served Metro platform four hours before the venue opens, the doors open once the first of them is in, and they leave the same way after closing. A venue no route reaches never opens. Classic venues keep opening by the clock. The crew's trips use ErrandPlace::Work (saved as "work"), the desks and bookings are saved with the crowd, and a save made between a bulldoze and the next step carries crowd.desksStale so its load sends stranded staff out as the game that saved would. The dispatch's waiting pass keeps the last room's kind answer and finds a floor's slot by index (DispatchFloors::slot), which more than pays for the extra riders: the four benchmark towers run 2% to 30% fewer instructions than main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ms7trYcRHkvnh6N2YZqqjw
1ea4d84 to
9419511
Compare
Independent review, round 2: 1ea4d84 (= 9419511)Verdict: GO. All four round-1 findings are fixed and verified with probes. No new
Round-1 findings
Probes I re-ran (scratch only, never committed)
Hot-path record (docs/performance/hot-path-review.md, section 6)Callgrind, cgu1 release, 1,440 one-minute ticks, total instructions (load included), main a500207 against the PR:
CI on 9419511: everything that has finished is green. One e2e shard was still running when I checked. Generated by Claude Code |
What & why
In Modern towers, venue staff now come to work as people. This is the second half of the "no warping" plan for workers, after office commutes (#2228, shipped in 3.13.0). Each staffed venue has a crew of its own (
Kind::staff_size):The crew is called in four hours before the venue opens and rides in from the ground lobby or the Metro, so a shop that opens at 10 has its crew in by about 6:30, before the 7 to 10 AM office rush. The doors open once the first of them is in, and the crew leaves the same way after closing; a break of four hours or less, such as a restaurant's between lunch and dinner, keeps the crew in. A venue no route reaches never opens. Classic venues keep opening by the clock.
facilities/predicates.rsaddsKind::staff_size,Kind::staffed_at(the open hours plus the four hours before,CREW_CALL_AHEAD) andKind::waits_for_staff(mode).rules/commute.rsaddsvenue_staff_commute_in_person, which is Modern only and follows the office commutes.Unit::staff_in(au8, not saved) is rebuilt from the crowd's desks.Unit::open_for_business(hour, mode)isis_open_atand, for a venue that waits for staff, at least one staffer in. It gates visits, walk-ins, takings (economy/traffic.rs) and the drawn presence.crowd/workplace.rs(new) definesWorkplace(an office or a venue) and what each asks of the commute: who counts as at work, the crew size, the errand a person card names, and what the hourly booking owes (due).crowd/commuters.rs, the hourly booking andreconcilenow cover venues alongside offices:Crowd::book_venue_crews, called fromfinish_construction).ErrandPlace::Work, saved as"work".commuters_save::CrowdMarks) keep a reload on the same game:crowd.desksStalemarks a save taken after an edit the desks were not squared with yet: workers stranded by a bulldoze, or a venue built while it should be open whose crew the next step calls in. The load squares the desks without sending anyone (restore_desks) and leaves the rest to the first step, as the game that saved would have.crowd.venueStaffmarks a Modern save once a step has squared the desks, so a load keeps a venue whose crew is not in yet empty. A save without it (from before venue staff, or one no step had squared) loads with its open venues' crews at work, and its first step squares the desks as a new game's does.save_deltanow writes the rest of a delta save withserialize_without(&["units"])instead of lending the units out of the tower, since the marks read them.dispatch_waiting.rs(moved out ofdispatch.rs, which was at the 500-line limit) holdsElevatorDispatch::accumulate_waiting. It now keeps the last room's kind answer (rooms of one kind sit together) and finds a floor's slot by index throughDispatchFloors::slot(aslot_oftable built with the served floors) instead of a search. This pays for the extra riders many times over; see Complexity.crowd/seg_set.rs, the route search's seen-segment bitset, is on the named-flags allowlist (indexed by segment id). The crowd keeps one set between searches (Crowd::route_seen) and clears only the words it touched, so a search allocates nothing.free_maids_counted) instead of scanning the people again.Closes: n/a (no issue)
Type of change
Game mode impact
Kind::waits_for_staff(mode)readsvenue_staff_commute_in_personfrom the commute rules. Classic answers false everywhere, andclassic_shops_open_by_the_clockpins that. Classic saves carry neither mark.Quality gates
npm run typechecknpm run lintnpm testnpm run buildLocally on this base: the whole unit project (6,202 tests) and the whole integration project (1,614 tests) pass, plus typecheck and lint on the changed tests. CI runs the full set.
Engine:
cargo fmt --check,cargo clippy --all-targets -D warningswithtooling,conformance, andcargo test --features tooling,conformanceall pass. I regenerated the conformance lock,frame-days.json, the port-edit cases, the card-text parity record and the compat record (npm run engine:compat).The rule tests in
rule_tests/venue_staff.rsare:a_shop_opens_once_its_staff_ride_in: nobody comes before 6, the crew rides in from the lobby and is all in by 7, the shop is still shut then, and it is open at 10:30. Every minute it also checks that the shop is never open with nobody in.a_crew_is_called_in_four_hours_before_opening: the call-in hour for a shop, spa, restaurant, cinema and party hall, and a restaurant's crew staying through its afternoon break.the_staff_leave_through_the_lobby_after_closinga_shop_no_route_reaches_never_opensclassic_shops_open_by_the_clocka_reload_keeps_the_staff_at_worka_save_without_a_crowd_opens_with_its_staff_ina_bulldozed_shop_sends_its_staff_outa_reload_straight_after_a_bulldoze_keeps_the_crowd: a save taken between the bulldoze and the next step reloads to the same crowd, and one tick later still matches the game that saved.a_reload_after_a_shop_opens_mid_hour_keeps_its_crew_on_the_way: a shop finished at half past calls its whole crew in at once, and a save before they arrive reloads with nobody in and plays the next hour the same.a_reload_leaves_a_shop_whose_crew_never_got_in_empty: a shop no route reaches reloads empty and plays the next hour the same; with its desk row removed thevenueStaffmark alone keeps it empty, and without the mark (a save from before venue staff) its crew loads at work.no_venue_keeps_more_staff_than_an_office_holds: a save's desks are clamped to an office's head count (Cap office head counts read from a save #2230), so no crew may pass it.Versioning
.changesnote with the rightapp:andcrate:levels, or this PR changes no deployed pathpackages/verticopolis-engine/README.mdand/orengine-rs/CRATE_README.md, or read both and putreadmes: unchangedin the note, or this PR changes no engine sourceapp: minorandcrate: minor, because of the new public items and a new saved errand.readmes: unchanged.Complexity
ElevatorDispatch::accumulate_waitingruns each step over the room units. It was O(rooms × log floors) with a kind check per room; it is now O(rooms) with one array index per room and the kind check only when the kind changes.DispatchFloors::slot_ofis built once with the served floors (O(span)), alongside the table it already built.bfs_routeno longer allocates its seen set: the crowd keeps oneSegSetand each search clears only the words it set, O(segments touched).free_maids_countedreturns the free list and its count from one walk of the crowd, so the housekeeping pass no longer rescans the people.Crowd::book_commutesruns once per game hour, and again for venues only after a mid-hour edit or a venue finishing construction.reconcileruns each hour and on each tower edit. Both were O(rooms) over the offices and stay O(rooms), now matching venues in the same single pass.start_commutesruns each step and pops the shifts that are due.Unit::open_for_businessadds one byte compare tois_open_atwherever spawn and traffic read it.Kind::staffed_atruns per venue per hour and checks at most five hours.CrowdMarks::ofruns at save time only, one pass over the desks and the room units.staff_inis a field written from the desk, not a cache with its own invalidation.slot_oflives and dies withDispatchFloors.route_seenis scratch space, never saved and never read across searches.mainat a7cb8fe against this branch (the base differs from the latestmainonly in sprites and screenshots):mainmainat a7cb8fe, samples of someone waiting over half an hour went down 5.2% on split tower 26 and up 5.7% on split tower 24 and 6.0% on the maxed Modern tower (one seed on the maxed tower is +12%; without it, +4.0%). On the earlier base these were +3.0%, +5.0% and +3.5%. I tried two other call-in rules there: never calling a crew during the 7 to 10 AM rush (after it instead: +4.9%, +7.5%, +6.0%) and calling those crews at 6 AM before it (+8.4%, -0.6%, +1.5%). Plain four hours ahead was the simplest and best on the biggest tower. The owner's split tower fixture still has nobody above the lobby waiting 70 minutes (full_car_passes).Hot-path record (section 6): this comes with the review.
Screenshots / recordings
None. The screenshot scenes are Classic or before the venues open, and a Modern venue looks as it did: dark until it opens.
Notes for reviewers
venueStaff; the two reload tests above pin both. While testing it I found a save taken after building a venue but before the next step lost the venue booking on reload, sodesksStalenow also covers a venue crew the next step would call in. F2:SegSetis reused and cleared word by word. F3: free housekeepers are counted in one walk. F4: theclosed_carscomment says it is saved asclosedCars.main; I have not recounted them with the four-hour call-in. The rest were waiting on staff stuck in the Metro line under the basement express. Office workers already wait up to 4 or 5 hours in that line onmain, because the express runs full both ways in the rush: cars come down packed and leave the Metro packed.fxSequences: the Modern ransom run now ends on one detonation, on floor 42, and the fire-rescue run guts 17 rooms, as onmain. The services coverage list drops the inert cinema, housekeeping, parking floor, ramp, restaurant and shop that the old blast reached.load_stream_edit_testsstreams 153 of its 400 edited saves (the base saves gained desks and marks).portReadsandviewReaderread their towers later in the day, since a venue opens once its crew is in. The perf comparison's split tower still peaks at 23 people over a day, as onmain;docs/performance/ts-vs-wasm.mdsaid 27 and now says 23.mainat a500207 (after Write each unit and person straight to the save (stage 2 of faster local saves) #2323's direct save writer, My Towers: Open and Save As windows replace Saved Towers #2319's My Towers and Polish the service room sprites at 10 by 45 #2326).staff_inis not saved, on purpose. The desks are saved with the crowd, and a save without a crowd puts the crew in at load, so a reload opens the same venues.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ms7trYcRHkvnh6N2YZqqjw