lander.ts
This file
Path
packages/project/src/lander.ts
117 lines · 3.2 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–24why, one step back1import { RefName } from "@repo/artifacts/repo-host";2import { Brand } from "@repo/brand";3import type { Change } from "@repo/git/tree-diff";4import type { Verdict } from "@repo/protocol/domain/answer";5import type {6 CommitSha,7 Handle,8 LandedSha,9 RepoName,10 RepoPath,11 RequestId,12 TreeSha,13} from "@repo/protocol/ids";14import type {15 RepoBusy,16 StaleBase,17 VerifierBlocked,18} from "@repo/protocol/refusal";19import type { ConfigBundle } from "@repo/rules/rules-evaluator";20import { Context, Data } from "effect";21import type { Array, Effect, Option } from "effect";2223export type { Change } from "@repo/git/tree-diff";24Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 25why, one step back25/** Moves only after `main` did, in its own push, and only to the commit `main` points at. */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 26–27why, one step back26export const landedRef = RefName.make(`${Brand.refsPrefix}landed`);27Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 28why, one step back28/** Where a composed commit waits for a Checker to fetch it by id; never `main`. */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 29–41why, one step back29export const composeRef = (tree: TreeSha) =>30 RefName.make(`${Brand.refsPrefix}compose/${tree}`);3132export interface MergeJob {33 readonly repo: RepoName;34 readonly main: LandedSha;35 readonly base: CommitSha;36 readonly head: CommitSha;37 readonly fork: RepoName;38}3940export interface Merged {41 readonly tree: TreeSha;Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 42why, one step back42 /** Against its base, not main's. */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 43–64why, one step back43 readonly changes: readonly Change[];44}4546export interface ComposedFile {47 readonly path: RepoPath;48 readonly content: string;49}5051export type Rebuild = Data.TaggedEnum<{52 Merge: {53 readonly fork: RepoName;54 readonly base: CommitSha;55 readonly head: CommitSha;56 };57 Compose: { readonly files: Array.NonEmptyReadonlyArray<ComposedFile> };58 Existing: { readonly commit: CommitSha };59}>;6061export const Rebuild = Data.taggedEnum<Rebuild>();6263export interface LandJob {64 readonly repo: RepoName;Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 65why, one step back65 /** The push's compare-and-swap: a moved `main` makes the land `StaleBase`. */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 66–68why, one step back66 readonly main: LandedSha;67 readonly tree: TreeSha;68 readonly author: Handle;Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 69why, one step back69 /** Its `Request-Id` trailer lets a second land of the same request find the first one's commit. */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 70–77why, one step back70 readonly message: string;71 readonly requestId: RequestId;72 readonly rebuild: Rebuild;73 readonly verdict: Option.Option<Verdict>;74}7576export type Bookkeeping = "mirror" | "notes";77Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 78why, one step back78/** A pending item never fails the landing; the outbox lands it again later. */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 79–105why, one step back79export interface Landed {80 readonly sha: LandedSha;81 readonly pending: readonly Bookkeeping[];82}8384export interface ComposeJob {85 readonly repo: RepoName;86 readonly main: LandedSha;87 readonly files: Array.NonEmptyReadonlyArray<ComposedFile>;88}8990export interface Composed {91 readonly tree: TreeSha;92 readonly commit: CommitSha;93}9495export interface BundleJob {96 readonly repo: RepoName;97 readonly at: LandedSha;98}99100export class Lander extends Context.Service<101 Lander,102 {103 readonly merge: (104 job: MergeJob105 ) => Effect.Effect<Merged, StaleBase | VerifierBlocked>;Merge build/comments-project into mainoscabrielbefore adoption49efd2a
line 106why, one step back106 /** A non-force compare-and-swap push; a second land of the same request returns the first one's commit. */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 107–117why, one step back107 readonly land: (108 job: LandJob109 ) => Effect.Effect<Landed, StaleBase | RepoBusy | VerifierBlocked>;110 readonly compose: (111 job: ComposeJob112 ) => Effect.Effect<Composed, VerifierBlocked>;113 readonly bundleRules: (114 job: BundleJob115 ) => Effect.Effect<ConfigBundle, VerifierBlocked>;116 }117>()("project/Lander") {}