Accepting a dispatch from a board cached before a map update no longer crashes - #137
Merged
Conversation
…n accept The dispatch board is cached into the save, so it outlives the world data the offers were built from. Accepting a job is the only step that resolves the pickup facility -- world.facility_approach_route -> facility_location -- and that raises KeyError for a facility a later update renamed or retired. Nothing caught it, so Enter on such a dispatch took the process down. Reproduced by caching a board, retiring one job's pickup facility, and accepting it: the board opens and reads correctly, and the crash lands only on Enter, which matches the report. DrivingState.from_snapshot already guards the same call, which is why resuming a saved trip degrades to the terminal instead of crashing. Two changes. The board is now rebuilt from the current world when any restored job names a pickup that is gone, so the unusable dispatch is never listed -- and the player still gets a full board rather than a short one. The accept path also refuses on its own, since a job detail screen opened before the rebuild still holds the old job; it clears the cached board and says what happened in plain language instead of raising. A sweep of 855 fresh dispatches across 57 cities accepts cleanly, so this is specific to boards restored from a save. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed and why
Reported against stable 1.8.6.1: the game closes when a player accepts a job
from the dispatch board. No log was available, so both candidate paths were
driven directly.
The dispatch board is cached into the save, so it outlives the world data
the offers were built from. Accepting a job is the only step that resolves
the pickup facility --
world.facility_approach_route->facility_location-- and that raisesKeyErrorfor a facility a laterupdate renamed or retired. Nothing caught it, so Enter on such a dispatch took
the process down:
The board opens and reads correctly first -- every line speaks, including the
job that will fail -- so the crash lands only on Enter. That matches the
report.
Two changes:
a pickup that is gone, so the unusable dispatch is never listed. Rebuilt
rather than filtered, so the player still gets a full board.
before the rebuild still holds the old job. It clears the cached board and
says what happened instead of raising.
What players will notice
Almost always nothing: after an update the first dispatch board they open is
simply built from the current world. A player who reaches a closed pickup
some other way now hears that the dispatch is no longer available and to open
the board again, instead of the game vanishing.
Tests run
uv run pytest-- 1410 passed.tests/test_stale_dispatch_board.pyis new and fails without the fix(verified by stashing the two source files: both cases fail, both pass with
them restored).
is what places this on restored boards specifically rather than on dispatch
acceptance generally.
career whose in-progress trip names a retired facility, both through
_world_entry_stateand through the Choose career menu.DrivingState.from_snapshotalready guards the same call, logs "Could notresume saved trip", and drops the player at the terminal. A stale
destination is also harmless -- only the origin is ever resolved.
Accessibility impact
One new spoken line, on the refusal path: "That dispatch is no longer
available. The board was put together before the last update and this pickup
has since closed. Go back to the terminal and open the dispatch board again
for the current loads." It plays the standard
ui/errorsound first. A testasserts the wording carries the two facts a player needs and contains no
maintainer jargon -- no "facility", "cache", "world data", or exception names.
Nothing else about menu navigation or the board's spoken content changed.
Changelog
## UnreleasedinCHANGELOG.md,written in plain player language and matching the style of the existing
entries.
includes
[skip changelog].