verdict.ts
This file
Path
packages/gate/src/verdict.ts
45 lines · 1.3 KiB · TypeScript
Last changed by
Merge build/comments-packages-rest into mainoscabrielbefore adoption38cd503
History of this fileTake it
The walk stopped after 200 commits: lines older than 678c8b8 point at it.
Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8
lines 1–45why, one step back1import type {2 HeldBackResult,3 LaneResult,4 Verdict,5} from "@repo/protocol/domain/answer";6import type { Outcome, StageName } from "@repo/protocol/domain/outcome";7import type { CheckVersion, PatchId, TreeSha } from "@repo/protocol/ids";8import { NoAsk } from "@repo/protocol/refusal";9import { Option, Result } from "effect";10import type { DateTime } from "effect";1112import type { PushFacts } from "./facts.ts";1314export interface VerdictInput {15 readonly facts: PushFacts;16 readonly tree: TreeSha;17 readonly patchId: PatchId;18 readonly checkVersion: CheckVersion;19 readonly stage: StageName;20 readonly lanes: readonly LaneResult[];21 readonly heldBack: readonly HeldBackResult[];22 readonly outcome: Outcome;23 readonly now: DateTime.Utc;24}2526export const verdictOf = (input: VerdictInput): Result.Result<Verdict, NoAsk> =>27 Option.match(input.facts.ask, {28 onNone: () => Result.fail(new NoAsk({})),29 onSome: (ask) =>30 Result.succeed({31 ask: ask.id,32 at: input.now,33 base: input.facts.base,34 checkVersion: input.checkVersion,35 head: input.facts.head,36 heldBack: input.heldBack,37 lanes: input.lanes,38 outcome: input.outcome,39 patchId: input.patchId,40 project: ask.project,41 stage: input.stage,42 tree: input.tree,43 verifier: "platform" as const,44 }),45 });