decision.ts
This file
Path
packages/protocol/src/domain/decision.ts
81 lines · 2.0 KiB · TypeScript
Last changed by
Merge build/comments-cli-protocol-checks into mainoscabrielbefore adoptionc86204f
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–81why, one step back1import { Schema } from "effect";23import {4 AskId,5 CommitSha,6 DecisionId,7 EnvKey,8 Handle,9 ProjectName,10 ProposalId,11 RatchetName,12} from "../ids.ts";13import { Posture } from "../posture.ts";14import { At, Evidence, Hostname, RefNameText } from "./common.ts";15import { LandingView } from "./landing.ts";1617export const DecisionSubject = Schema.TaggedUnion({18 Finish: { ask: AskId, head: CommitSha },19 OpenProposal: { proposal: ProposalId },20 PostureChange: { from: Posture, to: Posture },21 ProxyWidened: { hosts: Schema.Array(Hostname), item: EnvKey },22 RaiseRatchet: {23 after: Schema.Int,24 ask: AskId,25 before: Schema.Int,26 ratchet: RatchetName,27 territory: Schema.NonEmptyString,28 },29 SecretInTree: { ask: AskId, item: EnvKey },30 StrayPush: { after: CommitSha, before: CommitSha, ref: RefNameText },31 Vouch: { handle: Handle },32 Waiver: {33 ask: AskId,34 at: At,35 marker: Schema.NonEmptyString,36 reason: Schema.NonEmptyString,37 },38});3940export type DecisionSubject = typeof DecisionSubject.Type;4142export const Choice = Schema.Literals(["accept", "decline", "adopt", "revert"]);4344export type Choice = typeof Choice.Type;4546export const Decision = Schema.Struct({47 decided: Schema.optionalKey(48 Schema.Struct({49 at: Schema.DateTimeUtcFromString,50 by: Handle,51 choice: Choice,52 note: Schema.optionalKey(Schema.String),53 })54 ),55 deciders: Schema.NonEmptyArray(Handle),56 default: Choice,57 evidence: Schema.Array(Evidence),58 expiresAt: Schema.DateTimeUtcFromString,59 id: DecisionId,60 openedAt: Schema.DateTimeUtcFromString,61 project: ProjectName,62 subject: DecisionSubject,63});6465export type Decision = typeof Decision.Type;6667export const Today = Schema.Struct({68 budget: Schema.Struct({69 finishes: Schema.Int,70 total: Schema.Int,71 used: Schema.Int,72 }),73 decider: Handle,74 decisions: Schema.Array(Decision),75 expiringSoon: Schema.Array(DecisionId),76 newcomers: Schema.Array(Handle),77 overflow: Schema.Int,78 unattended: Schema.Array(LandingView),79});8081export type Today = typeof Today.Type;