test(session): regression test for #26574 + mirror loosening on Vcs.FileDiff#26578
Merged
kitlangton merged 1 commit intodevfrom May 9, 2026
Merged
test(session): regression test for #26574 + mirror loosening on Vcs.FileDiff#26578kitlangton merged 1 commit intodevfrom
kitlangton merged 1 commit intodevfrom
Conversation
…leDiff - Adds a regression test that exercises the actual bug shape: a legacy/imported `session_diff` storage entry without a `patch` field. Pre-#26574 the typed encoder rejected the response and /session/<id>/diff returned 400. Test verifies red->green->red. - Mirrors the schema loosening on Vcs.FileDiff so any future /instance/vcs/diff producer that omits patch can't crash the same way. - Adds a comment on Snapshot.FileDiff.patch explaining why it's optional.
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.
Follow-up to #26574 (already merged).
What this adds
Regression test (
packages/opencode/test/server/session-diff-missing-patch.test.ts). fix(sessions): allow optional patch field in diff for migrated sessions #26574 shipped without a test; this exercises the actual bug shape:session_diffstorage entry with nopatchfield (mimics legacy/imported on-disk shape)Verified red → green → red → green locally before pushing.
Mirror schema loosening on `Vcs.FileDiff` (
packages/opencode/src/project/vcs.ts:231). Same shape (`file/patch/additions/deletions/status`), used by/instance/vcs/diff. Current producer always sets `patch`, but loosening matches `Snapshot.FileDiff` so any future producer that omits patch can't reintroduce the same crash on the sibling endpoint.Comment on `Snapshot.FileDiff.patch` explaining why it's optional, so the next reader doesn't tighten it back.
Why this matters
Same disease family as #26546, #26553, #26566, #26572: post-Hono-migration strict Schema validation rejects legitimate-looking on-disk data, the response 4xx's, and the client crashes (or is told nothing useful). The original PR fixed the symptom on one endpoint without nailing it down with a test or extending the fix to the sibling.
Test