One keepLanding hears every landing kept in the project service; a quiet project is listed, its first push heard once
Before adoption: this commit came in with the history the project adopted, so no landing records it.
From review: the adoption, an opening and a bookkeeping landing share keepLanding, so a landing kept and not heard cannot be written again. The front page over D1 lists a project only made and first pushed; a first push recorded twice is heard once. GLOSSARY names the adoption a landing, and the Landed line no longer calls it the first event.
authored by oscabriel · committed by oscabriel · parent 6bf50e8 · Browse files · 7 files·+98 added−29 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+98 added−29 removed
- tests:+64 added−3 removed
- other:+34 added−26 removed
Provenance
- Commit
4165fa3- Tree
79fd13a- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
6bf50e8
7 files changed+98 added−29 removed
modified:apps/platform/test/front-page.test.ts+28 added
168 unmodified lines169 /** A client of the contracts over HTTP at `/rpc`, as anyone. */170 readonly anyone: Client["Service"];171 /** bob's answer to `parse-iso` landed, as his claim, push and submission make it. */172 readonly landAnswer: Effect.Effect<void>;173+ /** quietkit made and first pushed, and nothing else: no ask, no policy evaluated. */174+ readonly makeQuiet: Effect.Effect<void>;175 }176 177 const frontPageWorld: Effect.Effect<FrontPageWorld, never, Scope.Scope> =178 Effect.gen(function* () {82 unmodified lines261 forget: Effect.sync(() => {262 calls.length = 0;263 }),264 landAnswer,265+ makeQuiet: seeded(aProject({ name: "quietkit" })).pipe(266+ Effect.provideContext(ports)267+ ),268 };269 });270 271 describe("the project list and credits over the platform's /rpc", () => {272 it.effect(273+ "lists a project that was only made and first pushed, its adoption the one event it has",274+ () =>275+ Effect.gen(function* () {276+ yield* advanceTo(noon);277+278+ const world = yield* frontPageWorld;279+280+ yield* world.makeQuiet;281+282+ const { projects } = yield* world.anyone.listProjects({});283+284+ expect(285+ projects.find(({ project: listed }) => listed === "quietkit")286+ ).toStrictEqual({287+ landedAt: at(noon),288+ openAsks: 0,289+ posture: "open",290+ project: "quietkit",291+ });292+ }).pipe(Effect.scoped)293+ );294+295+ it.effect(296 "after a landing, lists the project from D1, asking it only its posture and only once, and its people's credits without calling a project",297 () =>298 Effect.gen(function* () {299 yield* advanceTo(noon);42 unmodified linesmodified:packages/agent-kit/src/llms-sections.ts+1 added-1 removed
119 unmodified linesExpand all12012112212312412412512612712815 unmodified lines119 unmodified linesExpand all Claimed: "Someone claimed an ask.", Decided: "A decider took a decision.", Judged: "An answer was checked, with the outcome its verdict holds.", Landed: "A landing reached `main`; the first is the project's adopted `main`, from its first push or its import.", "A landing reached `main`, a project's adoption (its first push or its import) among them.", Lapsed: "A claim lapsed: no push for too long.", LedgerAppended: "The project's public ledger gained an entry.", ProposalDrafted: "A proposal's draft settled: ready for a decider, or failed.",15 unmodified linesmodified:packages/agent-kit/test/golden/full-llms.txt+1 added-1 removed
159 unmodified lines160 - `AskOpened`: A new ask opened.161 - `Claimed`: Someone claimed an ask.162 - `Decided`: A decider took a decision.163 - `Judged`: An answer was checked, with the outcome its verdict holds.164-- `Landed`: A landing reached `main`; the first is the project's adopted `main`, from its first push or its import.164+- `Landed`: A landing reached `main`, a project's adoption (its first push or its import) among them.165 - `Lapsed`: A claim lapsed: no push for too long.166 - `LedgerAppended`: The project's public ledger gained an entry.167 - `ProposalDrafted`: A proposal's draft settled: ready for a decider, or failed.168 - `ProposalOpened`: A proposal opened.26 unmodified linesmodified:packages/project/src/project.ts+32 added-24 removed
1174 unmodified lines1175 writes.ratchets.size,1176 ].every((count) => count === 0);1177 1178 /** A row's key in its table, as the store keys it. */1179+/**1180+ * Keeps `landing` and hears it as `Landed`: every landing that moves main1181+ * is heard, so a watcher and the front page see it (a project's row is1182+ * written on its first event).1183+ */1184+const keepLanding = (1185+ writes: Writes,1186+ landing: LandingView,1187+ now: DateTime.Utc1188+) => {1189+ writes.landings.push(landing);1190+ writes.events.push(ProjectEventInput.Landed({ at: now, landing }));1191+};1192+1193 const keyIn = <A>(table: Table<A>, row: A) => {1194 const columns = table.columns(row);1195 1196 return JSON.stringify(table.key.map((name) => columns[name]));1541 unmodified lines2738 };2739 2740 const moved = yield* withPolicyAt({ ...row, landed: sha }, sha, now);2741 2728- writes.landings.push(view);2729- writes.events.push(2730- ProjectEventInput.Landed({ at: now, landing: view })2731- );2742+ keepLanding(writes, view, now);2743 writes.project.set("row", moved);2744 });2745 2746 /**1050 unmodified lines3797 // ------------------------------------------------------------ writes3798 3799 /**3800 * The first adoption as a landing: the initializer's first push, or an3790- * import's tip. It answers no ask and has no parent; its row lets3791- * `landing` (and so OnPush) know the commit as the platform's own.3801+ * import's tip. It answers no ask, has no parent and credits no one;3802+ * its row lets `landing` (and so OnPush) know the commit as the3803+ * platform's own, and its event lists the project on the front page3804+ * even when no policy evaluates and nothing else happens in it.3805 */3793- /**3794- * The project's first landing, its adopted `main`: kept, and heard as3795- * every landing is, so the front page lists the project even when no3796- * policy evaluates and nothing else happens in it. It credits no one.3797- */3806 const landAdoption = (3807 writes: Writes,3808 author: Handle,3809 sha: LandedSha,3810 now: DateTime.Utc3811 ) => {3804- const landing: LandingView = {3805- assisted: [],3806- author,3807- credits: [],3808- landedAt: now,3809- project: name,3810- sha,3811- };3812-3813- writes.landings.push(landing);3814- writes.events.push(ProjectEventInput.Landed({ at: now, landing }));3812+ keepLanding(3813+ writes,3814+ {3815+ assisted: [],3816+ author,3817+ credits: [],3818+ landedAt: now,3819+ project: name,3820+ sha,3821+ },3822+ now3823+ );3824 };3825 3826 const initBody =3827 (611 unmodified lines4439 requestId: landed.requestId,4440 sha: landed.sha,4441 };4442 4434- writes.landings.push(landing);4443 // Heard as every landing is (main moved), so a list of landings4444 // shows the opening; it answers no ask, so it credits nothing.4437- writes.events.push(ProjectEventInput.Landed({ at: now, landing }));4445+ keepLanding(writes, landing, now);4446 writes.project.set(4447 "row",4448 yield* withPolicyAt({ ...row, landed: landed.sha }, landed.sha, now)4449 );1413 unmodified linesmodified:packages/project/test/import.test.ts+32 added-1 removed
1 /**2 * A project adopted from a public repo, whatever its default branch, and3 * adopted again by a retry when the first import died after Artifacts made4- * the repo.4+ * the repo; and each adoption, an import's or a first push's, heard once5+ * as a landing.6 */7 import { describe, expect, it } from "@effect/vitest";8 import { RefName, RepoHost } from "@repo/artifacts/repo-host";9 import { memoryFs } from "@repo/artifacts/repo-host/memory-fs";183 unmodified lines193 ).toStrictEqual(new ProjectExists({ project }));194 }).pipe(Effect.provide(worldOf(scenario, "memory")))195 );196 });197+198+describe("a first push", () => {199+ it.effect(200+ "is heard once as the adoption's landing, however often it is recorded",201+ () =>202+ Effect.gen(function* () {203+ yield* advanceTo("2026-10-08T12:00:00Z");204+205+ const api = yield* projectService(project);206+ const client = yield* gitClient(memoryFs());207+208+ const first = yield* client.commit("Start", [209+ ["README.md", "# start\n"],210+ ]);211+212+ yield* api.initProject(alice, {});213+ yield* (yield* RepoHost)214+ .push(repo, client.source, [215+ { from: Option.none(), ref: mainRef, to: first },216+ ])217+ .pipe(Effect.orDie);218+ yield* api.recordFirstPush(alice, first);219+ yield* api.recordFirstPush(alice, first);220+221+ const heard = yield* api.events(0, 10);222+223+ expect(heard.map(({ event }) => event._tag)).toStrictEqual(["Landed"]);224+ }).pipe(Effect.provide(worldOf(scenario, "memory")))225+ );226+});modified:packages/project/test/project.test.ts+3 added-1 removed
1223 unmodified lines1224 alarm: Option.some(DateTime.add(noon, { seconds: 1 })),1225 fork: false,1226 outbox: ["MakeFork", "Projected"],1227 });1228- // The adoption's landing is the event refused; the alarm projects it.1228+ // The adoption's landing is the event refused; the alarm projects it1229+ // again, after the later events (the memory projection keeps no1230+ // cursor).1231 expect(after).toStrictEqual({1232 fork: true,1233 outbox: [],1234 projected: ["AskOpened", "Landed", "Claimed", "Landed"],215 unmodified linesmodified:GLOSSARY.md+1 added-1 removed
71 unmodified lines72 The cost-ordered chain of stages that narrows a push to a checked tree or a refusal.73 _Avoid_: CI, pipeline, merge queue74 75 **Landing**:76-The platform's commit of a checked tree to main, written by the platform with credit trailers. An ask's opening is a landing too: it opens an ask and answers none.76+The platform's commit of a checked tree to main, written by the platform with credit trailers. An ask's opening is a landing too: it opens an ask and answers none. So is a project's adoption, its first `main` from the initializer's first push or an import: it answers no ask, has no parent and credits no one.77 _Avoid_: merge, ship78 79 **Landed SHA**:80 The commit the platform itself last landed on main; the only commit a project's rules are read from.139 unmodified lines