fix(session): loosen remaining stored numeric schemas to tolerate legacy data (#26622)

This commit is contained in:
Kit Langton
2026-05-09 22:10:48 -04:00
committed by GitHub
parent c6e6bdf59f
commit 29250a0efb
5 changed files with 13 additions and 13 deletions
+4 -4
View File
@@ -234,8 +234,8 @@ export const FileDiff = Schema.Struct({
// populates patch, but loosening matches the sibling schema so a // populates patch, but loosening matches the sibling schema so a
// future code path that omits it can't crash /instance/vcs/diff. // future code path that omits it can't crash /instance/vcs/diff.
patch: Schema.optional(Schema.String), patch: Schema.optional(Schema.String),
additions: NonNegativeInt, additions: Schema.Finite,
deletions: NonNegativeInt, deletions: Schema.Finite,
status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])), status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])),
}) })
.annotate({ identifier: "VcsFileDiff" }) .annotate({ identifier: "VcsFileDiff" })
@@ -244,8 +244,8 @@ export type FileDiff = Schema.Schema.Type<typeof FileDiff>
export const FileStatus = Schema.Struct({ export const FileStatus = Schema.Struct({
file: Schema.String, file: Schema.String,
additions: NonNegativeInt, additions: Schema.Finite,
deletions: NonNegativeInt, deletions: Schema.Finite,
status: Schema.Literals(["added", "deleted", "modified"]), status: Schema.Literals(["added", "deleted", "modified"]),
}) })
.annotate({ identifier: "VcsFileStatus" }) .annotate({ identifier: "VcsFileStatus" })
+2 -2
View File
@@ -143,8 +143,8 @@ export type ReasoningPart = Types.DeepMutable<Schema.Schema.Type<typeof Reasonin
const filePartSourceBase = { const filePartSourceBase = {
text: Schema.Struct({ text: Schema.Struct({
value: Schema.String, value: Schema.String,
start: NonNegativeInt, start: Schema.Finite,
end: NonNegativeInt, end: Schema.Finite,
}).annotate({ identifier: "FilePartSourceText" }), }).annotate({ identifier: "FilePartSourceText" }),
} }
+3 -3
View File
@@ -142,9 +142,9 @@ function sessionPath(worktree: string, cwd: string) {
} }
const Summary = Schema.Struct({ const Summary = Schema.Struct({
additions: NonNegativeInt, additions: Schema.Finite,
deletions: NonNegativeInt, deletions: Schema.Finite,
files: NonNegativeInt, files: Schema.Finite,
diffs: optionalOmitUndefined(Schema.Array(Snapshot.FileDiff)), diffs: optionalOmitUndefined(Schema.Array(Snapshot.FileDiff)),
}) })
+2 -2
View File
@@ -25,8 +25,8 @@ export const FileDiff = Schema.Struct({
// session response and broke session loading on Desktop. // session response and broke session loading on Desktop.
file: Schema.optional(Schema.String), file: Schema.optional(Schema.String),
patch: Schema.optional(Schema.String), patch: Schema.optional(Schema.String),
additions: NonNegativeInt, additions: Schema.Finite,
deletions: NonNegativeInt, deletions: Schema.Finite,
status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])), status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])),
}) })
.annotate({ identifier: "SnapshotFileDiff" }) .annotate({ identifier: "SnapshotFileDiff" })
+2 -2
View File
@@ -305,7 +305,7 @@ export namespace Tool {
export const RetryError = Schema.Struct({ export const RetryError = Schema.Struct({
message: Schema.String, message: Schema.String,
statusCode: NonNegativeInt.pipe(Schema.optional), statusCode: Schema.Finite.pipe(Schema.optional),
isRetryable: Schema.Boolean, isRetryable: Schema.Boolean,
responseHeaders: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional), responseHeaders: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),
responseBody: Schema.String.pipe(Schema.optional), responseBody: Schema.String.pipe(Schema.optional),
@@ -320,7 +320,7 @@ export const Retried = EventV2.define({
aggregate: "sessionID", aggregate: "sessionID",
schema: { schema: {
...Base, ...Base,
attempt: NonNegativeInt, attempt: Schema.Finite,
error: RetryError, error: RetryError,
}, },
}) })