wire.ts
This file
Path
packages/project/src/lander/wire.ts
127 lines · 3.4 KiB · TypeScript
Last changed by
Merge build/comments-project into mainoscabrielbefore adoption49efd2a
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–92why, one step back1import { Remote } from "@repo/checks/check-runner/wire";2import { Verdict } from "@repo/protocol/domain/answer";3import {4 CommitSha,5 Handle,6 LandedSha,7 RepoName,8 RepoPath,9 RequestId,10 TreeSha,11} from "@repo/protocol/ids";12import { RepoBusy, StaleBase, VerifierBlocked } from "@repo/protocol/refusal";13import { ConfigBundle } from "@repo/rules/rules-evaluator";14import { Schema } from "effect";1516import type {17 BundleJob as BundleJobArgs,18 ComposeJob as ComposeJobArgs,19 Composed as ComposedResult,20 LandJob as LandJobArgs,21 Landed as LandedResult,22 Merged as MergedResult,23 MergeJob as MergeJobArgs,24} from "../lander.ts";25import { Change } from "../landing.ts";2627export { Remote } from "@repo/checks/check-runner/wire";2829export { ConfigBundle } from "@repo/rules/rules-evaluator";3031export const ComposedFile = Schema.Struct({32 content: Schema.String,33 path: RepoPath,34});3536export const MergeJob = Schema.Struct({37 base: CommitSha,38 fork: RepoName,39 head: CommitSha,40 main: LandedSha,41 repo: RepoName,42}) satisfies Schema.Codec<MergeJobArgs, unknown, unknown, unknown>;4344export const Merged = Schema.Struct({45 changes: Schema.Array(Change),46 tree: TreeSha,47}) satisfies Schema.Codec<MergedResult, unknown, unknown, unknown>;4849export const Rebuild = Schema.TaggedUnion({50 Compose: { files: Schema.NonEmptyArray(ComposedFile) },51 Existing: { commit: CommitSha },52 Merge: { base: CommitSha, fork: RepoName, head: CommitSha },53});5455export const LandJob = Schema.Struct({56 author: Handle,57 main: LandedSha,58 message: Schema.String,59 rebuild: Rebuild,60 repo: RepoName,61 requestId: RequestId,62 tree: TreeSha,63 verdict: Schema.OptionFromOptionalKey(Verdict),64}) satisfies Schema.Codec<LandJobArgs, unknown, unknown, unknown>;6566export const Landed = Schema.Struct({67 pending: Schema.Array(Schema.Literals(["mirror", "notes"])),68 sha: LandedSha,69}) satisfies Schema.Codec<LandedResult, unknown, unknown, unknown>;7071export const ComposeJob = Schema.Struct({72 files: Schema.NonEmptyArray(ComposedFile),73 main: LandedSha,74 repo: RepoName,75}) satisfies Schema.Codec<ComposeJobArgs, unknown, unknown, unknown>;7677export const Composed = Schema.Struct({78 commit: CommitSha,79 tree: TreeSha,80}) satisfies Schema.Codec<ComposedResult, unknown, unknown, unknown>;8182export const BundleJob = Schema.Struct({83 at: LandedSha,84 repo: RepoName,85}) satisfies Schema.Codec<BundleJobArgs, unknown, unknown, unknown>;8687export const MergeWire = Schema.Struct({88 fork: Remote,89 job: MergeJob,90 main: Remote,91});92Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 93why, one step back93/** The write token on canonical goes only to the trusted Lander, never to a Checker. */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 94–127why, one step back94export const LandWire = Schema.Struct({95 fork: Schema.optionalKey(Remote),96 job: LandJob,97 main: Remote,98});99100/** A compose: a write token on canonical, used only for a compose ref, never `main`. */101export const ComposeWire = Schema.Struct({ job: ComposeJob, main: Remote });102103export const BundleWire = Schema.Struct({ job: BundleJob, main: Remote });104105export const MergeExit = Schema.toCodecJson(106 Schema.Exit(107 Merged,108 Schema.Union([StaleBase, VerifierBlocked]),109 Schema.Defect()110 )111);112113export const LandExit = Schema.toCodecJson(114 Schema.Exit(115 Landed,116 Schema.Union([StaleBase, RepoBusy, VerifierBlocked]),117 Schema.Defect()118 )119);120121export const ComposeExit = Schema.toCodecJson(122 Schema.Exit(Composed, VerifierBlocked, Schema.Defect())123);124125export const BundleExit = Schema.toCodecJson(126 Schema.Exit(ConfigBundle, VerifierBlocked, Schema.Defect())127);