test(session): regression test for #26574 + mirror loosening on Vcs.FileDiff (#26578)

Co-authored-by: Developer <temp@example.com>
This commit is contained in:
Kit Langton
2026-05-09 16:30:31 -04:00
committed by GitHub
parent 480aa8b23b
commit 805af011c9
3 changed files with 86 additions and 1 deletions

View File

@@ -230,7 +230,10 @@ export type Info = Schema.Schema.Type<typeof Info>
export const FileDiff = Schema.Struct({
file: Schema.String,
patch: Schema.String,
// Mirrors Snapshot.FileDiff (see #26574). The current producer always
// populates patch, but loosening matches the sibling schema so a
// future code path that omits it can't crash /instance/vcs/diff.
patch: Schema.optional(Schema.String),
additions: NonNegativeInt,
deletions: NonNegativeInt,
status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])),

View File

@@ -21,6 +21,9 @@ export type Patch = typeof Patch.Type
export const FileDiff = Schema.Struct({
file: Schema.String,
// Optional because legacy/imported `summary_diffs` on disk may omit
// the patch text (see #26574). Required-Schema rejected the whole
// /session/<id>/diff response and broke session loading on Desktop.
patch: Schema.optional(Schema.String),
additions: NonNegativeInt,
deletions: NonNegativeInt,