Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packages/loopover-contract/src/api-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,16 +344,28 @@ export const linkedIssueContextSchema = z
})
.strict();

export const branchEligibilitySchema = z
/**
* The FIELDS a caller may send, before the route's normalisation runs (#9773).
*
* Exported separately because `branchEligibilitySchema` is a pipe (it transforms), so its members are not
* reachable through it -- and the stdio CLI needs exactly those members to validate `--branch-eligibility`
* and `--branch-eligibility-source` against the route's own vocabulary instead of restating both lists.
*/
export const branchEligibilityFields = z
.object({
status: z.enum(["eligible", "ineligible", "unknown"]),
source: z.enum(["github_metadata", "local_metadata", "registry", "user_supplied"]).optional(),
reason: z.string().max(MAX_LOCAL_BRANCH_TEXT_CHARS).optional(),
checkedAt: z.string().max(MAX_LOCAL_BRANCH_REF_CHARS).optional(),
stale: z.boolean().optional(),
})
.strict()
.transform((value) => ({ ...value, status: value.status === "eligible" ? ("unknown" as const) : value.status, source: "user_supplied" as const }));
.strict();

export const branchEligibilitySchema = branchEligibilityFields.transform((value) => ({
...value,
status: value.status === "eligible" ? ("unknown" as const) : value.status,
source: "user_supplied" as const,
}));

export const focusManifestInputSchema = z
.record(z.string(), z.unknown())
Expand Down
Loading