fix(history): accept place ids when restoring a session - #21
Merged
Conversation
Opening a case with investigable places threw "the response is not the shape we expected" before the player could ask anything. The interrogation screen reads the history the moment it mounts, and the history's characterId only allowed a uuid or the literal victim — places carry an author-written local id, so every case holding one failed to parse and took the screen down with it. That is 17 of the 43 cases now in production. The comment above that union already warned about exactly this, having been written when the body was added as a second kind of subject. Adding a third did not reach it. Found on 十七回忌の客: two sessions, no messages, no model calls — it never got past the first read. Co-Authored-By: Claude <noreply@anthropic.com>
2 tasks
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.
Hotfix — production is broken for 17 of the 43 cases. Branched off
masterrather thandevelop, which is holding unreviewed work.What happens
Opening a case that has investigable places throws 「レスポンスの形が想定と違うよ〜」 before
the player can ask anything. Reported from a real play on 十七回忌の客.
The interrogation screen reads
GET /api/sessions/:id/historythe moment it mounts.sessionHistorySchema.histories[].characterIdallowed a uuid or the literalvictim—but places carry an author-written local id (
choba,garden), so the response fails toparse and the screen goes down with it. Two sessions on production show it exactly: zero
messages, zero model calls. It never got past the first read.
The fix
One union, widened to the three kinds of subject that exist, reusing
placeIdSchemafromdb/scenario-definition.tsso there is one definition rather than a copy.The comment above that union already described this failure — it was written when the body
became a second kind of subject. Adding a third did not reach it. The comment now says so,
and there are tests for all three plus a rejection.
Verification
The two production responses that were failing were replayed against the fixed schema and
both parse.
Test plan
bun run typecheck— cleanbun run lint— no errorsbun run test— 725 pass / 0 fail, including four new cases for the subject id unionAfter this
Needs back-merging into
developso the fix is not lost on the next release.