Address final recovery review items

This commit is contained in:
Dotta committed 2026-05-09 22:54:04 -05:00
1 parent 9210dbcce8
commit d930a28694
3 files changed
+22 -14

No files matched your search

@@ -85,6 +85,20 @@ describe("issue validators", () => {
).toBe(false);
});
it("rejects recovery outcomes that are not supported by the source-scoped resolution endpoint", () => {
expect(
resolveIssueRecoveryActionSchema.safeParse({
outcome: "delegated",
}).success,
).toBe(false);
expect(
resolveIssueRecoveryActionSchema.safeParse({
outcome: "escalated",
}).success,
).toBe(false);
});
it("normalizes escaped line breaks in issue comment bodies", () => {
const parsed = addIssueCommentSchema.parse({
body: "Progress update\\r\\n\\r\\nNext action.",
+8 -10
View File
@@ -202,21 +202,19 @@ export const issueRecoveryActionReadModelSchema = z.object({
export type IssueRecoveryActionReadModel = z.infer<typeof issueRecoveryActionReadModelSchema>;
const RESOLVE_ISSUE_RECOVERY_ACTION_OUTCOMES = [
"restored",
"false_positive",
"blocked",
"cancelled",
] as const;
export const resolveIssueRecoveryActionSchema = z.object({
actionId: z.string().uuid().optional(),
outcome: z.enum(ISSUE_RECOVERY_ACTION_OUTCOMES),
outcome: z.enum(RESOLVE_ISSUE_RECOVERY_ACTION_OUTCOMES),
sourceIssueStatus: z.enum(["done", "in_review", "blocked"]).optional().nullable(),
resolutionNote: multilineTextSchema.optional().nullable(),
}).strict().superRefine((value, ctx) => {
if (value.outcome === "delegated" || value.outcome === "escalated") {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: "This recovery outcome is not supported by the source-scoped resolution endpoint",
path: ["outcome"],
});
return;
}
if (value.outcome === "restored") {
if (value.sourceIssueStatus !== "done" && value.sourceIssueStatus !== "in_review") {
ctx.addIssue({
-4
View File
@@ -1547,8 +1547,6 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })
function strandedRecoveryActionFingerprint(input: {
issue: typeof issues.$inferSelect;
recoveryCause: StrandedRecoveryCause;
latestRun: LatestIssueRun;
successfulRunHandoffEvidence?: SuccessfulRunHandoffRecoveryEvidence | null;
}) {
return [
"source_scoped_recovery",
@@ -1606,8 +1604,6 @@ export function recoveryService(db: Db, deps: { enqueueWakeup: RecoveryWakeup })
fingerprint: strandedRecoveryActionFingerprint({
issue: input.issue,
recoveryCause,
latestRun: input.latestRun,
successfulRunHandoffEvidence: input.successfulRunHandoffEvidence,
}),
evidence: buildStrandedRecoveryActionEvidence({
issue: input.issue,