Skip to content
Myr

Merge build/imported-from into main

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parents e3cfe48, 93641b3 · Browse files · 20 files+638 added−62 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

20 files+638 added−62 removed

  • tests:+307 added−3 removed
  • other:+331 added−59 removed

20 files+638 added−62 removed

modified:apps/cli/src/render.ts+21 added-3 removed
1 unmodified line
2 * The CLI's prose for the contracts' results: Markdown for an agent (and a3 * script), and plain text for a person where a table reads better padded.4 * A contract without a view here prints its encoded JSON in a fenced block.5 */6import { IMPORTED_NOTE } from "@repo/agent-kit/docs/imported-note";7import { Brand } from "@repo/brand";8import type { View } from "@repo/protocol/cli";9import {10 Claim,
14 unmodified lines
25import { LandReceipt } from "@repo/protocol/domain/answer";26import type { AnswerReceipt } from "@repo/protocol/domain/answer";27import { DecisionSubject } from "@repo/protocol/domain/decision";28import { Outcome } from "@repo/protocol/domain/outcome";28import type { PolicyPending, PublicPolicy } from "@repo/protocol/domain/policy";29import type {30 ImportSource,31 PolicyPending,32 PublicPolicy,33} from "@repo/protocol/domain/policy";34import { LedgerEntry } from "@repo/protocol/domain/visibility";35import type { Refusal } from "@repo/protocol/refusal";36import { receiptLine } from "@repo/protocol/render";37import { DateTime, Option, Result, Schema } from "effect";
404 unmodified lines
442 `Fix it by landing a change to ${Brand.configDir}/; it is evaluated again at every landing.`,443 ];444};445441const policy = viewOf(PolicyOf.successSchema, (read) => {446/** Where an imported project came from, and what a copy is (ADR 0031). */447const importedText = ({ branch, url }: ImportSource) =>448 prose(449 `Imported from ${url}${branch === undefined ? "" : ` (branch ${branch})`}: this project is ${IMPORTED_NOTE}.`450 );451452/** The policy's own view: evaluated, why not yet, or nothing landed. */453const policyText = (read: typeof PolicyOf.successSchema.Type): View => {454 if (read.policy !== undefined) {455 return evaluated(read.policy);456 }457
5 unmodified lines
463464 const lines = pendingText(read.unevaluated);465466 return { markdown: lines.join("\n\n"), text: lines.join("\n") };455});467};468469const policy = viewOf(PolicyOf.successSchema, (read) =>470 read.importedFrom === undefined471 ? policyText(read)472 : joined(importedText(read.importedFrom), policyText(read))473);474475const ledger = viewOf(LedgerOf.successSchema, (book) =>476 joined(477 prose(`${book.project}: ${book.postureLabel}.`),478 table(
104 unmodified lines
modified:apps/cli/test/policy-view.test.ts+32 added
179 unmodified lines
180 unanswered,181 Contracts.toLayerHandler("projectPolicy", () => Effect.succeed(success))182 );183184describe("policy's view of an imported project", () => {185 const imported = decodeSuccess({186 importedFrom: {187 branch: "master",188 url: "https://github.com/dtolnay/anyhow",189 },190 unevaluated: { at: sha, reason: "noConfig" },191 });192193 it("leads with where it came from and its branch, as a copy read-only here, then the policy", () => {194 const lines = linesOf(textOf(imported));195196 expect(lines[0]).toBe(197 "Imported from https://github.com/dtolnay/anyhow (branch master): this project is a copy of a public repo, read-only here and not run by its maintainers."198 );199 expect(200 lines.some((line) => line.includes("has not been evaluated"))201 ).toBeTruthy();202 });203204 it("names no branch when the import named none, and no source for a project that started empty", () => {205 expect(206 textOf(207 decodeSuccess({208 importedFrom: { url: "https://codeberg.org/dnkl/fuzzel" },209 })210 )211 ).toContain("Imported from https://codeberg.org/dnkl/fuzzel: this project");212 expect(textOf(noConfig)).not.toContain("Imported from");213 });214});215216describe("policy on the command line", () => {217 it.effect("prints the text view for a person", () =>218 Effect.gen(function* () {219 const run = yield* runProgram(["policy", "--project", "datekit"], {
26 unmodified lines
modified:apps/web/src/features/project/project-page.tsx+39 added-1 removed
6 unmodified lines
7 * from them. Props in, markup out: the route reads the asks, the ledger,8 * the events, the policy and the code on the server and keeps them live in9 * the browser, and hands them here.10 */11import { IMPORTED_NOTE } from "@repo/agent-kit/docs/imported-note";12import { Brand } from "@repo/brand";13import type { Ask, AskListing } from "@repo/protocol/domain/ask";14import type { FileView, TreeListing } from "@repo/protocol/domain/code";15import type { Glob } from "@repo/protocol/domain/common";16import type { ProjectListing } from "@repo/protocol/domain/front-page";17import type { LandingView } from "@repo/protocol/domain/landing";18import type { ImportSource } from "@repo/protocol/domain/policy";19import { LedgerEntry } from "@repo/protocol/domain/visibility";20import type { Ledger } from "@repo/protocol/domain/visibility";21import type { AreaName, AskId, Handle, ProjectName } from "@repo/protocol/ids";22import type { Posture } from "@repo/protocol/posture";
12 unmodified lines
35import { finaleOf, stillWaiting } from "../front/families.ts";36import { ledeOf } from "../front/head.ts";37import { ProposeLink } from "../propose/propose-link.tsx";38import type { AskProgress } from "../shared/ask-progress.ts";39import { LINK } from "../shared/classes.ts";40import { CommandLine } from "../shared/command.tsx";41import { EmptyState } from "../shared/empty.tsx";42import {43 FactBlock,
111 unmodified lines
155 /** What it holds back, from its ledger; none while it is read. */156 readonly heldBack?: readonly HeldBackArea[] | undefined;157 /** Who decides for which paths; none while the policy is read or when it has none. */158 readonly deciders?: readonly Deciders[] | undefined;159 /** Where it was imported from; none for a project that started empty, or while the policy is read. */160 readonly importedFrom?: ImportSource | undefined;161 readonly now: DateTime.Utc;162 readonly platformUrl: string;163 /** The root folder at main and its README, once read. */164 readonly code?: ProjectCode | undefined;
46 unmodified lines
211 </FactBlock>212 );213};214215/** Where an imported project came from: its source, the branch adopted, and what a copy is. */216const ImportedFrom = ({ source }: { readonly source: ImportSource }) => (217 <FactBlock label="Imported from">218 <p className="text-ui">219 <a220 className={`${LINK} [overflow-wrap:anywhere]`}221 href={source.url}222 rel="noreferrer"223 >224 {source.url}225 </a>226 {source.branch === undefined ? null : (227 <>228 {" "}229 · branch <MetaCode>{source.branch}</MetaCode>230 </>231 )}232 </p>233 <p className="text-ui text-muted-foreground">234 This project is {IMPORTED_NOTE}.235 </p>236 </FactBlock>237);238239/** The four commands that take part, in the order a newcomer runs them. */240const TakePart = ({241 platformUrl,242 project,
70 unmodified lines
313/** How a change lands here: the facts with nothing selected. */314const HowItLands = ({315 deciders,316 heldBack,317 importedFrom,318 landedAt,319 landings,320 listing,321 now,322 platformUrl,323 posture,324}: Pick<325 ProjectViewProps,296 "deciders" | "heldBack" | "landings" | "listing" | "now" | "platformUrl"326 | "deciders"327 | "heldBack"328 | "importedFrom"329 | "landings"330 | "listing"331 | "now"332 | "platformUrl"333> & {334 readonly posture: KnownPosture | undefined;335 readonly landedAt: DateTime.Utc | undefined;336}) => (
9 unmodified lines
346 )}347 <GateFacts />348 <WhoDecides deciders={deciders} project={listing.project} />349 {heldBack === undefined ? null : <HeldBackFacts areas={heldBack} />}350 {importedFrom === undefined ? null : <ImportedFrom source={importedFrom} />}351 <TakePart platformUrl={platformUrl} project={listing.project} />352 <RecentLandings353 landedAt={landedAt}354 landings={landings}
134 unmodified lines
489 return (490 <HowItLands491 deciders={props.deciders}492 heldBack={props.heldBack}493 importedFrom={props.importedFrom}494 landedAt={landedAt}495 landings={props.landings}496 listing={listing}497 now={props.now}
148 unmodified lines
modified:apps/web/src/routes/$project/index.tsx+5 added-2 removed
186 unmodified lines
187 data.code,188 (read) => read189 );190191 const deciders = valueOr(191 const policyRead = valueOr(192 useAtomValue(projectPolicyAtom(project)),193 data.policy,194 (read) => read195 )?.policy?.deciders;195 );196197 const deciders = policyRead?.policy?.deciders;198199 const reads = useMemo(200 () => new Map(events === undefined ? [] : [[project, events]]),201 [events, project]202 );
8 unmodified lines
211 asks={asks}212 code={code}213 deciders={deciders}214 heldBack={ledger === undefined ? undefined : heldBackOf(ledger)}215 importedFrom={policyRead?.importedFrom}216 landings={landings}217 lastLanded={latest?.landedAt}218 listing={homeListing({ asks, ledger, project })}219 now={data.now}
96 unmodified lines
modified:apps/web/src/server/project-page.ts+3 added-9 removed
modified:apps/web/test/project.test.tsx+33 added
391 unmodified lines
392 })393 );394395 it.effect(396 "names where an imported project came from, with its branch, as a copy read-only here; and nothing for one that started empty",397 () =>398 Effect.gen(function* () {399 const facts = inspectorOf(400 yield* page({401 importedFrom: {402 branch: "master",403 url: "https://github.com/dtolnay/anyhow",404 },405 })406 );407408 const text = textIn(facts);409410 expect(411 missingFrom(text, [412 "Imported from",413 "https://github.com/dtolnay/anyhow",414 "branch master",415 "This project is a copy of a public repo, read-only here and not run by its maintainers.",416 ])417 ).toStrictEqual([]);418 expect(facts).toMatch(419 /<a[^>]*href="https:\/\/github\.com\/dtolnay\/anyhow"[^>]*rel="noreferrer"/u420 );421 expect(textIn(inspectorOf(yield* page()))).not.toContain(422 "Imported from"423 );424 })425 );426427 it.effect(428 "gives the four commands that take part, numbered, and the last three landings as one-line credits",429 () =>430 Effect.gen(function* () {431 const facts = inspectorOf(yield* page());
217 unmodified lines
649 asks={data.asks}650 code={data.code}651 deciders={data.policy?.policy?.deciders}652 heldBack={data.ledger === undefined ? undefined : heldBackOf(data.ledger)}653 importedFrom={data.policy?.importedFrom}654 landings={recentLandings(events)}655 lastLanded={latest?.landedAt}656 listing={homeListing({657 asks: data.asks,
250 unmodified lines
added:docs/adr/0031-an-import-keeps-its-source-and-a-repeat-by-the-initializer-converges.md+21 added
added:packages/agent-kit/src/docs/imported-note.ts+7 added
modified:packages/agent-kit/src/docs/reference.ts+2 added-1 removed
16 unmodified lines
17import type { CommandDoc } from "../command-doc.ts";18import { events, gitHere, landing, refusals } from "../llms-sections.ts";19import { exitCodeSection } from "../refusals.ts";20import { code, table } from "../text.ts";21import { IMPORTED_NOTE } from "./imported-note.ts";22import { importedProjects } from "./imported.ts";23import type { DocSource } from "./page.ts";24import { withoutHeading } from "./page.ts";25
66 unmodified lines
92};9394export const importedPage: DocSource = {95 body: () => [95 "These projects are copies of public repos, imported so you can read code you know on the platform. Each is read-only here and is not run by its maintainers; its history, with its authors, came with it, and why each line is there reads as before adoption. Each stays under its own licence.",96 `These projects were imported so you can read code you know on the platform. Each is ${IMPORTED_NOTE}; its history, with its authors, came with it, and why each line is there reads as before adoption. Each stays under its own licence.`,97 "",98 ...table(99 ["Project", "Source", "Licence", "What it is"],100 importedProjects.map(({ kind, licence, project, url }) => [
10 unmodified lines
modified:packages/config/test/import-examples.test.ts+107 added
546 unmodified lines
547 (yield* platform.calls).filter((call) => /ky|anyhow/u.test(call))548 ).toStrictEqual(["ls-remote anyhow", "tags anyhow"]);549 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))550 );551552 it.live(553 "--sources asks initProject again for each import the ledger records, listed or not, and never for a listed project it doesn't",554 () =>555 Effect.gen(function* () {556 const fs = yield* FileSystem.FileSystem;557 const path = yield* Path.Path;558559 const dir = yield* fs.makeTempDirectoryScoped({ prefix: "importing-" });560561 const ledgerFile = path.join(dir, "created.jsonl");562563 // An earlier run imported anyhow and gum; the platform lists anyhow564 // and ky (someone else's project), and gum not yet.565 const platform = yield* fakePlatform(["anyhow", "ky"]);566567 yield* fs.writeFileString(568 ledgerFile,569 ["anyhow", "gum"]570 .map(571 (name) =>572 `${JSON.stringify({ at: "2026-10-08T20:00:00.000Z", by: "import", kind: "project", name, stage: "dev-oscabriel" })}\n`573 )574 .join("")575 );576577 const printed: string[] = [];578579 yield* importExamples(580 onDev("--only", "gum", "--sources"),581 () => platform.layer582 ).pipe(583 Effect.provideService(LedgerFile, ledgerFile),584 Effect.provideService(Console.Console, {585 ...console,586 log: (...args: readonly unknown[]) => {587 printed.push(args.map(String).join(" "));588 },589 })590 );591592 yield* importExamples(onDev("--sources"), () => platform.layer).pipe(593 Effect.provideService(LedgerFile, ledgerFile),594 Effect.provideService(Console.Console, {595 ...console,596 log: () => {},597 })598 );599600 expect(601 (yield* platform.calls).filter((call) => /gum|anyhow|ky/u.test(call))602 ).toStrictEqual([603 "init gum main",604 "init anyhow master",605 "init gum main",606 ]);607 expect(printed).toStrictEqual([608 "import-examples on dev-oscabriel (https://platform.test): 0 to import, 1 listed already",609 " skip gum: imported already, as the ledger records",610 " gum: source kept: https://github.com/charmbracelet/gum (main)",611 "imported 0 of 0, each recorded in infra/created.jsonl as a kept import",612 ]);613 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))614 );615616 it.live(617 "--sources --dry-run prints each source it would keep, and keeps none",618 () =>619 Effect.gen(function* () {620 const platform = yield* fakePlatform(["anyhow"]);621622 const { ledger, printed } = yield* ran(623 onDev("--only", "anyhow", "--sources", "--dry-run"),624 platform.layer625 );626627 expect({628 calls: yield* platform.calls,629 ledger,630 printed: printed.filter((line) => line.includes("source")),631 }).toStrictEqual({632 calls: ["listProjects"],633 ledger: [],634 printed: [],635 });636 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))637 );638639 it.live(640 "--sources in the Node world goes over every example listed, with no ledger",641 () =>642 Effect.gen(function* () {643 const platform = yield* fakePlatform(["anyhow", "ky"]);644645 const { printed } = yield* ran(646 ["--world", "node", "--sources", "--dry-run"],647 platform.layer648 );649650 expect(printed.filter((line) => line.includes("source"))).toStrictEqual(651 [652 " would keep the source of anyhow: https://github.com/dtolnay/anyhow (master)",653 " would keep the source of ky: https://github.com/sindresorhus/ky (main)",654 ]655 );656 }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))657 );658});659660/** A call the platform never answered, as an edge timeout leaves it. */661class NoAnswer extends Data.TaggedError("NoAnswer")<{
72 unmodified lines
modified:packages/project/src/project-store/rows.ts+5 added-1 removed
1 unmodified line
2import { AgentTrailer } from "@repo/protocol/domain/credit";3import { Decision } from "@repo/protocol/domain/decision";4import { ProjectEvent } from "@repo/protocol/domain/event";5import { LandingView } from "@repo/protocol/domain/landing";6import { ImportSource } from "@repo/protocol/domain/policy";7import { Proposal } from "@repo/protocol/domain/proposal";8import { LedgerEntry } from "@repo/protocol/domain/visibility";9import {10 AreaName,
17 unmodified lines
28// service does, with the lifecycles' own schemas.2930/**31 * A project: whether it waits for its initializer's first push or is live,31 * the SHA the platform last landed, and the policy cached for one landed SHA.32 * the SHA the platform last landed, the policy cached for one landed SHA,33 * and where it was imported from, when it was.34 */35export const ProjectRow = Schema.Struct({36 createdAt: Schema.DateTimeUtcFromString,37 /** The public repo it was imported from; absent for a project that started empty. */38 importedFrom: Schema.optionalKey(ImportSource),39 initializer: Handle,40 landed: Schema.optionalKey(LandedSha),41 /** The encoded `Policy` evaluated at `policyAt`. */42 policy: Schema.optionalKey(Schema.Json),
212 unmodified lines
modified:packages/project/src/project.ts+111 added-11 removed
113 unmodified lines
114import type { AskKind } from "@repo/protocol/domain/kind";115import { LandingView } from "@repo/protocol/domain/landing";116import { Outcome } from "@repo/protocol/domain/outcome";117import type { StageName } from "@repo/protocol/domain/outcome";118import type { PublicPolicy } from "@repo/protocol/domain/policy";118import type { ImportSource, PublicPolicy } from "@repo/protocol/domain/policy";119import { Policy } from "@repo/protocol/domain/policy";120import type { Proposal } from "@repo/protocol/domain/proposal";121import {122 AskId,
1279 unmodified lines
1402 Match.whenOr("check", "territory", () => true),1403 Match.exhaustive1404 );14051406/** Whether two import sources name the same repo and branch (ADR 0031). */1407const sameSource = (a: ImportSource, b: ImportSource) =>1408 a.url === b.url && a.branch === b.branch;14091410/** An optional field as an object to spread: the field when present, nothing when not. */1411const field = <K extends string, A>(1412 key: K,1413 value: Option.Option<A>
1195 unmodified lines
2609 */2610 const policyStatus: Effect.Effect<PolicyStatus> = Effect.gen(function* () {2611 const h = yield* hydrate;26122613 // Where the project came from, when it was imported (ADR 0031).2614 const origin = field(2615 "importedFrom",2616 Option.flatMapNullishOr(h.project, (row) => row.importedFrom)2617 );26182619 if (Option.isSome(h.policy)) {2610 return { policy: publicPolicy(h.policy.value) };2620 return { ...origin, policy: publicPolicy(h.policy.value) };2621 }26222623 const landed = Option.flatMapNullishOr(h.project, (row) => row.landed);26242625 if (Option.isNone(landed)) {2616 return {};2626 return origin;2627 }26282629 const at = landed.value;26302631 return {2632 ...origin,2633 unevaluated: {2634 at,2635 reason: (yield* hasConfigAt(at))2636 ? ("configFailed" as const)
1196 unmodified lines
3833 now3834 );3835 };38363826 const initBody =3827 (3828 caller: Person,3829 input: {3830 readonly import?: { readonly branch?: string; readonly url: string };3837 /**3838 * The project's adoption, the one landing with no parent: in the3839 * snapshot's newest landings, else found by walking back from the last3840 * landed SHA through each landing's parent.3841 */3842 const adoptionOf = (h: Hydrated, row: ProjectRow) =>3843 Effect.gen(function* () {3844 const kept = h.landings.find(({ parent }) => parent === undefined);38453846 if (kept !== undefined || row.landed === undefined) {3847 return Option.fromNullishOr(kept);3848 }38493850 let at = Option.some<CommitSha>(row.landed);38513852 while (Option.isSome(at)) {3853 const found = yield* store.landing(at.value);38543855 if (Option.isNone(found)) {3856 return Option.none<LandingView>();3857 }38583859 if (found.value.parent === undefined) {3860 return found;3861 }38623863 at = Option.some<CommitSha>(found.value.parent);3864 }38653866 return Option.none<LandingView>();3867 });38683869 /**3870 * An import asked again by its initializer converges (ADR 0031): with3871 * the source the row keeps, it answers as the first call did; for a row3872 * that keeps no source yet, the source is written first. Only an3873 * import's row takes one: its adoption landed in the call that made it,3874 * so the adoption's `landedAt` is the row's `createdAt`, where a first3875 * push lands later. Any other repeat is `ProjectExists`, as before.3876 */3877 const keepSource = (3878 caller: Person,3879 from: ImportSource,3880 row: ProjectRow,3881 h: Hydrated,3882 writes: Writes3832 ) =>3883 ) =>3884 Effect.gen(function* () {3885 const exists = new ProjectExists({ project: name });38863887 if (3888 row.landed === undefined ||3889 !sameHandle(row.initializer, caller.handle)3890 ) {3891 return yield* exists;3892 }38933894 const answer = {3895 landed: row.landed,3896 project: name,3897 remote: `${yield* GatewayUrl}/${name}.git`,3898 };38993900 if (row.importedFrom !== undefined) {3901 return sameSource(row.importedFrom, from) ? answer : yield* exists;3902 }39033904 const adoption = yield* adoptionOf(h, row);39053906 if (3907 Option.isNone(adoption) ||3908 DateTime.toEpochMillis(adoption.value.landedAt) !==3909 DateTime.toEpochMillis(row.createdAt)3910 ) {3911 return yield* exists;3912 }39133914 writes.project.set("row", { ...row, importedFrom: from });39153916 return answer;3917 });39183919 const initBody =3920 (caller: Person, input: { readonly import?: ImportSource }) =>3921 (h: Hydrated, writes: Writes, now: DateTime.Utc) =>3922 Effect.gen(function* () {3923 if (Option.isSome(h.project)) {3836 return yield* new ProjectExists({ project: name });3924 return input.import === undefined3925 ? yield* new ProjectExists({ project: name })3926 : yield* keepSource(3927 caller,3928 input.import,3929 h.project.value,3930 h,3931 writes3932 );3933 }39343935 const remote = `${yield* GatewayUrl}/${name}.git`;3936
19 unmodified lines
39563957 landAdoption(writes, caller.handle, landed, now);3958 writes.project.set(3959 "row",3864 yield* withPolicyAt({ ...made, landed, state: "live" }, landed, now)3960 yield* withPolicyAt(3961 { ...made, importedFrom: input.import, landed, state: "live" },3962 landed,3963 now3964 )3965 );39663967 return { landed, project: name, remote };3968 });
1994 unmodified lines
modified:packages/project/test/import.test.ts+117 added-3 removed
6 unmodified lines
7import { describe, expect, it } from "@effect/vitest";8import { RefName, RepoHost } from "@repo/artifacts/repo-host";9import { memoryFs } from "@repo/artifacts/repo-host/memory-fs";10import { ProjectEvent } from "@repo/protocol/domain/event";11import { LandedSha, RepoName } from "@repo/protocol/ids";11import { Handle, LandedSha, RepoName } from "@repo/protocol/ids";12import { Person } from "@repo/protocol/principal";13import { ProjectExists } from "@repo/protocol/refusal";14import { advanceTo } from "@repo/testkit/clock";15import { gitClient } from "@repo/testkit/git-client";16import { aProject } from "@repo/testkit/scenarios";17import { DateTime, Effect, Exit, Option, Ref } from "effect";17import { DateTime, Effect, Exit, Option, Ref, Struct } from "effect";1819import { ProjectStore } from "../src/project-store.ts";20import { projectService } from "../src/project.ts";21import { worldOf } from "./world.ts";
5 unmodified lines
27const repo = RepoName.make(project);2829const alice = Person.make({ handle: scenario.initializer });3031const bob = Person.make({ handle: Handle.make("bob") });3233const mainRef = RefName.make("refs/heads/main");3435/**36 * The project's row as an import written before sources were kept left it37 * (ADR 0031): the same row without `importedFrom`.38 */39const forgetSource = ProjectStore.use((store) =>40 Effect.flatMap(store.load(), ({ project: row }) =>41 Option.match(row, {42 onNone: () => Effect.void,43 onSome: (kept) =>44 store.commit({ project: Struct.omit(kept, ["importedFrom"]) }),45 })46 )47);4849const masterRef = RefName.make("refs/heads/master");5051/**52 * A public remote `upstream` whose only branch is `master`, as anyhow's
141 unmodified lines
194 ]);195 }).pipe(Effect.provide(worldOf(scenario, "memory")))196 );197182 it.effect("still answers ProjectExists for a project that exists", () =>198 it.effect(199 "keeps where it came from on its row, and projectPolicy names it",200 () =>201 Effect.gen(function* () {202 yield* advanceTo("2026-10-08T12:00:00Z");203204 const { url } = yield* upstreamOnMaster;205 const api = yield* projectService(project);206207 yield* api.initProject(alice, { import: { branch: "master", url } });208209 const snapshot = yield* ProjectStore.use((store) => store.load());210211 expect(212 Option.map(snapshot.project, (row) => row.importedFrom)213 ).toStrictEqual(Option.some({ branch: "master", url }));214 expect((yield* api.policy()).importedFrom).toStrictEqual({215 branch: "master",216 url,217 });218 }).pipe(Effect.provide(worldOf(scenario, "memory")))219 );220221 it.effect(222 "answers a repeat with the same source as the first call did, and ProjectExists for another source",223 () =>224 Effect.gen(function* () {225 yield* advanceTo("2026-10-08T12:00:00Z");226227 const { tip, url } = yield* upstreamOnMaster;228 const api = yield* projectService(project);229230 const made = yield* api.initProject(alice, { import: { url } });231 const again = yield* api.initProject(alice, { import: { url } });232233 expect(again).toStrictEqual(made);234 expect(made.landed).toStrictEqual(LandedSha.make(tip));235 expect(236 yield* Effect.flip(237 api.initProject(alice, {238 import: { url: "https://example.com/other.git" },239 })240 )241 ).toStrictEqual(new ProjectExists({ project }));242 }).pipe(Effect.provide(worldOf(scenario, "memory")))243 );244245 it.effect(246 "sets the source on a repeat by the initializer for an import adopted before sources were kept, hearing no second landing",247 () =>248 Effect.gen(function* () {249 yield* advanceTo("2026-10-08T12:00:00Z");250251 const { tip, url } = yield* upstreamOnMaster;252 const api = yield* projectService(project);253254 yield* api.initProject(alice, { import: { url } });255 yield* forgetSource;256257 const retried = yield* api.initProject(alice, { import: { url } });258 const snapshot = yield* ProjectStore.use((store) => store.load());259260 expect(retried.landed).toStrictEqual(LandedSha.make(tip));261 expect(262 Option.map(snapshot.project, (row) => row.importedFrom)263 ).toStrictEqual(Option.some({ url }));264 expect(265 (yield* api.events(0, 10)).map(({ event }) => event._tag)266 ).toStrictEqual(["Landed"]);267 }).pipe(Effect.provide(worldOf(scenario, "memory")))268 );269270 it.effect("refuses a source from anyone but the initializer", () =>271 Effect.gen(function* () {272 yield* advanceTo("2026-10-08T12:00:00Z");273274 const { url } = yield* upstreamOnMaster;275 const api = yield* projectService(project);276277 yield* api.initProject(alice, { import: { url } });278 yield* forgetSource;279280 expect(281 yield* Effect.flip(api.initProject(bob, { import: { url } }))282 ).toStrictEqual(new ProjectExists({ project }));283 }).pipe(Effect.provide(worldOf(scenario, "memory")))284 );285286 it.effect("refuses a source for a project that started empty", () =>287 Effect.gen(function* () {288 yield* advanceTo("2026-10-08T12:00:00Z");289290 const { url } = yield* upstreamOnMaster;291 const api = yield* projectService(project);292 const client = yield* gitClient(memoryFs());293294 const first = yield* client.commit("Start", [["README.md", "# start\n"]]);295296 yield* api.initProject(alice, {});297 yield* (yield* RepoHost)298 .push(repo, client.source, [299 { from: Option.none(), ref: mainRef, to: first },300 ])301 .pipe(Effect.orDie);302 yield* advanceTo("2026-10-08T12:01:00Z");303 yield* api.recordFirstPush(alice, first);304305 expect(306 yield* Effect.flip(api.initProject(alice, { import: { url } }))307 ).toStrictEqual(new ProjectExists({ project }));308 }).pipe(Effect.provide(worldOf(scenario, "memory")))309 );
31 unmodified lines
modified:packages/project/test/project-store.contract.ts+18 added
686 unmodified lines
687 expect(yield* loaded).toStrictEqual(empty);688 }).pipe(Effect.provide(layer))689 );690691 it.effect("keeps an import's source with its row", () =>692 Effect.gen(function* () {693 const store = yield* ProjectStore;694695 const imported = {696 ...project,697 importedFrom: {698 branch: "master",699 url: "https://github.com/dtolnay/anyhow",700 },701 } satisfies (typeof ProjectRow)["Encoded"];702703 yield* store.commit({ project: decoded(ProjectRow, imported) });704705 expect((yield* loaded).project).toStrictEqual(imported);706 }).pipe(Effect.provide(layer))707 );708709 it.effect("keeps a claim's pinned suite with its row", () =>710 Effect.gen(function* () {711 const store = yield* ProjectStore;712
42 unmodified lines
modified:packages/protocol/src/domain/policy.ts+14 added
119 unmodified lines
120121export type PublicPolicy = typeof PublicPolicy.Type;122123/**124 * Where an imported project came from: the public repo's https address,125 * and the branch its `main` was adopted from when the import named one.126 * The same shape `initProject` takes, kept on the project's record and127 * shown on its page (ADR 0031). It lives beside the policy, whose read128 * names it: a module of its own would cost the root's preloaded bytes.129 */130export const ImportSource = Schema.Struct({131 branch: Schema.optionalKey(Schema.NonEmptyString),132 url: Schema.String.check(Schema.isPattern(/^https:\/\/\S+$/u)),133});134135export type ImportSource = typeof ImportSource.Type;136137/**138 * Why a project's policy has not evaluated at its landed commit, derived at139 * each read and never stored.140 */141export const PolicyPending = Schema.Struct({
86 unmodified lines
modified:packages/protocol/src/contracts.ts+5 added-8 removed
36 unmodified lines
37import { EnvSchemaView } from "./domain/env.ts";38import { ProjectEvent } from "./domain/event.ts";39import { FrontPageEntry, ProjectListing } from "./domain/front-page.ts";40import { LandingView } from "./domain/landing.ts";41import { PolicyPending, PublicPolicy } from "./domain/policy.ts";41import { ImportSource, PolicyPending, PublicPolicy } from "./domain/policy.ts";42import { DraftNote, Proposal } from "./domain/proposal.ts";43import { CreditSummary } from "./domain/record.ts";44import { Ledger } from "./domain/visibility.ts";45import {
515 unmodified lines
561export class PolicyOf extends Rpc.make("projectPolicy", {562 error: UnknownProject,563 payload: { project: ProjectName },564 success: Schema.Struct({565 /** Where the project was imported from; absent for one that started empty. */566 importedFrom: Schema.optionalKey(ImportSource),567 /** Absent while the config folder at the landed commit has not evaluated. */568 policy: Schema.optionalKey(PublicPolicy),569 /**570 * Why there is no policy at the landed commit: no config folder, or one
4 unmodified lines
575 }),576})577 .annotate(578 Description,577 "Show a project's evaluated config folder at its landed commit: who decides which paths, its vouches, caps, budget and claim timing."579 "Show a project's evaluated config folder at its landed commit: who decides which paths, its vouches, caps, budget and claim timing; for an import, its source."580 )581 .annotate(Audience, "public")582 .annotate(Visibility, "public")583 .annotate(ReadOnly, true)
30 unmodified lines
614export class InitProject extends Rpc.make("initProject", {615 error: Schema.Union([ProjectExists, ImportFailed]),616 payload: {617 /** A public repo to import, instead of starting empty. */616 import: Schema.optionalKey(617 Schema.Struct({618 branch: Schema.optionalKey(Schema.NonEmptyString),619 url: Schema.String.check(Schema.isPattern(/^https:\/\/\S+$/u)),620 })621 ),618 import: Schema.optionalKey(ImportSource),619 project: ProjectName,620 },621 success: Schema.Struct({622 /** Absent until the first push to an empty project. */
529 unmodified lines
modified:scripts/lib/import/run.ts+86 added-20 removed
64 unmodified lines
65 /** Print the plan, import and record nothing. */66 readonly dryRun: boolean;67 /** Backfill the tags of an import that has none. */68 readonly tags: boolean;69 /** Keep the source of each earlier import on its record (ADR 0031). */70 readonly sources: boolean;71 /** Warm the examples the platform lists already, as well as each new import. */72 readonly warm: boolean;73 /** The web's origin to warm through, when the stage's own can't be known. */74 readonly web: Option.Option<string>;
93 unmodified lines
168 );169 });170171const USAGE =170 "bun scripts/import-examples.ts --world node | --stage <dev-…> [--url <origin>] [--web <origin>] [--only <project>] [--tags] [--warm] [--dry-run]";172 "bun scripts/import-examples.ts --world node | --stage <dev-…> [--url <origin>] [--web <origin>] [--only <project>] [--tags] [--sources] [--warm] [--dry-run]";173174/** The flags the command takes; any other is a typo, refused. */175const FLAGS = new Set([176 "--dry-run",177 "--only",178 "--sources",179 "--stage",180 "--tags",181 "--url",182 "--warm",
80 unmodified lines
263264 return {265 dryRun: argv.includes("--dry-run"),266 only,267 sources: argv.includes("--sources"),268 tags,269 warm: argv.includes("--warm"),270 web: Option.map(flagValue(argv, "--web"), (web) =>271 web.replace(/\/+$/u, "")
87 unmodified lines
359 : ` warm ${project}: no web to read through`360 );361 });362363/**364 * The projects the ledger records as imports on `stage`: an import the365 * platform does not list (one adopted before adoptions were heard) is366 * still this stage's, never imported again.367 */368const recordedImports = (stage: Option.Option<Stage>) =>369 Effect.gen(function* () {370 if (Option.isNone(stage)) {371 return new Set<ProjectName>();372 }373374 const ledger = yield* readLedger.pipe(375 Effect.mapError((error) =>376 failed(`the ledger (${ledgerPath}): ${error.message}`)377 )378 );379380 const imported = ledger.filter(({ by }) => by === "import");381382 return new Set(383 examples.flatMap(({ project }) =>384 isRecorded(imported, {385 kind: "project",386 name: project,387 stage: stage.value,388 })389 ? [project]390 : []391 )392 );393 });394395/**396 * `--sources` on one earlier import: `initProject` asked again with the397 * same source, which the platform takes as the source to keep (ADR 0031)398 * and answers as the import did; a refusal is printed, never fatal.399 */400const sourceOne = (example: ImportExample) =>401 Effect.gen(function* () {402 const target = yield* ImportTarget;403404 const outcome = yield* target.initProject(example).pipe(405 Effect.map(() => `source kept: ${example.url} (${example.branch})`),406 Effect.catch(({ reason }) => Effect.succeed(`source not kept: ${reason}`))407 );408409 yield* Console.log(` ${example.project}: ${outcome}`);410 });411412/** The run itself, over a target, a backfill and a web. */413const run = (options: ImportOptions) =>414 Effect.gen(function* () {415 const target = yield* ImportTarget;416 const listed = yield* target.listProjects;417 const stage = stageOfWhere(options.where);418 const recorded = yield* recordedImports(stage);419 const known = new Set([...listed, ...recorded]);420421 const asked = planImports(examples, new Set(), options.only);367 const plan = planImports(examples, listed, options.only);368 const skipped = asked.filter(({ project }) => listed.has(project));422 const plan = planImports(examples, known, options.only);423 const skipped = asked.filter(({ project }) => known.has(project));424425 // The earlier imports `--tags` and `--sources` go back over: on a426 // stage, those the ledger records; in the Node world, every one listed.427 const earlier = skipped.filter(428 ({ project }) => Option.isNone(stage) || recorded.has(project)429 );430431 yield* Console.log(432 `import-examples on ${target.label}: ${plan.length} to import, ${skipped.length} listed already`433 );434 yield* Effect.forEach(435 skipped,375 ({ project }) => Console.log(` skip ${project}: listed already`),436 ({ project }) =>437 Console.log(438 listed.has(project)439 ? ` skip ${project}: listed already`440 : ` skip ${project}: imported already, as the ledger records`441 ),442 { discard: true }443 );444445 if (options.dryRun) {
2 unmodified lines
448 ({ branch, project, url }) =>449 Console.log(` would import ${project} from ${url} (${branch})`),450 { discard: true }451 );452453 if (options.sources) {454 yield* Effect.forEach(455 earlier,456 ({ branch, project, url }) =>457 Console.log(458 ` would keep the source of ${project}: ${url} (${branch})`459 ),460 { discard: true }461 );462 }463464 yield* Console.log("dry run: nothing imported, nothing recorded");465466 return;467 }
30 unmodified lines
498499 // An import from an earlier run that this run skipped is backfilled500 // too, if the ledger holds it as an import of this stage.501 if (options.tags && Option.isSome(stage)) {424 const ledger = yield* readLedger.pipe(425 Effect.mapError((error) =>426 failed(`the ledger (${ledgerPath}): ${error.message}`)427 )428 );429430 const imported = ledger.filter(({ by }) => by === "import");431432 const earlier = skipped.filter(({ project }) =>433 isRecorded(imported, {434 kind: "project",435 name: project,436 stage: stage.value,437 })438 );439502 yield* Effect.forEach(503 earlier,504 (example) =>505 Effect.flatMap(target.counts(example.project), ({ tags }) =>
2 unmodified lines
508 { discard: true }509 );510 }511512 if (options.sources) {513 yield* Effect.forEach(earlier, sourceOne, { discard: true });514 }515516 if (options.warm) {517 yield* Effect.forEach(skipped, ({ project }) => warmOne(project), {518 discard: true,519 });
25 unmodified lines
modified:scripts/import-examples.ts+7 added-2 removed
21 unmodified lines
22 * `--tags` backfills `refs/tags/*` for an import whose repo serves none:23 * the source's tags fetched into a temporary bare repo, then pushed to the24 * canonical repo with a write token minted over Artifacts' REST API for at25 * most ten minutes and revoked after, even on failure. It is the one write26 * that skips the gateway: tags only, by the operator, never `main`. The27 * core is `lib/import/`.26 * that skips the gateway: tags only, by the operator, never `main`.27 *28 * `--sources` keeps the source of each earlier import on its record: the29 * same `initProject` asked again by the operator, which the platform30 * answers as the import did and takes as the source to keep (ADR 0031).31 * A project the ledger records as this stage's import is never imported32 * again, even when the platform does not list it. The core is `lib/import/`.33 */34import { BunRuntime, BunServices } from "@effect/platform-bun";35import { Effect, Layer, Option, Stdio } from "effect";36
38 unmodified lines
modified:AGENTS.md+1 added-1 removed
17 unmodified lines
18| 4 | **One schema, many surfaces.** Change `packages/protocol`; every surface derives from it. Projections live only in `apps/*/src/surfaces.ts`. The CLI's command list is `commandDocs` in `@repo/agent-kit`, which the platform's skill, the CLI's MCP prompt and the web's `llms.txt` all read. | `apps/cli/test/commands-doc.test.ts` (the command list against the real CLI's commands, flags and positionals, `policy`, `ask draft` and `proposal` included); `packages/protocol/test/mcp.test.ts` (every MCP tool's schemas, with no JSON Schema leak, the policy and drafting contracts included; the five capped code reads are tools, `showCommit` and `listPaths` are not); `apps/web/test/agents.test.tsx` (every snippet, command, endpoint, limit and refusal on the For agents page is `@repo/agent-kit`'s or the union's); `packages/agent-kit/test/docs.test.ts` and `apps/web/test/docs.test.tsx` (the `/docs` pages name only the CLI's commands with flags each takes and link only to pages that exist, the reference lists every command, refusal, event, MCP tool and imported project from its source, and the web draws each page and its Markdown from that one text); `apps/web/test/llms.test.ts` (`/` and `/<project>` asked for Markdown answer with the `llms.txt` texts, and their HTML names that Markdown as an alternate); `packages/agent-kit/test/full-llms.test.ts` (one `ProjectEvent` line per tag); `apps/platform/test/home.test.ts` (the platform's `/` in Markdown is the web's `llms.txt`, one text from `@repo/agent-kit`); per-package `allowedUnstableApis` with `unstableApiUsage` at error |19| 5 | **The name lives only in `packages/brand`.** Internal packages use `@repo/*`. DO classes, Workflows, queues and databases carry job names. | `brand:check` (`scripts/brand.ts`, tested by `packages/brand/test/leaks.test.ts`) |20| 6 | **Pure core, thin hosts.** Only `@repo/artifacts` calls Artifacts. Each beta dependency sits behind one job-named port with a `/memory` adapter in the owning package. Apps import packages only. Worker code stays free of `node:child_process`, `@effect/platform-bun` and OpenTUI. `rules` and `gate` run in both Workers and Bun. `alchemy/*` stays in `infra/`. No module-level mutable state in a package's `src/`. | Scoped `allowedUnstableApis`; `packages/artifacts/test/repo-host-contract.ts` (one RepoHost contract every adapter passes); `apps/platform/test/bindings.test.ts` and `apps/platform/test/worker-init.test.ts` (the Worker starts on its real adapters, composed in `apps/platform/src/ports.ts`); `apps/platform/test/router-build.test.ts` (both handlers are built when the Worker module loads, with no binding touched, and a layer that awaits a promise while it is built is refused there); `apps/web/test/production-bundle.test.ts` (no dev-world module in the web's production build, and no chunk every page preloads holds the Markdown renderer, under a gzip ceiling); `packages/config/test/cartridge.test.ts` (the visibility cartridge is plugged in by one marked line and reached by nothing else, so removing it is a deletion); `packages/drafting/test/memory.test.ts` (the `Drafter` port's `/memory` adapter, `packages/drafting/src/drafter/memory.ts`) and `packages/drafting/test/binding.test.ts` (its Workers AI adapter over the `AI` binding); `packages/project/test/code-store.test.ts` (the `CodeStore` port's `/memory` adapter, `packages/project/src/code-store/memory.ts`, and its R2 adapter over `CODE_CACHE`, whose failures are misses, never the read's); `apps/platform/test/code-reads.test.ts` and `apps/web/test/dev-backend.test.ts` (the platform and the web's dev world answer the code reads and raw files alike, both through `@repo/project/code`); `packages/project/test/standing-posture.test.ts` (one helper, `withStandingPosture`, gives a listing each project's own posture, for the platform and the web's dev world alike, through the `StandingPostures` port whose default keeps nothing; its D1 adapter is the platform's); `apps/web/test/seeded.test.tsx` (a loader's read seeds a registry of its own page and leaves the registry every request shares as it was); `apps/web/test/shell.test.tsx` (no plain anchor between the web's pages: every link is the router's). No fence: import direction and module-level state |21| 7 | **Deny by default for visibility.** Land the answer's tree, never the composed tree. Nothing from a layer enters a public tree. Snapshot before held-back files are written. Public-serving Workers have no private-namespace binding. Public commits, trailers, notes and errors name public paths only. | `PrivatePathInPublicTree`, one rule for the gate's stage 1 and the landing guard (`packages/gate/test/shape.test.ts`, `packages/visibility/test/guards.test.ts`); `apps/platform/test/visibility/layer-gateway.test.ts` (only a layer's readers clone it, every read is logged, a fork push cannot carry its paths); `apps/sandbox/test/held-back.test.ts` (egress off and the snapshot taken before any sealed file is written; one bit per area, no output); `apps/platform/test/visibility/held-back.test.ts` (the `Held-back:` trailer, the landing guards, no stored value in a note or a kept log); `apps/platform/test/bindings.test.ts`; `apps/sandbox/test/checker.test.ts` (no snapshot once the held-back slot is reached); `apps/web/test/env.test-d.ts` (the web's Env has no private-namespace, Artifacts or `CODE_CACHE` binding) and `apps/platform/test/env.test-d.ts` (only the platform's has both); `packages/project/test/code-raw.test.ts` and `apps/platform/test/raw.test.ts` (raw bytes under `nosniff` and the sandboxing CSP, refusals included); `apps/platform/test/code-reads.test.ts` (no code read's payload names a repo); `packages/project/test/code-history.test.ts` (the code store is keyed under the project's canonical repo alone and holds no landing); `apps/platform/test/w9-contracts.test.ts` (`projectPolicy` answers without the policy's layers or asks, and `packages/config/test/cartridge.test.ts` keeps the cartridge removable); `packages/drafting/test/prompt.test.ts` (a draft's prompt never carries a layer's name, repo, reason or paths); `apps/web/test/markdown.test.tsx` (a README's script, handlers, unsafe URLs, iframes, styles and forms never reach the page); `apps/platform/test/gateway.test.ts` and `packages/gate/test/parse.test.ts` (a fork takes branches only: its notes, tags and the platform's refs are refused); `apps/platform/test/visibility/posture-listing.test.ts` and `apps/platform/test/home.test.ts` (the project list and the platform's `/` show the posture the project's ledger shows); `apps/web/test/landing.test.tsx` (the landing at `/` draws only the public project list, each project with the posture its listing gives); `apps/web/test/ledger.test.tsx` (the ledger page adds no path, check name or file name) and `apps/web/test/env.test.tsx` (the env page shows no value and no control to set or read one); `apps/platform/test/pages.test.ts` (the sign-in page, as an MCP client's consent, escapes every value a client supplies) |22| 8 | **Deterministic and idempotent.** Rule evaluation sees frozen time and randomness and only injected facts. Re-running an operation converges. Check results are keyed by (tree SHA, check version), push events deduped by (repo, sha), and land requests carry a `requestId`. | `globalDate`, `globalRandom`, `globalTimers` and `cryptoRandomUUID` at error, with their in-Effect twins; `packages/rules/test/replay.test.ts`; `packages/project/test/project-store.contract.ts`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts`; `apps/platform/test/workflows/answer.test.ts`; `apps/platform/test/workflows/on-push.test.ts`; `apps/platform/test/core-loop.test.ts`; `apps/platform/test/workflows/draft.test.ts` (a replayed draft round asks the model nothing more, and each round is its own instance); `packages/project/test/code.test.ts` (code reads cached by object id, only once finished, while `main` resolves every time, and a commit's diff kept by its SHA without its landing); `packages/project/test/drafting.model.test.ts` (a settle of a stale round changes nothing); `packages/project/test/import.test.ts` (a retried import adopts the repo it made); `packages/project/test/code-history.test.ts` (a why and a path's history are kept by commit, path hash and algorithm version, and the store, a step from a kept ancestor and a whole walk agree); `packages/config/test/smoke-loop.test.ts` (smoke's throwaway project is in the ledger before init makes it, and a taken name stops before anything is made); `apps/web/test/events.test.ts` (the web's fold of a project's events gives the same map when an event is heard twice or out of order, and a replay that already holds a landing stamps nothing); `packages/project/test/standing-posture.test.ts` (a kept posture is read again only for the project whose event the projection applied, or once its instant has come). No fence: one push deduped by (repo, sha) across the gateway's record and OnPush's |22| 8 | **Deterministic and idempotent.** Rule evaluation sees frozen time and randomness and only injected facts. Re-running an operation converges. Check results are keyed by (tree SHA, check version), push events deduped by (repo, sha), and land requests carry a `requestId`. | `globalDate`, `globalRandom`, `globalTimers` and `cryptoRandomUUID` at error, with their in-Effect twins; `packages/rules/test/replay.test.ts`; `packages/project/test/project-store.contract.ts`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts`; `apps/platform/test/workflows/answer.test.ts`; `apps/platform/test/workflows/on-push.test.ts`; `apps/platform/test/core-loop.test.ts`; `apps/platform/test/workflows/draft.test.ts` (a replayed draft round asks the model nothing more, and each round is its own instance); `packages/project/test/code.test.ts` (code reads cached by object id, only once finished, while `main` resolves every time, and a commit's diff kept by its SHA without its landing); `packages/project/test/drafting.model.test.ts` (a settle of a stale round changes nothing); `packages/project/test/import.test.ts` (a retried import adopts the repo it made, and a retried import keeps its source); `packages/project/test/code-history.test.ts` (a why and a path's history are kept by commit, path hash and algorithm version, and the store, a step from a kept ancestor and a whole walk agree); `packages/config/test/smoke-loop.test.ts` (smoke's throwaway project is in the ledger before init makes it, and a taken name stops before anything is made); `apps/web/test/events.test.ts` (the web's fold of a project's events gives the same map when an event is heard twice or out of order, and a replay that already holds a landing stamps nothing); `packages/project/test/standing-posture.test.ts` (a kept posture is read again only for the project whose event the projection applied, or once its instant has come). No fence: one push deduped by (repo, sha) across the gateway's record and OnPush's |23| 9 | **Effect v4 only.** Read `node_modules/effect/src` as API truth. Off limits: `effect/unstable/*`, v3 `@effect/platform` and `@effect/cli`, and `effect/workflow` or `effect/cluster` on Workers. | `outdatedApi`; `no-restricted-imports` |24| 10 | **Escapes need a reason.** Every `oxlint-disable`, `@effect-diagnostics` or `@ts-expect-error` carries its reason after `--`, and is added only where no idiomatic code does the job. | `check` fails on an unused directive. No fence: the reason |25| 11 | **`bun run verify` is the authority.** Deploy only to an explicit stage, after `verify`, with smoke after. A red gate is fixed, never deployed around. | `packages/config/test/verify.test.ts` (verify's steps); `infra/deploy.ts` refuses without a known stage, runs `verify` first and `scripts/smoke.ts` after (`packages/config/test/deploy.test.ts`, `packages/config/test/smoke.test.ts`), and refuses every deploy while `infra/.recording` is there (`packages/config/test/recording.test.ts`) |26| 12 | **Lifecycles are pure transitions.** `transition(state, command, now)`. Per DO call: hydrate, transition, persist, settle. Deadlines run on DO alarms. Call them lifecycles. | `globalTimers` and `globalTimersInEffect`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts` (model tests over effect/Arbitrary histories, each seen catching its planted bug); `packages/project/test/drafting.model.test.ts` (a proposal's `DraftCommand.DraftStarted` and `DraftSettled` over generated histories; a Ready round's files survive a later failed round); `apps/platform/test/project-do.test.ts`. No fence: `Effect.sleep` and `Effect.delay` in `packages/project/src` |
122 unmodified lines
modified:GLOSSARY.md+4 added
78 unmodified lines
79**Landed SHA**:80The commit the platform itself last landed on main; the only commit a project's rules are read from.81_Avoid_: HEAD, tip of main8283**Import**:84A project adopted from a public repo: a read-only copy, not run by its maintainers, whose first `main` is the source branch's tip. The source, its address and branch, stays on the project's record and is shown as where it was imported from.85_Avoid_: mirror, fork (of the source), sync8687**Outcome**:88Where an offered answer stands: Checking, Landed, WaitingOnParent, AwaitingFinish, AwaitingDecision or Refused; only Refused carries refusals, and waiting is not a refusal.89_Avoid_: result, build state, CI status90
133 unmodified lines