Skip to content
Myr

Hold the listing's warning to a test, and say the read's cost exactly

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

- standing-posture.test.ts: a new case keeps every log line and expects one warning each for ghost (never made) and broken (its read dies), and none for datekit or burrow. The Want asks for the warning and no test held it; with `logWarning` planted as `logDebug` the case fails. - standing-posture.ts' header gave the cost as "a few at once"; it is at most 8 at once, each ledger read whole for its one `posture` field. - Doc comments the change touched in handlers.ts, home.ts, the dev front page and projection-d1/projection.ts are rewrapped, since several lines were left ragged or overlong. The wording is unchanged.

authored by oscabriel · committed by oscabriel · parent 9328872 · Browse files · 6 files+37 added−15 removed
This commit

State

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

Diff stats

6 files+37 added−15 removed

  • tests:+22 added−1 removed
  • other:+15 added−14 removed

6 files+37 added−15 removed

modified:apps/platform/src/handlers.ts+3 added-3 removed
2 unmodified lines
3 * more. A contract that names a project calls4 * that project's `ProjectApi` (its Durable Object, through `Projects`) as5 * the caller `Authenticated` named; the cross-project reads (`listProjects`,6 * `frontPage`, `credits`) come from the front-page projection, each listed7 * project's posture read from its own ledger (`withStandingPosture`); `status` and8 * `today` without a project ask every project the projection lists and9 * merge what each says. `claim`, `proposeAsk` and `flagAsk` spend the7 * project's posture read from its own ledger (`withStandingPosture`);8 * `status` and `today` without a project ask every project the projection9 * lists and merge what each says. `claim`, `proposeAsk` and `flagAsk` spend the10 * caller's rate limit first, so a call past it reaches no project; a11 * proposal with a draft, and `draftAsk`, spend the draft limit too.12 * `evidence` asks the project who may read a lane's log, which it reads13 * from the stage's `EvidenceStore`. The code reads (`listRefs`, `readTree`,
432 unmodified lines
modified:apps/platform/src/home.ts+3 added-3 removed
9 unmodified lines
10 * the page names them as the reader will type them. The projects are the11 * front page's, and nothing else: no layer and no fork is listed; each12 * one's posture is the one its own ledger stands at, as `listProjects`13 * answers it (`withStandingPosture`), so `/` and the web's `/llms.txt`14 * stay one text. Every15 * value that reaches the HTML is escaped. Not a redirect: the web app is a16 * link, so the host stays discoverable at its own address.14 * stay one text. Every value that reaches the HTML is escaped. Not a15 * redirect: the web app is a link, so the host stays discoverable at its16 * own address.17 */18import { commandDocs } from "@repo/agent-kit/command-doc";19import { frontLlms, MCP_PROTOCOL } from "@repo/agent-kit/host-doc";20import { Brand } from "@repo/brand";
192 unmodified lines
modified:apps/web/src/dev/front-page.ts+5 added-4 removed
5 unmodified lines
6 * claim marks it claimed until it lapses or is released. An entry is what7 * the anonymous viewer sees: takeable when no live claim holds it, nothing8 * it waits on is still on the page, and it is held for nobody; newest first.9 * A project is listed from its first event, `open` until a `PostureChanged`10 * ledger entry moves it, with when it last landed (the `projects`11 * table); `listProjects` reads each one's standing posture from its own12 * ledger (`withStandingPosture`), and keeps this one only as the fallback. A person's credits are each project's own count, joined13 * (`creditsFor`): the rule D1's `credits` table is fed by, read at the source.10 * ledger entry moves it, with when it last landed (the `projects` table);11 * `listProjects` reads each one's standing posture from its own ledger12 * (`withStandingPosture`) and keeps this one only as the fallback. A13 * person's credits are each project's own count, joined (`creditsFor`): the14 * rule D1's `credits` table is fed by, read at the source.15 */16import { FrontPage } from "@repo/project/front-page";17import type { FrontPageFilter } from "@repo/project/front-page";18import type { ProjectedEvent } from "@repo/project/projection";
212 unmodified lines
modified:packages/project/src/projection-d1/projection.ts+2 added-3 removed
7 unmodified lines
8 * was made), `open` until a `PostureChanged` ledger entry moves it: the9 * fallback for a list, which reads each project's standing posture from10 * its own ledger (`withStandingPosture`), since a first config, a11 * widening and a narrowing taking effect by the clock write no such12 * entry. Its13 * open asks are counted again from the front page whenever an ask opens14 * or closes, and a landing stamps when it last landed.12 * entry. Its open asks are counted again from the front page whenever an13 * ask opens or closes, and a landing stamps when it last landed.14 * - A landing credits each person it names once per role, in its ask's15 * area: the module of the ask's territory, read from the ask's front16 * page row, which is still there when its `Landed` applies (its17 * `AskClosed` comes after). A landing with no ask, or whose ask the front
250 unmodified lines
modified:packages/project/src/standing-posture.ts+2 added-1 removed
modified:packages/project/test/standing-posture.test.ts+22 added-1 removed
10 unmodified lines
11import type { Posture } from "@repo/protocol/posture";12import { Principal } from "@repo/protocol/principal";13import { UnknownProject } from "@repo/protocol/refusal";14import { untouchable } from "@repo/testkit/untouchable";15import { Array, DateTime, Duration, Effect, Layer, Ref } from "effect";15import { Array, DateTime, Duration, Effect, Layer, Logger, Ref } from "effect";1617import type { ProjectApi } from "../src/project.ts";18import { Projects } from "../src/projects.ts";19import { withStandingPosture } from "../src/standing-posture.ts";
92 unmodified lines
112 ]);113 }).pipe(Effect.provide(platform))114 );115116 it.effect(117 "warns once for each project whose posture stays the projection's",118 () =>119 Effect.gen(function* () {120 const warned: string[] = [];121122 const keeper = Logger.make(({ logLevel, message }) => {123 warned.push(`${logLevel}: ${String(message)}`);124 });125126 yield* withStandingPosture(listed).pipe(127 Effect.provide(Logger.layer([keeper]))128 );129130 expect(warned.toSorted()).toStrictEqual([131 "Warn: broken's posture is the projection's: its ledger was not read",132 "Warn: ghost's posture is the projection's: its ledger was not read",133 ]);134 }).pipe(Effect.provide(platform))135 );136137 it.effect("lists nothing for an empty list, and asks no project", () =>138 Effect.gen(function* () {139 expect(yield* withStandingPosture([])).toStrictEqual([]);140 }).pipe(
47 unmodified lines