Merge rules/limits 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 df75638, fd96d4b · Browse files · 71 files·+330 added−612 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
71 files+330 added−612 removed
- tests:+168 added−300 removed
- other:+162 added−312 removed
Provenance
- Commit
08abcda- Tree
451bec6- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
df75638- Parent 2
fd96d4b
71 files changed+330 added−612 removed
This commit is too large to show whole: its files are listed by path, without their changes.
modified:apps/cli/src/tui/view.ts+5 added-13 removed
63 unmodified lines64 ? first65 : `${first} (${plural(rest.length, "more line", "more lines")})`;66 };67 68-const Budget = ({ state }: { readonly state: TodayViewState }) => {69- const { budget, decider, overflow } = state.today;70- const left = Math.max(0, budget.total - budget.used);68+const Heading = ({ state }: { readonly state: TodayViewState }) => {69+ const { decider, decisions, expiringSoon } = state.today;70 71 return box(72 { flexDirection: "column" },73 line(`Today for ${decider}`, { attributes: TextAttributes.BOLD }),74 line(76- `Budget: ${budget.used} of ${budget.total} decisions used, ${left} left today · ${plural(budget.finishes, "finish", "finishes")}, counted apart`75+ `${plural(decisions.length, "decision", "decisions")} waiting${expiringSoon.length === 0 ? "" : ` · ${expiringSoon.length} due within a day`}`76 ),78- ...(overflow === 079- ? []80- : [81- line(82- `${overflow} more ${overflow === 1 ? "waits" : "wait"} for tomorrow; each expires to its default if nobody decides first.`,83- muted84- ),85- ])77+ line("Each expires to its default if nobody decides first.", muted)78 );79 };80 81 const Entry = ({89 unmodified lines171 readonly state: TodayViewState;172 }): JSX.Element =>173 box(174 { flexDirection: "column", gap: 1 },183- createElement(Budget, { state }),175+ createElement(Heading, { state }),176 createElement(Decisions, { state }),177 createElement(Newcomers, { state }),178 createElement(Keys, { state })179 );modified:apps/cli/src/render.ts+9 added-9 removed
343 unmodified lines344 ])345 );346 });347 348+const plural = (count: number, one: string, many: string) =>349+ `${count} ${count === 1 ? one : many}`;350+351 const today = viewOf(TodayOf.successSchema, (page) =>352 joined(353 prose(351- `Today for ${page.decider}: ${page.budget.used} of ${page.budget.total} decisions used${page.overflow === 0 ? "" : `; ${page.overflow} more wait beyond the budget`}.`354+ `Today for ${page.decider}: ${plural(page.decisions.length, "decision", "decisions")} waiting${page.expiringSoon.length === 0 ? "" : `, ${page.expiringSoon.length} due within a day`}; each takes its default if nobody decides first.`355 ),356 table(357 ["decision", "project", "about", "default", "expires"],358 page.decisions.map((decision) => [14 unmodified lines373 ])374 )375 );376 374-const plural = (count: number, one: string, many: string) =>375- `${count} ${count === 1 ? one : many}`;376-377 const countOf = (count: number) => (count === 0 ? "nobody" : `${count}`);378 379 const HOUR_MS = 3_600_000;380 19 unmodified lines400 "For code: claiming an ask or offering a sealed answer needs a vouch; anyone not denounced may propose an ask.",401 } as const satisfies Record<PublicPolicy["vouch"]["mode"], string>;402 403 const evaluated = (policy: PublicPolicy) => {404- const { agents, budget, caps, claims, record, vouch, vouches } = policy;404+ const { agents, caps, claims, decisions, record, vouch, vouches } = policy;405 const denounced = vouches.filter((line) => line.denounced).length;406 407 return joined(408 prose(14 unmodified lines423 prose("Limits:"),424 fields([425 [426 "Claims",427- `${plural(caps.claimsPerPerson, "claim", "claims")} per person at once`,427+ `${plural(caps.claimsPerPerson, "claim", "claims")} at once for a person nobody has vouched for; a vouched person and a maintainer are never held`,428 ],429 [430 "Proposals",431 caps.proposalsPerPerson === 0432 ? "Proposals are off"433- : `${plural(caps.proposalsPerPerson, "proposal", "proposals")} per person at once`,433+ : `${plural(caps.proposalsPerPerson, "proposal", "proposals")} open at once for a person nobody has vouched for`,434 ],435 [436- "Budget",437- `${plural(budget.decisionsPerDay, "decision", "decisions")} a day per maintainer; an undecided one takes its default after ${plural(budget.expireDays, "day", "days")}`,436+ "Decisions",437+ `an undecided one takes its default after ${plural(decisions.expireDays, "day", "days")}`,438 ],439 [440 "Claim timing",441 `warned after ${spanOf(claims.warnAfterMs)} without a push; lapses after ${spanOf(claims.lapseAfterMs)}`,157 unmodified linesmodified:apps/cli/test/tui/fixture.ts-2 removed
59 unmodified lines60 subject: DecisionSubject.cases.Vouch.make({ handle: Handle.make("ada") }),61 };62 63 export const today: Today = {64- budget: { finishes: 1, total: 5, used: 2 },64 decider: okonkwo,65 decisions: [proposal, vouch, stray],66 expiringSoon: [stray.id],67 newcomers: [Handle.make("ada"), Handle.make("grace")],69- overflow: 1,68 unattended: [],69 };modified:apps/cli/test/tui/today.test.ts+12 added-9 removed
134 unmodified lines135 const rowsWith = (rows: readonly string[], text: string) =>136 rows.filter((row) => row.includes(text));137 138 describe("Today as the terminal shows it", () => {139+ it.live(140+ "says whose Today it is, how many decisions wait, and how many are due within a day",139- it.live("says whose Today it is and how much of the budget is used", () =>140- Effect.gen(function* () {141- const rows = yield* screenOf(start(today));141+ () =>142+ Effect.gen(function* () {143+ const rows = yield* screenOf(start(today));144 143- expect(rowsWith(rows, "Today for okonkwo")).toHaveLength(1);144- expect(rowsWith(rows, "Budget: 2 of 5 decisions used")).toStrictEqual([145- "Budget: 2 of 5 decisions used, 3 left today · 1 finish, counted apart",146- ]);147- expect(rowsWith(rows, "1 more waits for tomorrow")).toHaveLength(1);148- })145+ expect(rowsWith(rows, "Today for okonkwo")).toHaveLength(1);146+ expect(rowsWith(rows, "3 decisions waiting")).toStrictEqual([147+ "3 decisions waiting · 1 due within a day",148+ ]);149+ expect(rowsWith(rows, "Budget")).toHaveLength(0);150+ expect(rowsWith(rows, "for tomorrow")).toHaveLength(0);151+ })152 );153 154 it.live("lists the decisions in expiry order, the cursor on the first", () =>155 Effect.gen(function* () {536 unmodified linesmodified:apps/cli/test/hook.test.ts+1 added-1 removed
381 unmodified lines382 const policy = Schema.decodeSync(Policy)({383 agents: "trailer",384 asks: [askWire],385 at: landedSha,386- budget: { decisionsPerDay: 5, expireDays: 14 },386 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },387 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },388 deciders: [{ handles: ["bob"], paths: "**" }],389+ decisions: { expireDays: 14 },390 functions: { admit: false, opensAlone: false },391 judge: judgeClosure(392 Schema.decodeSync(RunBlock)({393 checks: { lint: "bun run lint" },799 unmodified linesmodified:apps/cli/test/policy-view.test.ts+5 added-5 removed
14 unmodified lines15 16 const datekitPolicy = {17 agents: "trailer",18 at: sha,19- budget: { decisionsPerDay: 5, expireDays: 14 },19 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },20 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },21 deciders: [22 { handles: ["ines-v"], paths: "**" },23 { handles: ["okonkwo", "bram"], paths: "src/tz.ts" },24 ],25+ decisions: { expireDays: 14 },26 judge: { paths: [`${Brand.configDir}/**`], pointers: [] },27 kinds: [],28 modules: [],29 ratchets: [],79 unmodified lines109 `${Brand.configDir}/vouched.td vouches for nobody and denounces nobody`110 );111 });112 113- it("shows the caps, the budget, the claim timing and the record window", () => {113+ it("shows the caps, the decision expiry, the claim timing and the record window", () => {114 const lines = linesOf(textOf(datekit));115 116 for (const line of [117- "Claims 3 claims per person at once",118- "Proposals 2 proposals per person at once",119- "Budget 5 decisions a day per maintainer; an undecided one takes its default after 14 days",117+ "Claims 3 claims at once for a person nobody has vouched for; a vouched person and a maintainer are never held",118+ "Proposals 2 proposals open at once for a person nobody has vouched for",119+ "Decisions an undecided one takes its default after 14 days",120 "Claim timing warned after 2 hours without a push; lapses after 24 hours",121 "Record a landing counts once it has stood 30 days, for 365 days",122 ]) {123 expect(lines).toContain(line);109 unmodified linesmodified:apps/platform/src/handlers.ts+3 added-13 removed
26 unmodified lines27 import { CurrentPrincipal, Principal } from "@repo/protocol/principal";28 import type { Person } from "@repo/protocol/principal";29 import { NotDecider } from "@repo/protocol/refusal";30 import type { Layer } from "effect";31-import { Array, DateTime, Effect, Number, Option, Order, Stream } from "effect";31+import { Array, DateTime, Effect, Option, Order, Stream } from "effect";32 import { HttpServerRequest } from "effect/http";33 import type { Rpc, RpcGroup } from "effect/rpc";34 35 import { RateLimits } from "./rate-limits.ts";66 unmodified lines102 103 const acrossProjects = (104 decider: Person,105 pages: readonly Today[]106-): Effect.Effect<Today, NotDecider> => {107- const sumOf = (pick: (page: Today) => number) =>108- Number.sumAll(pages.map(pick));109-110- return Array.isReadonlyArrayNonEmpty(pages)106+): Effect.Effect<Today, NotDecider> =>107+ Array.isReadonlyArrayNonEmpty(pages)108 ? Effect.succeed({112- budget: {113- finishes: sumOf(({ budget }) => budget.finishes),114- total: sumOf(({ budget }) => budget.total),115- used: sumOf(({ budget }) => budget.used),116- },109 decider: decider.handle,110 decisions: Array.sort(111 pages.flatMap(({ decisions }) => decisions),112 byExpiry2 unmodified lines115 newcomers: Array.dedupeWith(116 pages.flatMap(({ newcomers }) => newcomers),117 sameHandle118 ),127- overflow: sumOf(({ overflow }) => overflow),119 unattended: pages.flatMap(({ unattended }) => unattended),120 })121 : Effect.fail(new NotDecider({}));131-};122 123 export const Handlers: Layer.Layer<124 Rpc.ToHandler<RpcGroup.Rpcs<typeof Contracts>>,125 never,269 unmodified linesmodified:apps/platform/test/handlers.test.ts-4 removed
426 unmodified lines427 428 const today = yield* alice.today({});429 430 expect({431- budget: today.budget,431 decider: today.decider,432 decisions: today.decisions.map(({ openedAt, project }) => ({433 openedAt: DateTime.formatIso(openedAt),434 project,435 })),436 expiringSoon: today.expiringSoon,437 newcomers: today.newcomers,439- overflow: today.overflow,438 unattended: today.unattended,439 }).toStrictEqual({442- budget: { finishes: 0, total: 10, used: 1 },440 decider: "alice",441 decisions: [442 { openedAt: "2026-10-07T12:05:00.000Z", project: "alice/datekit" },443 { openedAt: "2026-10-07T12:10:00.000Z", project: "alice/burrow" },444 ],445 expiringSoon: [],446 newcomers: ["bob"],450- overflow: 0,447 unattended: [],448 });449 expect(yield* Effect.flip(bob.today({}))).toStrictEqual(450 new NotDecider({})474 unmodified linesmodified:apps/sandbox/test/lander.fixtures.ts+1 added-1 removed
293 unmodified lines294 'import { deciders } from "./people.ts";',295 "",296 "export default project({",297 " admit: (claimant) => claimant.vouched && claimant.record > 1,",298- ' budget: { decisionsPerDay: 3, expire: "7 days" },',298+ ' decisions: { expire: "7 days" },',299 " deciders,",300 "});",301 "",302 ].join("\n"),27 unmodified linesmodified:apps/web/src/dev/fixtures/record.ts+1 added-18 removed
121 unmodified lines122 123 export const landingIn = (record: FixtureRecord, sha: CommitSha) =>124 Array.findFirst(record.landings, (landing) => landing.sha === sha);125 126-const spentBy = (record: FixtureRecord, decider: Handle, now: DateTime.Utc) => {127- const day = DateTime.formatIsoDateUtc(now);128-129- return record.decisions.filter(130- ({ decided }) =>131- decided !== undefined &&132- sameHandle(decided.by, decider) &&133- DateTime.formatIsoDateUtc(decided.at) === day134- ).length;135-};136-126 export const todayIn = (127 record: FixtureRecord,128 decider: Handle,140- now: DateTime.Utc,141- perDay: number129+ now: DateTime.Utc130 ): Option.Option<Today> =>131 record.decisions.some(({ deciders }) =>132 deciders.some((each) => sameHandle(each, decider))133 )134 ? Option.some(135 today({148- budget: {149- finishes: 0,150- total: perDay,151- used: spentBy(record, decider, now),152- },136 decider,137 decisions: record.decisions,138 firstClaims: record.firstClaims,139 landings: record.landings,64 unmodified linesmodified:apps/web/src/dev/fixtures/vellum.ts+1 added-3 removed
187 unmodified lines188 "LEGACY_PDF_ENGINE=",189 "",190 ].join("\n");191 192-export const decisionsPerDay = 5;193-192 const CLAIMS = { lapseAfter: { hours: 96 }, warnAfter: { hours: 48 } } as const;193 194 const HOUR_MS = 3_600_000;195 196 const policy = policyJson({197 asks: [],200- budget: { decisionsPerDay, expireDays: 3 },198 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },199 claims: {200 lapseAfterMs: CLAIMS.lapseAfter.hours * HOUR_MS,201 warnAfterMs: CLAIMS.warnAfter.hours * HOUR_MS,4 unmodified lines206 { handles: [people.okonkwo], paths: "packages/export/**" },207 { handles: [people.okonkwo], paths: ".env.schema" },208 { handles: [people.okonkwo], paths: `${dir}/vouched.td` },209 ],210+ decisions: { expireDays: 3 },211 functions: { admit: false, opensAlone: false },212 kinds: [213 {214 checkKind: "redThenGreen",1695 unmodified linesmodified:apps/web/src/dev/fixtures.ts+3 added-4 removed
44 unmodified lines45 } from "./fixtures/record.ts";46 import type { FixtureRecord } from "./fixtures/record.ts";47 import type { Story } from "./fixtures/story.ts";48 import {49- decisionsPerDay,49 fixturesNow,50 landLintChild,51 tellVellum,52 vellum,292 unmodified lines345 status: (caller) =>346 Effect.map(current, (record) => statusIn(record, caller.handle)),347 today: (caller) =>348 Effect.flatMap(Effect.zip(current, now), ([record, at]) =>350- Effect.fromOption(351- todayIn(record, caller.handle, at, decisionsPerDay)352- ).pipe(Effect.mapError(() => new NotDecider({})))349+ Effect.fromOption(todayIn(record, caller.handle, at)).pipe(350+ Effect.mapError(() => new NotDecider({}))351+ )352 ),353 verdict: (_caller, input) =>354 Effect.flatMap(current, (record) =>355 record.asks.has(input.ask)79 unmodified linesmodified:apps/web/src/dev/handlers.ts+3 added-13 removed
23 unmodified lines24 import type { ProjectName, RepoName } from "@repo/protocol/ids";25 import { CurrentPrincipal, Principal } from "@repo/protocol/principal";26 import type { Person } from "@repo/protocol/principal";27 import { NotDecider } from "@repo/protocol/refusal";28-import { Array, DateTime, Effect, Number, Option, Order, Stream } from "effect";28+import { Array, DateTime, Effect, Option, Order, Stream } from "effect";29 import type { Layer } from "effect";30 import { HttpServerRequest } from "effect/http";31 import type { Rpc, RpcGroup } from "effect/rpc";32 54 unmodified lines87 88 const acrossProjects = (89 decider: Person,90 pages: readonly Today[]91-): Effect.Effect<Today, NotDecider> => {92- const sumOf = (pick: (page: Today) => number) =>93- Number.sumAll(pages.map(pick));94-95- return Array.isReadonlyArrayNonEmpty(pages)91+): Effect.Effect<Today, NotDecider> =>92+ Array.isReadonlyArrayNonEmpty(pages)93 ? Effect.succeed({97- budget: {98- finishes: sumOf(({ budget }) => budget.finishes),99- total: sumOf(({ budget }) => budget.total),100- used: sumOf(({ budget }) => budget.used),101- },94 decider: decider.handle,95 decisions: Array.sort(96 pages.flatMap(({ decisions }) => decisions),97 byExpiry2 unmodified lines100 newcomers: Array.dedupeWith(101 pages.flatMap(({ newcomers }) => newcomers),102 sameHandle103 ),112- overflow: sumOf(({ overflow }) => overflow),104 unattended: pages.flatMap(({ unattended }) => unattended),105 })106 : Effect.fail(new NotDecider({}));116-};107 108 export const devHandlers: Layer.Layer<109 Rpc.ToHandler<RpcGroup.Rpcs<typeof Contracts>>,110 never,254 unmodified linesmodified:apps/web/src/features/account/inbox-count.tsx+1 added-1 removed
7 unmodified lines8 const InboxCount = () => {9 const today = useAtomValue(todayAtom());10 11 const waiting = AsyncResult.isSuccess(today)12- ? today.value.decisions.length + today.value.overflow12+ ? today.value.decisions.length13 : 0;14 15 return (16 <AppLink17 unmodified linesmodified:apps/web/src/features/decision/decision-page.tsx+1 added-1 removed
313 unmodified lines314 NotOnToday: () => (315 <Apart data={data}>316 <EmptyState317 command={`${Brand.cli} today --project ${data.project}`}318- title={`Decision ${data.decision} is not on your Today: it was decided, it expired to its default, or it waits beyond today's budget.`}318+ title={`Decision ${data.decision} is not on your Today: it was decided, or it expired to its default.`}319 />320 </Apart>321 ),322 Refused: ({ refusal }) => (27 unmodified linesmodified:apps/web/src/features/inbox/decision-sections.tsx+20 added-34 removed
28 unmodified lines29 import { expiringSoon, expiryOrder } from "./decisions.ts";30 31 const counted = (count: number) => (count === 0 ? "none" : String(count));32 33-export const budgetSentence = (budget: Today["budget"]) =>34- `Decisions: ${budget.used} taken, ${counted(Math.max(0, budget.total - budget.used))} left today. Finishes are counted apart: ${counted(budget.finishes)} taken.`;33+/** The decisions waiting, as one sentence: every open one shows, and each takes its default if nobody decides. */34+export const waitingSentence = (today: Today) => {35+ const soon = today.expiringSoon.length;36 36-export const budgetShort = (budget: Today["budget"]) =>37- `${counted(Math.max(0, budget.total - budget.used))} left today`;37+ return `Decisions: ${counted(today.decisions.length)} waiting${soon === 0 ? "" : `, ${soon} due today`}. Each takes its default if nobody decides before it expires.`;38+};39 40+export const waitingShort = (today: Today) =>41+ `${counted(today.decisions.length)} waiting`;42+43 interface Listed {44 readonly decision: Decision;45 readonly soon: boolean;46 }172 unmodified lines219 )}220 {later.length === 0 ? null : (221 <Section222 count={plural(later.length, "decision", "decisions")}219- name="Within your budget"223+ name="Later"224 >225 {later.map((each) => (226 <DecisionRow227 key={decisionKey(each.decision)}6 unmodified lines234 </>235 );236 };237 234-const Tomorrow = ({ overflow }: { readonly overflow: number }) =>235- overflow === 0 ? null : (236- <Section name="Waits for tomorrow">237- <li238- className="border-rule text-ui flex min-h-10 items-center border-b py-2"239- data-overflow={overflow}240- >241- {overflow} more {overflow === 1 ? "waits" : "wait"} for tomorrow; each242- expires to its default if nobody decides first.243- </li>244- </Section>245- );246-238 const Newcomers = ({239 newcomers,240 }: {241 readonly newcomers: Today["newcomers"];161 unmodified lines403 selected,404 stamped,405 };406 416- return (417- <>418- {listed.length === 0 ? (419- <Section name="Decisions waiting">420- <li className="pt-3">421- <EmptyState422- command={`${Brand.cli} today`}423- title="Nothing to decide today. Undecided decisions expire to their safe default."424- />425- </li>426- </Section>427- ) : (428- <DecisionSections listed={listed} props={props} />407+ return listed.length === 0 ? (408+ <Section name="Decisions waiting">409+ <li className="pt-3">410+ <EmptyState411+ command={`${Brand.cli} today`}412+ title="Nothing to decide today. Undecided decisions expire to their safe default."413+ />414+ </li>415+ </Section>416+ ) : (417+ <DecisionSections listed={listed} props={props} />429- )}430- <Tomorrow overflow={today.overflow} />431- </>418 );419 };420 421 /** What happened lately in the projects the reader decides for. */12 unmodified linesmodified:apps/web/src/features/inbox/inbox-page.tsx+8 added-10 removed
35 unmodified lines36 } from "../shared/row.tsx";37 import { Workspace } from "../shared/shell/workspace.tsx";38 import { When } from "../shared/time.tsx";39 import {40- budgetSentence,41- budgetShort,40 DecisionGroups,41 RecentGroups,42+ waitingSentence,43+ waitingShort,44 } from "./decision-sections.tsx";45 import type { Decided } from "./decision-sections.tsx";46 import { readOfCause, TodayRead } from "./decisions.ts";47 import {5 unmodified lines53 WORK_SHOWN,54 } from "./read.ts";55 import type { Work } from "./read.ts";56 57-export { budgetSentence } from "./decision-sections.tsx";57+export { waitingSentence } from "./decision-sections.tsx";58 59 const WHAT_THE_INBOX_IS =60 "The inbox is your own page: the decisions waiting for you, the asks you hold and where each answer stands in the gate, and the asks you may take next.";61 280 unmodified lines342 }: {343 readonly deciding: Deciding;344 readonly read: SignedIn;345 }) => {346- const budget = Option.getOrUndefined(347- Option.map(todayOf(read), ({ budget: held }) => held)348- );346+ const today = Option.getOrUndefined(todayOf(read));347 348 return (349 <Workspace352- {...(budget === undefined ? {} : { count: budgetShort(budget) })}350+ {...(today === undefined ? {} : { count: waitingShort(today) })}351 crumbs={CRUMBS}352 meta={<Record handle={read.handle} />}353 status={356- budget === undefined ? undefined : (354+ today === undefined ? undefined : (355 <p356 className="text-want max-w-(--measure)"359- data-budget={`${budget.used}/${budget.total}`}357+ data-waiting={today.decisions.length}358 >361- {budgetSentence(budget)}359+ {waitingSentence(today)}360 </p>361 )362 }363 title={TITLE}57 unmodified linesmodified:apps/web/src/features/project-people/people-view.tsx+5 added-5 removed
196 unmodified lines197 <span className="tabular-nums">{children}</span>198 );199 200 const Limits = ({ policy }: { readonly policy: PublicPolicy }) => {201- const { budget, caps, claims, record } = policy;201+ const { caps, claims, decisions, record } = policy;202 203 return (204 <Region id="limits" title="Limits">205 <Definitions label="Limits">206 <Definition term="Claims">207- <Num>{`${plural(caps.claimsPerPerson, "claim", "claims")} per person at once`}</Num>207+ <Num>{`${plural(caps.claimsPerPerson, "claim", "claims")} at once for a person nobody has vouched for; a vouched person and a maintainer are never held`}</Num>208 </Definition>209 <Definition term="Proposals">210 <Num>211 {caps.proposalsPerPerson === 0212 ? "Proposals are off"213- : `${plural(caps.proposalsPerPerson, "proposal", "proposals")} per person at once`}213+ : `${plural(caps.proposalsPerPerson, "proposal", "proposals")} open at once for a person nobody has vouched for`}214 </Num>215 </Definition>216- <Definition term="Budget">217- <Num>{`${plural(budget.decisionsPerDay, "decision", "decisions")} a day per maintainer; an undecided one takes its default after ${plural(budget.expireDays, "day", "days")}`}</Num>216+ <Definition term="Decisions">217+ <Num>{`an undecided one takes its default after ${plural(decisions.expireDays, "day", "days")}`}</Num>218 </Definition>219 <Definition term="Claim timing">220 <Num>{`warned after ${spanOf(claims.warnAfterMs)} without a push; lapses after ${spanOf(claims.lapseAfterMs)}`}</Num>221 </Definition>254 unmodified linesmodified:apps/web/test/client-today.test.ts+2 added-5 removed
31 unmodified lines32 33 expect(34 Exit.isSuccess(today)35 ? {36- budget: today.value.budget,36 decider: today.value.decider,37 newcomers: today.value.newcomers,38 projects: Array.dedupe(39 today.value.decisions.map(({ project }) => project)4 unmodified lines44 unattended: today.value.unattended.map(({ ask }) => ask),45 }46 : undefined47 ).toStrictEqual({49- budget: { finishes: 0, total: 5, used: 2 },48 decider: "ines-v",49 newcomers: ["bram"],50 projects: ["oscabriel/datekit"],51 subjects: ["OpenProposal", "OpenProposal", "StrayPush"],56 unmodified lines108 ? {109 holds: today.value.decisions.some(110 ({ id }) => id === proposal.id111 ),114- used: today.value.budget.used,112 }113 : undefined114 );115 116 expect({117 page: yield* todayIn(registry),118 rail: yield* todayIn(rail),119 }).toStrictEqual({123- page: { holds: false, used: 3 },124- rail: { holds: false, used: 3 },120+ page: { holds: false },121+ rail: { holds: false },122 });123 124 unmount();125 unmountRail();3 unmodified linesmodified:apps/web/test/decision.test.tsx-2 removed
88 unmodified lines89 }),90 };91 92 const todayWith = (decisions: readonly Decision[]): Today => ({93- budget: { finishes: 0, total: 5, used: 1 },93 decider: okonkwo,94 decisions,95 expiringSoon: decisions.map(({ id }) => id),96 newcomers: [],98- overflow: 0,97 unattended: [],98 });99 100 interface Asked {568 unmodified linesmodified:apps/web/test/dev-backend.test.ts+16 added-6 removed
1 import { describe, expect, it } from "@effect/vitest";2 import { Brand } from "@repo/brand";3 import { Client, Contracts } from "@repo/protocol/contracts";4 import { forkRev } from "@repo/protocol/domain/code";5+import { DecisionSubject } from "@repo/protocol/domain/decision";6 import { ProjectEvent } from "@repo/protocol/domain/event";7 import { Handle, ProjectName } from "@repo/protocol/ids";8 import { Unauthenticated } from "@repo/protocol/principal";9 import {540 unmodified lines550 () =>551 Effect.gen(function* () {552 const { after, before, proposed, shown } = yield* drafted;553 553- // The seeded decisions expire first and fill the day's budget, so554- // the draft's decision waits on Today as its overflow.554+ // Today holds every open decision, so the draft's joins the seeded ones.555+ const joined = after.decisions.filter(556+ ({ id }) => !before.decisions.some((was) => was.id === id)557+ );558+559 expect({560 files: shown.files.map(({ path }) => path),557- overflow: [before.overflow, after.overflow],561+ joined: joined.map(({ subject }) => subject),562+ kept: before.decisions.every(({ id }) =>563+ after.decisions.some((now) => now.id === id)564+ ),565 proposed: proposed.draft?._tag,566 ready: shown.proposal.draft?._tag,560- shown: after.decisions.map(({ id }) => id),567 }).toStrictEqual({568 files: [569 `${Brand.configDir}/asks/parse-ordinal.ask.ts`,570 "test/asks/parse-ordinal.test.ts",571 ],566- overflow: [0, 1],572+ joined: [573+ DecisionSubject.cases.OpenProposal.make({574+ proposal: proposed.id,575+ }),576+ ],577+ kept: true,578 proposed: "Drafting",579 ready: "Ready",569- shown: before.decisions.map(({ id }) => id),580 });581 })582 );583 });modified:apps/web/test/dev-fixtures.test.ts+9 added-12 removed
444 unmodified lines445 )446 );447 448 it.live(449- "put every kind of decision on a maintainer's Today, one due within the day and two of five taken",449+ "put every kind of decision on a maintainer's Today, every open one, one due within the day",450 () =>451 inWorld(withFixtures, (as) =>452 Effect.gen(function* () {453 const project = vellum;13 unmodified lines467 )468 );469 470 expect({471- budget: [mine.budget.used, mine.budget.total],471 dueToday: mine.expiringSoon.length,473- overflow: mine.overflow,472 shown: mine.decisions.some(({ id }) => id === mine.expiringSoon[0]),473+ waiting: mine.decisions.length,474 }).toStrictEqual({476- budget: [2, 5],475 dueToday: 1,478- overflow: 3,476 shown: true,477+ waiting: 6,478 });479 expect([480 mine.newcomers.length > 0,481 mine.unattended.length > 0,484- merged.overflow >= 3,482+ merged.decisions.length >= mine.decisions.length,483 ]).toStrictEqual([true, true, true]);484 expect([...kinds].toSorted()).toStrictEqual(485 Object.keys(DecisionSubject.cases).toSorted()486 );266 unmodified lines753 const timesIn = (options: DevWorldOptions) =>754 inWorld(options, (as) =>755 Effect.gen(function* () {756 const ines = yield* as(signedIn("ines-v"));759- const { decisions, overflow } = yield* ines.today({});757+ const { decisions } = yield* ines.today({});758 759 const proposedAt = (handle: string, want: string) =>760 Effect.flatMap(as(signedIn(handle)), (client) =>761 Effect.map(10 unmodified lines772 yield* Effect.sleep(Duration.millis(20));773 774 const second = yield* proposedAt("sefa", "datekit reads RFC 2822 dates.");775 778- return { decisions, first, overflow, second };776+ return { decisions, first, second };777 })778 );779 780 const keyOf = ({ id, project }: Decision) => `${project}/${id}`;781 784-// Today's budget counts a UTC day, so which taken decisions fall on the present day moves with the time of day785-// the world is built at: the two worlds are held to the same open count, and shared decisions to one shift.782+// Which decisions are open moves with the time of day the world is built at: the two worlds are held783+// to the same open count, and shared decisions to one shift.784 const placedAtThePresent = (fixtures: FixtureMode, end: DateTime.Utc) =>785 Effect.gen(function* () {786 const fixed = yield* timesIn({ fixtures });787 49 unmodified lines837 millisFrom(present.second, after) >= 0,838 present.decisions.every(839 ({ expiresAt }) => millisFrom(present.second, expiresAt) > 0840 ),843- present.decisions.length + present.overflow ===844- fixed.decisions.length + fixed.overflow,841+ present.decisions.length === fixed.decisions.length,842 ]).toStrictEqual([true, true, true, true, true, true, true]);843 });844 845 describe("the dev world's time", seededWorlds, () => {102 unmodified linesmodified:apps/web/test/home.test.tsx+1 added-3 removed
118 unmodified lines119 subject: DecisionSubject.cases.Vouch.make({ handle: Handle.make(handle) }),120 });121 122 const today = Schema.decodeSync(Today)({123- budget: { finishes: 0, total: 5, used: 1 },123 decider: "ines-v",124 decisions: [125 decision("dec-000002", "lin-h", "2026-10-09T12:00:00.000Z"),126 decision("dec-000001", "tamsin", "2026-10-08T12:00:00.000Z"),127 ],128 expiringSoon: [],129 newcomers: [],131- overflow: 0,130 unattended: [],131 });132 133 const takeable = Schema.decodeSync(FrontPageEntry)({147 unmodified lines281 decisions: Decisions.cases.Decides.make({ today }),282 });283 284 expect(sectionsOf(markup)).toStrictEqual([287- "Within your budget",285+ "Later",286 "Your claims",287 "Asks you may take",288 ]);289 expect(markup).toMatch(238 unmodified linesmodified:apps/web/test/project-people.test.tsx+7 added-7 removed
37 unmodified lines38 const datekitPolicy = decodePolicy({39 ...unshown,40 agents: "trailer",41 at: sha,42- budget: { decisionsPerDay: 5, expireDays: 14 },42 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },43 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },44 deciders: [45 { handles: ["ines-v"], paths: "**" },46 { handles: ["okonkwo", "bram"], paths: "src/format/**" },47 { handles: ["okonkwo"], paths: "src/tz.ts" },48 ],49+ decisions: { expireDays: 14 },50 record: { countsAfterDays: 30, windowDays: 365 },51 source: "config",52 vouch: { file: `${Brand.configDir}/vouched.td`, mode: "forCode" },53 vouches: [26 unmodified lines80 const burrowPolicy = decodePolicy({81 ...unshown,82 agents: "trailer",83 at: sha,84- budget: { decisionsPerDay: 5, expireDays: 14 },84 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },85 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },86 deciders: [{ handles: ["wren"], paths: "**" }],87+ decisions: { expireDays: 14 },88 record: { countsAfterDays: 30, windowDays: 365 },89 source: "defaults",90 vouch: { file: `${Brand.configDir}/vouched.td`, mode: "forCode" },91 vouches: [],154 unmodified lines246 expect(layers).toContain("data-layers");247 expect(sectionOf(markup, "agents")).not.toContain("data-layers");248 });249 250- it("shows the caps, budget, claim timing and record window, the numbers tabular", () => {250+ it("shows the caps as throttles on the unvouched, the decision expiry, claim timing and record window, the numbers tabular", () => {251 const limits = sectionOf(mainOf(markupOf(page)), "limits");252 253 for (const words of [254- "3 claims per person",255- "2 proposals per person",256- "5 decisions a day",257- "14 days",254+ "3 claims at once for a person nobody has vouched for",255+ "a vouched person and a maintainer are never held",256+ "2 proposals open at once for a person nobody has vouched for",257+ "an undecided one takes its default after 14 days",258 "2 hours",259 "24 hours",260 "30 days",261 "365 days",410 unmodified linesmodified:apps/web/test/proposal.test.tsx-2 removed
308 unmodified lines309 ),310 Contracts.toLayerHandler("today", () =>311 Ref.update(asked, (seen) => ({ ...seen, today: seen.today + 1 })).pipe(312 Effect.as({313- budget: { finishes: 0, total: 5, used: 0 },313 decider: Handle.make("okonkwo"),314 decisions: [],315 expiringSoon: [],316 newcomers: [],318- overflow: 0,317 unattended: [],318 })319 )320 ),143 unmodified linesmodified:apps/web/test/today.test.tsx+21 added-36 removed
28 unmodified lines29 describeSubject,30 } from "../src/features/decision/decision-card.tsx";31 import { orderDecisions } from "../src/features/inbox/decisions.ts";32 import {33- budgetSentence,33+ waitingSentence,34 InboxView,35 } from "../src/features/inbox/inbox-page.tsx";36 import { movedToInbox } from "../src/features/inbox/moved.ts";37 import {131 unmodified lines169 sha: LandedSha.make(digit.repeat(40)),170 });171 172 const today: Today = {173- budget: { finishes: 1, total: 5, used: 2 },173 decider: okonkwo,174 // Out of order on purpose: the page orders them.175 decisions: [proposal, vouch, stray],176 expiringSoon: [stray.id],177 newcomers: [Handle.make("lin-h")],179- overflow: 4,178 unattended: [179 landing("c", "format-date", "2026-10-07T09:00:00Z"),180 landing("d", "parse-iso", "2026-10-06T18:00:00Z"),181 ],16 unmodified lines198 199 const page = viewOf(deciding(today));200 201 describe("the inbox, for the decisions waiting on a reader", () => {204- it("says the budget as one sentence, the finishes counted apart", () => {202+ it("says how many decisions wait as one sentence, with how many are due today, and names no budget", () => {203 const text = textOf(page);204 205 expect(text).toContain(208- "Decisions: 2 taken, 3 left today. Finishes are counted apart: 1 taken."206+ "Decisions: 3 waiting, 1 due today. Each takes its default if nobody decides before it expires."207 );210- expect(markupOf(page)).toContain('data-budget="2/5"');211- expect(text).not.toContain("2 of 5");212- expect(text).not.toContain("3 of 5");208+ expect(markupOf(page)).toContain('data-waiting="3"');209+ expect(text).not.toContain("budget");210+ expect(text).not.toContain("tomorrow");211 });212 215- it("says none when no finish was taken", () => {216- expect(budgetSentence({ finishes: 0, total: 5, used: 5 })).toBe(217- "Decisions: 5 taken, none left today. Finishes are counted apart: none taken."213+ it("says none when nothing waits, and leaves the due count out when none is due", () => {214+ expect(waitingSentence({ ...today, decisions: [], expiringSoon: [] })).toBe(215+ "Decisions: none waiting. Each takes its default if nobody decides before it expires."216 );217+ expect(waitingSentence({ ...today, expiringSoon: [] })).toBe(218+ "Decisions: 3 waiting. Each takes its default if nobody decides before it expires."219+ );220 });221 222 it("puts its sections in order, each under its header: decisions, claims, asks, then what happened lately", () => {223 expect(sectionsOf(markupOf(page))).toStrictEqual([224 "Due today",224- "Within your budget",225- "Waits for tomorrow",225+ "Later",226 "Your claims",227 "Asks you may take",228 "Newcomers to welcome",229 "Landed without a decision",57 unmodified lines287 288 expect(text).toContain("If nobody decides by Thu 8 Oct, 10:00 UTC: adopt");289 });290 291- it("says how many more wait for tomorrow", () => {292- const markup = markupOf(page);293-294- expect(textIn(markup)).toContain("4 more wait for tomorrow");295- expect(markup).toContain('data-overflow="4"');296- expect(textOf(viewOf(deciding({ ...today, overflow: 3 })))).toContain(297- "3 more wait for tomorrow"298- );299- });300-291 it("names the newcomers to welcome and the landings that needed nobody", () => {292 const text = textOf(page);293 const markup = markupOf(page);294 39 unmodified lines334 const markup = markupOf(335 viewOf(336 deciding({337 ...today,348- budget: { ...today.budget, used: 3 },338 decisions: [vouch, stray],339 }),340 { decided: AsyncResult.success({ decision: taken }) }341 )11 unmodified lines353 expect(textIn(last?.body ?? "")).toContain(354 "Opens the ask: its file and check land on main, with you as Decided-by."355 );356 expect(last?.body).not.toContain("data-choice=");368- expect(textIn(markup)).toContain("Decisions: 3 taken, 2 left today.");357+ expect(textIn(markup)).toContain("Decisions: 2 waiting, 1 due today.");358 });359 371- it("leaves the decisions and the budget out for a reader who decides nowhere", () => {360+ it("leaves the decisions and their count out for a reader who decides nowhere", () => {361 const markup = markupOf(362 viewOf({363 ...deciding(today),364 decisions: Decisions.cases.NotDecider.make({}),365 })366 );367 368 expect(markup).not.toContain("data-decision");380- expect(markup).not.toContain("data-budget");369+ expect(markup).not.toContain("data-waiting");370 });371 372 it("shows a refused read as the refusal, says what the inbox is, and lists no decision", () => {373 const refused = new UnknownProject({201 unmodified lines575 };576 577 describe("the inbox's decisions, read on the server with the reader's session", () => {578 it.live(590- "renders a maintainer's decisions from the fixtures: the budget sentence, the sections and what waits",579+ "renders a maintainer's decisions from the fixtures: the waiting sentence, every one in its section",580 () =>581 Effect.gen(function* () {582 const markup = pageFrom(yield* readInbox({ project: vellum }));583 const text = textIn(markup);584 596- expect(text).toContain(597- "Decisions: 2 taken, 3 left today. Finishes are counted apart: none taken."598- );599- expect(sectionsOf(markup).slice(0, 3)).toStrictEqual([585+ expect(text).toContain("Decisions: 6 waiting, 1 due today.");586+ expect(sectionsOf(markup).slice(0, 2)).toStrictEqual([587 "Due today",601- "Within your budget",602- "Waits for tomorrow",588+ "Later",589 ]);604- expect(text).toContain("3 more wait for tomorrow");605- expect(rowsOf(markup)).toHaveLength(3);590+ expect(rowsOf(markup)).toHaveLength(6);591 592 for (const { body } of rowsOf(markup)) {593 expect(body).toContain("data-consequence=");594 }44 unmodified linesmodified:examples/datekit/.myr/project.ts-2 removed
6 unmodified lines7 * okonkwo for time zones.8 */9 export default project({10 agents: "trailer",11- budget: { decisionsPerDay: 5, expire: "14 days" },12- caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },11 deciders: {12 "**": ["ines-v"],13 "src/tz.ts": ["okonkwo"],14 },9 unmodified linesmodified:examples/datekit/layers/maintainers/.myr/layer.json+2 added-2 removed
110 unmodified lines111 "path": "checks/held-back/parser/fraction-digits.test.ts"112 }113 ],114 "knownBad": [115- "a7cd301d5ab4af2739219664a9428560f2c34e13",116- "b0e5923bb3def0fc727a11f44865113fed4601e1"115+ "45ca8fe0c30a6cd8ae7fe04c51be14291d2e2ef0",116+ "40e60812ff305096f34c1b340e7e7fdd00d438f1"117 ],118 "layer": "maintainers"119 }modified:examples/datekit/layers/maintainers/.myr/layer.ts+2 added-2 removed
134 unmodified lines135 },136 ],137 knownBad: [138 // known-bad/export: unescapes only the first pair of quotes.139- "a7cd301d5ab4af2739219664a9428560f2c34e13",139+ "45ca8fe0c30a6cd8ae7fe04c51be14291d2e2ef0",140 // known-bad/parser: rounds the digits past the millisecond.141- "b0e5923bb3def0fc727a11f44865113fed4601e1",141+ "40e60812ff305096f34c1b340e7e7fdd00d438f1",142 ],143 layer: "maintainers",144 });modified:packages/agent-kit/src/docs/run-a-project.ts+3 added-4 removed
23 unmodified lines24 "## The config folder",25 "",26 `How the project takes changes is TypeScript on \`main\`, in ${code(`${dir}/`)}. The platform reads it only from the commit it last landed, in a sandbox with no network and frozen time, so it changes the way everything else does: by a landing.`,27 "",28- `- ${code(`${dir}/project.ts`)}: who decides which paths, the kinds of ask the project takes, the daily budget of decisions, caps on claims and proposals, the commands the checks run, and who must be vouched for to claim.`,28+ `- ${code(`${dir}/project.ts`)}: who decides which paths, the kinds of ask the project takes, how long a decision waits before its default, the commands the checks run, and who must be vouched for to claim.`,29 `- ${code(`${dir}/asks/`)}: one file per ask.`,30 `- ${code(`${dir}/vouched.td`)}: who is vouched for, and who is denounced.`,31 `- ${code(`${dir}/visibility.ts`)}: layers and held-back checks, if any (see [Held-back checks and layers](/docs/held-back-checks)).`,32 "",33 "```ts",34 `import { kinds, project } from "${Brand.cliPackage}/rules";`,35 "",36 "export default project({",37- ' budget: { decisionsPerDay: 5, expire: "14 days" },',38- " caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },",37 ' deciders: { "**": ["ines-v"], "src/tz.ts": ["okonkwo"] },',38+ ' decisions: { expire: "14 days" },',39 " kinds: [kinds.fix],",40 ' run: { checks: { unit: "bun test" }, test: "bun test {path}" },',41 ' vouch: "forCode",',42 "});",45 unmodified lines88 `Anyone not denounced may propose an ask: ${cli('propose --project <owner>/<name> --want "<what should be true>"')}. A proposal expires unless a maintainer accepts it. With ${code("--draft")}, the platform's agent drafts the ask file and its failing check, runs them red first, and puts the draft to a maintainer with its evidence; ${cli("proposal <proposal> --project <owner>/<name>")} follows it, and ${cli("ask draft <proposal> --project <owner>/<name>")} asks for another round. Nothing lands until a maintainer accepts, and the landing discloses the agent in \`Assisted-by\`.`,89 "",90 "## Today",91 "",93- `A maintainer's day is a short list of decisions, each with its evidence and a safe default taken if nobody decides before it expires, held to the project's budget. Read it on the web in [your inbox](/inbox), or with ${cli("today")}, and take one with ${cli("decide --project <owner>/<name> --decision <decision> --choice accept")} (or \`decline\`, \`adopt\`, \`revert\`).`,92+ `A maintainer's Today is their open decisions, soonest to expire first, each with its evidence and a safe default taken if nobody decides before it expires. Read it on the web in [your inbox](/inbox), or with ${cli("today")}, and take one with ${cli("decide --project <owner>/<name> --decision <decision> --choice accept")} (or \`decline\`, \`adopt\`, \`revert\`).`,93 "",94 "## Finish an answer, or land your own change",95 "",96 `When an ask's kind requires a finish, a passing answer waits for a maintainer's own commits on top: ${cli("finish <ask> --project <owner>/<name> --base <base> --head <head> --requestId <id>")}. They are checked again, and the landing credits you with \`Finished-by\`.`,20 unmodified linesmodified:packages/agent-kit/src/agent-setup.ts+8 added-10 removed
230 unmodified lines231 232 const policyDefaults = () =>233 Schema.decodeSync(234 Schema.Struct({235- budget: PolicyInput.fields.budget,235 caps: PolicyInput.fields.caps,236 claims: PolicyInput.fields.claims,237+ decisions: PolicyInput.fields.decisions,238 })239 )({});240 241 export const agentLimits = (): readonly Limit[] => {242- const { budget, caps, claims } = policyDefaults();242+ const { caps, claims, decisions } = policyDefaults();243 244 return [245 {246- limit: "Claims one person holds at once, in a project",247- value: `${caps.claimsPerPerson} by default`,246+ limit:247+ "Claims one person nobody has vouched for holds at once, in a project",248+ value: `${caps.claimsPerPerson} by default; a vouched person and a maintainer are never held`,249 },250 {250- limit: "Open proposals one person holds, in a project",251+ limit:252+ "Open proposals one person nobody has vouched for holds, in a project",253 value: `${caps.proposalsPerPerson} by default; 0 turns proposals off`,254 },255 {256 limit: "A claim without a push",257 value: `Warned after ${span(claims.warnAfterMs)}, lapses after ${span(claims.lapseAfterMs)}, by default`,258 },259 {258- limit: "Decisions a maintainer takes a day",259- value: `${budget.decisionsPerDay} by default`,260- },261- {260 limit: "A decision nobody takes",263- value: `${span(budget.expireDays * 86_400_000)} by default, then it takes its default`,261+ value: `${span(decisions.expireDays * 86_400_000)} by default, then it takes its default`,262 },263 {264 limit: "Claims, proposals and drafts across the platform, per person",265 value:84 unmodified linesmodified:packages/agent-kit/test/golden/agent-setup.txt+2 added-3 removed
110 unmodified lines111 ## Limits112 113 | Limit | Value |114 | --- | --- |115-| Claims one person holds at once, in a project | 3 by default |116-| Open proposals one person holds, in a project | 2 by default; 0 turns proposals off |115+| Claims one person nobody has vouched for holds at once, in a project | 20 by default; a vouched person and a maintainer are never held |116+| Open proposals one person nobody has vouched for holds, in a project | 20 by default; 0 turns proposals off |117 | A claim without a push | Warned after 2 hours, lapses after 1 day, by default |118-| Decisions a maintainer takes a day | 5 by default |118 | A decision nobody takes | 2 weeks by default, then it takes its default |119 | Claims, proposals and drafts across the platform, per person | A set number a minute; past it, CapReached says when to try again |120 121 ## Refusals14 unmodified linesmodified:packages/agent-kit/test/agent-setup.test.ts+2 added-3 removed
232 unmodified lines233 it("states the limits a policy sets by default, as a person says them", () => {234 const values = agentLimits().map(({ value }) => value);235 236 expect(values).toStrictEqual([237- "3 by default",238- "2 by default; 0 turns proposals off",237+ "20 by default; a vouched person and a maintainer are never held",238+ "20 by default; 0 turns proposals off",239 "Warned after 2 hours, lapses after 1 day, by default",240- "5 by default",240 "2 weeks by default, then it takes its default",241 "A set number a minute; past it, CapReached says when to try again",242 ]);243 28 unmodified linesmodified:packages/agent-kit/test/fixtures.ts+1 added-1 removed
107 unmodified lines108 territory: format,109 },110 ],111 at: landed,112- budget: { decisionsPerDay: 5, expireDays: 14 },112 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },113 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },114 deciders: [{ handles: [askedBy], paths: "**" }],115+ decisions: { expireDays: 14 },116 functions: { admit: false, opensAlone: false },117 judge: {118 paths: [`${Brand.configDir}/**`, "bunfig.toml", "tsconfig.json"],119 pointers: ["package.json#/scripts"],86 unmodified linesmodified:packages/gate/test/facts.ts+1 added-1 removed
88 unmodified lines89 export const policy = Schema.decodeSync(Policy)({90 agents: "trailer",91 asks: [askWire],92 at: landedSha,93- budget: { decisionsPerDay: 5, expireDays: 14 },93 caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },94 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },95 deciders: [{ handles: [alice], paths: "**" }],96+ decisions: { expireDays: 14 },97 functions: { admit: false, opensAlone: false },98 judge: {99 paths: [100 `${configDir}/**`,83 unmodified linesdeleted:packages/project/src/attention/budget.ts-54 removed
1-import type { Today } from "@repo/protocol/domain/decision";2-import type { Policy } from "@repo/protocol/domain/policy";3-import { sameHandle } from "@repo/protocol/ids";4-import type { Handle } from "@repo/protocol/ids";5-import { DateTime } from "effect";6-7-import type { BudgetDayRow } from "../project-store/rows.ts";8-9-export type Budget = Today["budget"];10-11-const dayOf = (now: DateTime.Utc) => DateTime.formatIsoDateUtc(now);12-13-const rowFor = (14- days: readonly BudgetDayRow[],15- decider: Handle,16- now: DateTime.Utc17-) => {18- const day = dayOf(now);19-20- return (21- days.find((row) => row.day === day && sameHandle(row.decider, decider)) ?? {22- day,23- decider,24- finishes: 0,25- used: 0,26- }27- );28-};29-30-export const budgetFor = (31- policy: Policy,32- decider: Handle,33- days: readonly BudgetDayRow[],34- now: DateTime.Utc35-): Budget => {36- const { finishes, used } = rowFor(days, decider, now);37-38- return { finishes, total: policy.budget.decisionsPerDay, used };39-};40-41-export const spend = (42- days: readonly BudgetDayRow[],43- input: {44- readonly decider: Handle;45- readonly on: "decision" | "finish";46- readonly now: DateTime.Utc;47- }48-): BudgetDayRow => {49- const row = rowFor(days, input.decider, input.now);50-51- return input.on === "finish"52- ? { ...row, finishes: row.finishes + 1 }53- : { ...row, used: row.used + 1 };54-};modified:packages/project/src/attention/promote.ts+2 added-2 removed
384 unmodified lines385 },386 ];387 388 const proposal: Proposal = {389- expiresAt: DateTime.add(now, { days: policy.budget.expireDays }),389+ expiresAt: DateTime.add(now, { days: policy.decisions.expireDays }),390 files: [path],391 id: input.ids.proposal,392 openedAt: now,393 project: input.project,5 unmodified lines399 400 const decision = openDecision({401 deciders: deciding,402 evidence,403- expireDays: policy.budget.expireDays,403+ expireDays: policy.decisions.expireDays,404 id: input.ids.decision,405 now,406 project: input.project,407 subject: DecisionSubject.cases.OpenProposal.make({28 unmodified linesmodified:packages/project/src/attention/proposals.ts+1 added-1 removed
96 unmodified lines97 : Result.void;98 };99 100 const opening = (policy: Policy, proposer: Proposer, now: DateTime.Utc) => ({101- expiresAt: DateTime.add(now, { days: policy.budget.expireDays }),101+ expiresAt: DateTime.add(now, { days: policy.decisions.expireDays }),102 id: proposer.id,103 openedAt: now,104 project: proposer.project,105 proposer: proposer.who.handle,209 unmodified linesmodified:packages/project/src/attention/today.ts+3 added-9 removed
3 unmodified lines4 import { sameHandle } from "@repo/protocol/ids";5 import type { Handle } from "@repo/protocol/ids";6 import { Array as Arr, DateTime, Order } from "effect";7 8-import type { Budget } from "./budget.ts";9-8 const soon = { hours: 24 } as const;9 10 const welcome = { days: 7 } as const;11 20 unmodified lines32 const isUnattended = (landing: LandingView) =>33 landing.ask !== undefined &&34 !landing.credits.some(({ role }) => attended.has(role));35 36+/** Every open decision the decider holds, soonest to expire first: nothing is held back. */37 export const today = (input: {38 readonly decider: Handle;39 readonly decisions: readonly Decision[];41- readonly budget: Budget;40 readonly firstClaims: readonly {41 readonly handle: Handle;42 readonly at: DateTime.Utc;43 }[];44 readonly landings: readonly LandingView[];45 readonly now: DateTime.Utc;46 }): Today => {49- const { budget, decider, now } = input;47+ const { decider, now } = input;48 49 const theirs = Arr.sort(50 input.decisions.filter(51 (decision) =>3 unmodified lines55 ),56 byExpiry57 );58 61- const room = Math.max(0, budget.total - budget.used);62- const shown = theirs.slice(0, room);59 const until = DateTime.add(now, soon);60 const since = DateTime.subtract(now, welcome);61 62 return {67- budget,63 decider,69- decisions: shown,64+ decisions: theirs,65 expiringSoon: theirs66 .filter(({ expiresAt }) => DateTime.isLessThanOrEqualTo(expiresAt, until))67 .map(({ id }) => id),68 newcomers: Arr.dedupe(69 input.firstClaims70 .filter(({ at }) => DateTime.isGreaterThanOrEqualTo(at, since))71 .map(({ handle }) => handle)72 ),78- overflow: theirs.length - shown.length,73 unattended: Arr.sort(74 input.landings.filter(isUnattended),75 newestFirst76 ).slice(0, sampled),2 unmodified linesmodified:packages/project/src/project-store/memory.ts-1 removed
71 unmodified lines72 return {73 answers: yield* all(state, Tables.answers),74 asks: yield* all(state, Tables.asks),75 attempts: yield* all(state, Tables.attempts),76- budgetDays: yield* all(state, Tables.budgetDays),76 claims: yield* all(state, Tables.claims),77 decisions: yield* all(state, Tables.decisions),78 envValues: yield* all(state, Tables.envValues),79 landings: yield* decodeAll(158 unmodified linesmodified:packages/project/src/project-store/migrations.ts+8 added
80 unmodified lines81 body TEXT NOT NULL82 )`;83 });84 85+// A maintainer's day has no budget: Today shows every open decision.86+const dropBudgetDays = Effect.gen(function* () {87+ const sql = yield* SqlClient;88+89+ yield* sql`DROP TABLE budget_days`;90+});91+92 const migrations = {93 "1_project_state": projectState,94 "2_visibility": visibility,95+ "3_drop_budget_days": dropBudgetDays,96 };97 98 export const migrate: Effect.Effect<99 readonly (readonly [id: number, name: string])[],6 unmodified linesmodified:packages/project/src/project-store/rows.ts-9 removed
83 unmodified lines84 export const DecisionRow = Decision;85 86 export type DecisionRow = typeof DecisionRow.Type;87 88-export const BudgetDayRow = Schema.Struct({89- day: Schema.String,90- decider: Handle,91- finishes: Schema.Int,92- used: Schema.Int,93-});94-95-export type BudgetDayRow = typeof BudgetDayRow.Type;96-88 export const RatchetRow = Schema.Struct({89 at: LandedSha,90 count: Schema.Int,91 ratchet: RatchetName,87 unmodified linesmodified:packages/project/src/project-store/sqlite.ts-1 removed
176 unmodified lines177 return {178 answers: yield* all(Tables.answers),179 asks: yield* all(Tables.asks),180 attempts: yield* all(Tables.attempts),181- budgetDays: yield* all(Tables.budgetDays),181 claims: yield* all(Tables.claims),182 decisions: yield* all(Tables.decisions),183 envValues: yield* all(Tables.envValues),184 landings: yield* bodiesOf(23 unmodified linesmodified:packages/project/src/project-store/tables.ts-8 removed
4 unmodified lines5 import {6 AnswerRow,7 AskRow,8 AttemptRow,9- BudgetDayRow,9 ClaimRow,10 DecisionRow,11 EnvValueRow,12 LandingRow,53 unmodified lines66 claimant: row.claimant,67 week: row.week,68 })69 ),71- budgetDays: tableOf(72- "budget_days",73- BudgetDayRow,74- ["decider", "day"],75- (row) => ({ day: row.day, decider: row.decider })76- ),70 claims: tableOf("claims", ClaimRow, ["ask", "claimant"], (row) => ({71 ask: row.ask,72 claimant: row.claimant,73 })),90 unmodified lines164 yield* upsert(QueueTable, writes.queue === undefined ? [] : [writes.queue]);165 yield* upsert(Tables.landings, writes.landings ?? []);166 yield* upsert(Tables.proposals, writes.proposals ?? []);167 yield* upsert(Tables.decisions, writes.decisions ?? []);175- yield* upsert(Tables.budgetDays, writes.budgetDays ?? []);168 yield* upsert(Tables.ratchets, writes.ratchets ?? []);169 yield* upsert(Tables.pushEvents, writes.pushEvents ?? []);170 yield* upsert(EventTable, events);171 yield* upsert(Tables.outbox, writes.outbox ?? []);8 unmodified linesmodified:packages/project/src/visibility/claims.ts+15 added
56 unmodified lines57 readonly refusals: readonly (AttemptsExhausted | HeldBackFailed)[];58 readonly trailer: Option.Option<string>;59 }60 61+/**62+ * A failing area is refused as `HeldBackFailed`, and counted against the63+ * claimant's attempts when they are `throttled`: a layer's own readers and64+ * writers may read the checks anyway, so their failures are counted by nobody65+ * and never exhausted.66+ */67 export const judgeAttempts = (input: {68 readonly attempts: readonly AttemptRow[];69 readonly ask: AskId;70 readonly checks: SealedChecks;71 readonly claimant: Handle;72 readonly now: DateTime.Utc;73 readonly results: readonly HeldBackResult[];74 readonly suite: SuiteRoot;75+ readonly throttled: boolean;76 }): AttemptsJudged => {77 const week = isoWeek(input.now);78 79 const areas = Arr.sort(Object.keys(input.checks.areas), Order.String).map(18 unmodified lines98 if (results.length === 0) {99 continue;100 }101 102+ if (!input.throttled) {103+ if (!results.every(({ passed, total }) => passed >= total)) {104+ refusals.push(new HeldBackFailed({ area, suite: input.suite }));105+ }106+107+ continue;108+ }109+110 const own = input.attempts.find(111 (row) => thisWeek(row, area) && row.ask === input.ask112 );113 59 unmodified linesmodified:packages/project/src/visibility/env.ts+1 added-1 removed
350 unmodified lines351 [is.declaredIn.get(item) ?? rootSchema],352 landed.row.initializer353 ),354 evidence,355- expireDays: policy.budget.expireDays,355+ expireDays: policy.decisions.expireDays,356 id,357 now,358 project: landed.row.project,359 subject: DecisionSubject.cases.ProxyWidened.make({116 unmodified linesmodified:packages/project/src/visibility/state.ts+26 added-5 removed
223 unmodified lines224 value: Arr.dedupeWith(input.landedBy, sameHandle).join(", "),225 },226 ]),227 ],228- expireDays: input.after.budget.expireDays + noticeDays,228+ expireDays: input.after.decisions.expireDays + noticeDays,229 id: nextDecisionId(input.snapshot.decisions, new Map()),230 now: input.now,231 project: input.project,232 subject: DecisionSubject.cases.PostureChange.make({37 unmodified lines270 return names(membersOf(policy, layer.readers), who) ? "read" : "none";271 };272 273 const judgeHeldBack: VisibilityPort["judgeHeldBack"] = (input, snapshot) => {274- const checks = Option.flatMap(visibilityIn(snapshot), ({ checks: sealed }) =>275- Option.fromUndefinedOr(sealed)274+ const sealed = Option.flatMap(policyIn(snapshot), (policy) =>275+ Option.map(Option.fromUndefinedOr(policy.visibility?.checks), (checks) => ({276+ checks,277+ policy,278+ }))279 );280 278- if (Option.isNone(checks)) {281+ if (Option.isNone(sealed)) {282 return { refusals: [], trailer: Option.none(), writes: {} };283 }284 285+ const { checks, policy } = sealed.value;286+287+ // The sealing layer's own readers and writers may read the checks anyway:288+ // their attempts are counted by nobody.289+ const throttled = Option.match(290+ Arr.findFirst(291+ policy.visibility?.layers ?? [],292+ ({ name }) => name === checks.layer293+ ),294+ {295+ onNone: () => true,296+ onSome: (layer) =>297+ reach(policy, layer, Person.make({ handle: input.claimant })) ===298+ "none",299+ }300+ );301+302 const judged = judgeAttempts({303 ask: input.ask,304 attempts: snapshot.attempts,285- checks: checks.value,305+ checks,306 claimant: input.claimant,307 now: input.now,308 results: input.results,309 suite: input.pinned.suite,310+ throttled,311 });312 313 return {314 refusals: judged.refusals,768 unmodified linesmodified:packages/project/src/deciders.ts+8 added-35 removed
77 unmodified lines78 import type { Redacted } from "effect";79 80 import type { Advanced, AnswerQueue, AnswerRun } from "./answer-runs.ts";81 import { isStep, runStep } from "./answer-runs/steps.ts";82-import { budgetFor, spend } from "./attention/budget.ts";82 import { creditsByArea } from "./attention/credits.ts";83 import {84 decide,85 decidersFor,38 unmodified lines124 startRow,125 } from "./outbox.ts";126 import type {127 AnswerRow,129- BudgetDayRow,128 ClaimRow,129 OutboxRow,130 ProjectRow,131 } from "./project-store/rows.ts";116 unmodified lines248 };249 readonly row: AnswerRow;250 }[];251 readonly asks: ReadonlyMap<AskId, Ask>;254- readonly budgetDays: readonly BudgetDayRow[];252 readonly claims: readonly {253 readonly row: ClaimRow;254 readonly state: ClaimState;255 }[];4 unmodified lines260 readonly proposals: readonly Proposal[];261 }262 263 export interface DeciderWrites {267- readonly budgetDays: Map<string, BudgetDayRow>;264 readonly decisions: Map<DecisionId, Decision>;265 readonly events: ProjectEventInput[];266 readonly landings: LandingView[];267 readonly outbox: OutboxRow[];324 unmodified lines592 }): Decision =>593 openDecision({594 deciders: decidersOn(input.policy, [], input.initializer),595 evidence: [],600- expireDays: input.policy.budget.expireDays,596+ expireDays: input.policy.decisions.expireDays,597 id: input.id,598 now: input.now,599 project: input.project,600 subject: DecisionSubject.cases.StrayPush.make({69 unmodified lines670 671 const decisionsNow = (h: H, writes: W) =>672 overlaid(h.decisions, writes.decisions);673 678- const spent = (679- h: H,680- writes: W,681- input: {682- readonly decider: Handle;683- readonly now: DateTime.Utc;684- readonly on: "decision" | "finish";685- }686- ) => {687- const row = spend([...writes.budgetDays.values(), ...h.budgetDays], input);688-689- writes.budgetDays.set(`${row.day}|${row.decider}`, row);690- };691-674 const recordLanding = (675 h: H,676 writes: W,677 landing: LandingView,50 unmodified lines728 729 const decision = openDecision({730 deciders: decidersOn(policy, input.paths, input.row.initializer),731 evidence: input.evidence,750- expireDays: policy.budget.expireDays,732+ expireDays: policy.decisions.expireDays,733 id: DecisionId.make(minted("dec", decisionsNow(h, writes).length)),734 now,735 project: name,736 subject: DecisionSubject.cases.OpenProposal.make({202 unmodified lines939 940 const decision = openDecision({941 deciders: decidedBy,942 evidence,961- expireDays: live.policy.budget.expireDays,943+ expireDays: live.policy.decisions.expireDays,944 id: DecisionId.make(minted("dec", decisionsNow(h, writes).length)),945 now,946 project: name,947 subject: DecisionSubject.cases.OpenProposal.make({707 unmodified lines1655 })1656 );1657 1658 writes.decisions.set(taken.decision.id, taken.decision);1677- spent(h, writes, { decider: by, now, on: "decision" });1659 1660 yield* settleDecided(h, writes, now, taken);1661 1662 return { decision: taken.decision };52 unmodified lines1715 1716 const { landed: main, policy } = live.value;1717 1718 // The maintainer as the policy spells them, as `decide` and Today do:1738- // the budget row and the credit name one person however they sign in.1719+ // the credit names one person however they sign in.1720 const by = Option.getOrElse(1721 asDecider(policy, caller.handle),1722 () => caller.handle1723 );41 unmodified lines1765 1766 const { record, row } = waiting.value;1767 const { request } = record.landing;1768 1788- spent(h, writes, { decider: by, now, on: "finish" });1789-1769 if (input.head === request.head) {1770 const advanced = yield* advanceAndRun(1771 h,1772 writes,338 unmodified lines2111 Effect.gen(function* () {2112 const h = yield* kernel.read;2113 const now = yield* DateTime.now;2114 2136- const found = Option.flatMap(h.policy, (policy) =>2137- Option.map(asDecider(policy, caller.handle), (decider) => ({2138- decider,2139- policy,2140- }))2115+ const decider = Option.flatMap(h.policy, (policy) =>2116+ asDecider(policy, caller.handle)2117 );2118 2143- if (Option.isNone(found)) {2119+ if (Option.isNone(decider)) {2120 return yield* new NotDecider({});2121 }2122 2147- const { decider, policy } = found.value;2148-2123 return today({2150- budget: budgetFor(policy, decider, h.budgetDays, now),2151- decider,2124+ decider: decider.value,2125 decisions: h.decisions,2126 firstClaims: firstClaimsOf(h.claims),2127 landings: h.landings,2128 now,58 unmodified linesmodified:packages/project/src/project-store.ts-3 removed
5 unmodified lines6 import type {7 AnswerRow,8 AskRow,9 AttemptRow,10- BudgetDayRow,10 ClaimRow,11 DecisionRow,12 EnvValueRow,13 EventRow,17 unmodified lines31 export interface ProjectSnapshot {32 readonly answers: readonly AnswerRow[];33 readonly asks: readonly AskRow[];34 readonly attempts: readonly AttemptRow[];36- readonly budgetDays: readonly BudgetDayRow[];35 readonly claims: readonly ClaimRow[];36 readonly decisions: readonly DecisionRow[];37 readonly envValues: readonly EnvValueRow[];38 readonly landings: readonly LandingRow[];10 unmodified lines49 export interface ProjectWrites {50 readonly answers?: readonly AnswerRow[];51 readonly asks?: readonly AskRow[];52 readonly attempts?: readonly AttemptRow[];55- readonly budgetDays?: readonly BudgetDayRow[];53 readonly claims?: readonly ClaimRow[];54 readonly decisions?: readonly DecisionRow[];55 readonly envValues?: readonly EnvValueRow[];56 readonly events?: readonly ProjectEventInput[];50 unmodified linesmodified:packages/project/src/project.ts+1 added-13 removed
280 unmodified lines281 import type { ProjectSnapshot, ProjectWrites } from "./project-store.ts";282 import type {283 AnswerRow,284 AttemptRow,285- BudgetDayRow,285 ClaimRow,286 EnvValueRow,287 LayerRead,288 LayerRow,637 unmodified lines926 927 interface Hydrated {928 readonly answers: readonly Answered[];929 readonly asks: ReadonlyMap<AskId, Ask>;931- readonly budgetDays: readonly BudgetDayRow[];930 readonly claims: readonly Claimed[];931 readonly decisions: readonly Decision[];932 readonly landings: readonly LandingView[];933 readonly lastSeq: number;10 unmodified lines944 interface Writes {945 readonly answers: Map<RequestId, AnswerRow>;946 readonly asks: Map<AskId, Ask>;947 readonly attempts: Map<string, AttemptRow>;950- readonly budgetDays: Map<string, BudgetDayRow>;948 readonly claims: Map<string, ClaimRow>;949 readonly decisions: Map<DecisionId, Decision>;950 readonly envValues: Map<EnvKey, EnvValueRow>;951 readonly events: ProjectEventInput[];12 unmodified lines964 const writesOf = (): Writes => ({965 answers: new Map(),966 asks: new Map(),967 attempts: new Map(),971- budgetDays: new Map(),968 claims: new Map(),969 decisions: new Map(),970 envValues: new Map(),971 events: [],13 unmodified lines985 [986 writes.answers.size,987 writes.asks.size,988 writes.attempts.size,993- writes.budgetDays.size,989 writes.claims.size,990 writes.decisions.size,991 writes.envValues.size,992 writes.events.length,54 unmodified lines1047 Tables.attempts,1048 held.attempts,1049 writes.attempts.values()1050 ),1056- budgetDays: overlaid(1057- Tables.budgetDays,1058- held.budgetDays,1059- writes.budgetDays.values()1060- ),1051 claims: overlaid(Tables.claims, held.claims, writes.claims.values()),1052 decisions: overlaid(1053 Tables.decisions,1054 held.decisions,815 unmodified lines1870 1871 return {1872 answers,1873 asks: new Map(snapshot.asks.map((ask) => [ask.id, ask])),1884- budgetDays: snapshot.budgetDays,1874 claims,1875 decisions: snapshot.decisions,1876 landings: snapshot.landings,1877 lastSeq: snapshot.lastSeq,177 unmodified lines2055 const all: ProjectWrites = {2056 answers: [...writes.answers.values()],2057 asks: [...writes.asks.values()],2058 attempts: [...writes.attempts.values()],2070- budgetDays: [...writes.budgetDays.values()],2059 claims: [...writes.claims.values()],2060 decisions: [...writes.decisions.values()],2061 envValues: [...writes.envValues.values()],2062 events: writes.events,1178 unmodified lines3241 : changed,3242 initializer3243 ),3244 evidence: evidenceFor(request, subject),3257- expireDays: policy.budget.expireDays,3245+ expireDays: policy.decisions.expireDays,3246 id: nextDecisionId(h.decisions, writes.decisions),3247 now,3248 project: name,3249 subject,2294 unmodified linesmodified:packages/project/test/attention/today.test.ts+7 added-133 removed
7 unmodified lines8 import { at } from "@repo/testkit/clock";9 import { aProject, ids, sha, withAsk } from "@repo/testkit/scenarios";10 import { Array as Arr, DateTime, Option, Result } from "effect";11 12-import { budgetFor, spend } from "../../src/attention/budget.ts";12 import {13 decide,14 decidersFor,15 openDecision,16 } from "../../src/attention/decisions.ts";17 import { today } from "../../src/attention/today.ts";19-import type { BudgetDayRow } from "../../src/project-store/rows.ts";18 19 const scenario = aProject({20 deciders: ["alice", "dana"],21 people: ["bob", "carol", "erin", "frank"],38 unmodified lines60 const p8 = vouchFor("p8", 200);61 62 const eight = [p5, p1, p8, p3, p2, p7, p4, p6];63 66-const fresh = { finishes: 0, total: 5, used: 0 };67-64 const todayFor = (65 input: Partial<Parameters<typeof today>[0]> & {66 readonly decisions: readonly Decision[];67 }68 ) =>69 today({74- budget: fresh,70 decider: alice,71 firstClaims: [],72 landings: [],73 now,74 ...input,75 });76 77 describe("a maintainer's Today", () => {83- it("holds the decisions that expire first to the budget, and counts the overflow", () => {78+ it("shows every open decision, the ones that expire first first, and holds none back", () => {79 const page = todayFor({ decisions: eight });80 86- expect(page.decisions).toStrictEqual([p1, p2, p3, p4, p5]);87- expect(page.overflow).toBe(3);88- expect(page.budget).toStrictEqual(fresh);81+ expect(page.decisions).toStrictEqual([p1, p2, p3, p4, p5, p6, p7, p8]);82 expect(page.decider).toBe(alice);83 });84 85 it("shows a maintainer their decisions however sign-in cases the handle", () => {86 const page = todayFor({ decider: handle("ALICE"), decisions: eight });87 95- expect(page.decisions).toStrictEqual([p1, p2, p3, p4, p5]);88+ expect(page.decisions).toStrictEqual([p1, p2, p3, p4, p5, p6, p7, p8]);89 });90 98- it("shows only what is left of the budget once some of it is used", () => {99- const page = todayFor({100- budget: { finishes: 0, total: 5, used: 2 },101- decisions: eight,102- });91+ it("calls out every decision expiring within 24 hours", () => {92+ const page = todayFor({ decisions: eight });93 104- expect(page.decisions).toStrictEqual([p1, p2, p3]);105- expect(page.overflow).toBe(5);94+ expect(page.expiringSoon).toStrictEqual([p1.id, p2.id]);95 });96 108- it("shows none when more was used than the day's budget now allows", () => {109- // The policy lowered decisionsPerDay after the maintainer had spent more.110- const page = todayFor({111- budget: { finishes: 0, total: 3, used: 5 },112- decisions: eight,113- });114-115- expect(page.decisions).toStrictEqual([]);116- expect(page.overflow).toBe(8);117- });118-119- it("calls out every decision expiring within 24 hours, over the budget too", () => {120- const spent = todayFor({121- budget: { finishes: 0, total: 5, used: 5 },122- decisions: eight,123- });124-125- expect(spent.decisions).toStrictEqual([]);126- expect(spent.overflow).toBe(8);127- expect(spent.expiringSoon).toStrictEqual([p1.id, p2.id]);128- });129-97 it("leaves out decisions already taken, and those past their expiry", () => {98 // p1 was taken; p2 reaches its expiry at +20 h.99 const taken = Result.getOrThrow(100 decide(eight, {11 unmodified lines112 ),113 now: DateTime.add(now, { hours: 20 }),114 });115 149- expect(page.decisions).toStrictEqual([p3, p4, p5, p6, p7]);150- expect(page.overflow).toBe(1);116+ expect(page.decisions).toStrictEqual([p3, p4, p5, p6, p7, p8]);117 });118 119 it("leaves out decisions for paths the maintainer does not own", () => {120 const policy = {94 unmodified lines215 [1, 2, 3, 4, 5].map((hoursAgo) => unattended(hoursAgo))216 );217 });218 });253-254-const spendAll = (255- spends: readonly {256- readonly decider: Handle;257- readonly on: "decision" | "finish";258- readonly now: DateTime.Utc;259- }[]260-) => {261- let days: readonly BudgetDayRow[] = [];262-263- for (const each of spends) {264- const row = spend(days, each);265-266- days = [267- ...days.filter(268- ({ day, decider }) => !(day === row.day && decider === row.decider)269- ),270- row,271- ];272- }273-274- return days;275-};276-277-describe("the budget", () => {278- const thursday = now;279- const wednesday = at("2026-10-07T18:00:00Z");280-281- it("counts the decisions a maintainer already took today against used", () => {282- const days = spendAll([283- { decider: alice, now: wednesday, on: "decision" },284- { decider: alice, now: thursday, on: "decision" },285- { decider: dana, now: thursday, on: "decision" },286- {287- decider: alice,288- now: DateTime.add(thursday, { hours: 1 }),289- on: "decision",290- },291- ]);292-293- expect(budgetFor(scenario.policy, alice, days, thursday)).toStrictEqual({294- finishes: 0,295- total: 5,296- used: 2,297- });298- });299-300- it("counts what a maintainer spent under any casing of their handle", () => {301- const days = spendAll([{ decider: alice, now: thursday, on: "decision" }]);302-303- expect(304- budgetFor(scenario.policy, handle("Alice"), days, thursday).used305- ).toBe(1);306- });307-308- it("counts a finish apart from the decisions", () => {309- const days = spendAll([310- { decider: alice, now: thursday, on: "finish" },311- { decider: alice, now: thursday, on: "decision" },312- ]);313-314- expect(budgetFor(scenario.policy, alice, days, thursday)).toStrictEqual({315- finishes: 1,316- total: 5,317- used: 1,318- });319- });320-321- it("starts each UTC day fresh, at the policy's decisions per day", () => {322- const policy = {323- ...scenario.policy,324- budget: { ...scenario.policy.budget, decisionsPerDay: 3 },325- };326-327- const days = spendAll([{ decider: alice, now: wednesday, on: "decision" }]);328-329- expect(budgetFor(policy, alice, days, thursday)).toStrictEqual({330- finishes: 0,331- total: 3,332- used: 0,333- });334-335- expect(336- spend(days, { decider: alice, now: wednesday, on: "decision" })337- ).toStrictEqual({338- day: "2026-10-07",339- decider: alice,340- finishes: 0,341- used: 2,342- });343- });344-});modified:packages/project/test/visibility/attempts.test.ts+51 added-2 removed
13 unmodified lines14 import { attemptsLeft, isoWeek } from "../../src/visibility/claims.ts";15 import { CheckScript, mergedAt, Pusher } from "../world.ts";16 import {17 bob,18+ inesV,19 countersigned,20 firstSuite,21 mainFiles,22 mainTip,71 unmodified lines94 95 return { api, pinned };96 });97 97-const claimOn = (ask: string, pinned: PinnedClaim["pinned"]): PinnedClaim => ({98+const claimOn = (99+ ask: string,100+ pinned: PinnedClaim["pinned"],101+ claimant = bob.handle102+): PinnedClaim => ({103 ask: AskId.make(ask),99- claimant: bob.handle,104+ claimant,105 pinned,106 });107 108 const bits = (89 unmodified lines198 }).pipe(Effect.provide(visibilityWorld()))199 );200 201 it.effect(202+ "counts no attempt for the sealing layer's own reader and writer: a maintainer's failure is refused, never exhausted, and writes no row",203+ () =>204+ Effect.gen(function* () {205+ const { pinned } = yield* suiteSealed;206+ const failing = bits(pinned, 1);207+208+ const failed = new HeldBackFailed({209+ area: exportArea,210+ suite: pinned.suite,211+ });212+213+ // Past the claim's three and the week's ten alike.214+ const asks = Array.makeBy(12, (index) =>215+ index < 6 ? "parse-iso" : "trim-input"216+ );217+218+ const judgements = yield* Effect.forEach(asks, (ask) =>219+ judged(claimOn(ask, pinned, inesV.handle), failing)220+ );221+222+ const passing = yield* judged(223+ claimOn("fix-a", pinned, inesV.handle),224+ bits(pinned, 2)225+ );226+227+ expect({228+ passing: [passing.refusals, Option.isSome(passing.trailer)],229+ refusals: Array.dedupe(230+ judgements.flatMap(({ refusals }) => refusals)231+ ),232+ rows: (yield* stored).attempts,233+ writes: Array.dedupe(234+ judgements.flatMap(({ writes }) => Object.keys(writes))235+ ),236+ }).toStrictEqual({237+ passing: [[], true],238+ refusals: [failed],239+ rows: [],240+ writes: [],241+ });242+ }).pipe(Effect.provide(visibilityWorld()))243+ );244+245+ it.effect(246 "gives a run that passes every area the Held-back trailer, and counts nothing",247 () =>248 Effect.gen(function* () {249 const { pinned } = yield* suiteSealed;119 unmodified linesmodified:packages/project/test/deciders.test.ts+7 added-22 removed
382 unmodified lines383 .decide(alice, { choice: "accept", decision: firstDecision })384 .pipe(Effect.result, Effect.map(Result.getFailure));385 386 const between = yield* stored;387- const { budget } = yield* api.today(alice);387 388 yield* redOnMain(files);389 390 const accepted = yield* api6 unmodified lines397 398 return {399 accepted,400 blocked,402- budget,401 decided: between.decisions.map(({ decided }) => decided),402 listed: (yield* api.listAsks(anyone)).asks.map(({ ask }) => ask),403 proposals: between.proposals.map(({ state }) => state),404 };133 unmodified lines538 (run) => {539 expect(run.blocked).toStrictEqual(540 Option.some(new VerifierBlocked({}))541 );544- expect([run.decided, run.proposals, run.budget]).toStrictEqual([542+ expect([run.decided, run.proposals]).toStrictEqual([543 [undefined],544 ["open"],547- { finishes: 0, total: 5, used: 0 },545 ]);546 expect([run.accepted, run.listed]).toStrictEqual([547 Option.some("accept"),548 [AskId.make("trim-input")],85 unmodified lines634 return {635 again: yield* api.finish(aliceSignedIn, finish),636 answer,637 bobFinishes,641- budget: (yield* api.today(alice)).budget,638 commit: yield* commitOf(landed),639 landed,640 receipt,641 settled: (yield* api.status(bob)).answers.map(({ outcome }) => outcome),150 unmodified lines792 )793 );794 795 it.effect(800- "lands the answer credited Finished-by, once however often it is sent, and counts in the maintainer's budget, however her sign-in cases her handle",796+ "lands the answer credited Finished-by, once however often it is sent, however her sign-in cases her handle",797 () =>798 Effect.map(seen, (run) => {799 expect([run.settled, run.again.outcome]).toStrictEqual([800 [Outcome.cases.Landed.make({ sha: run.landed })],11 unmodified lines812 { key: "Signed-off-by", value: userOf("bob") },813 { key: "Finished-by", value: userOf("alice") },814 ],815 });820- expect(run.budget).toStrictEqual({ finishes: 1, total: 5, used: 0 });816 })817 );818 });819 345 unmodified lines1165 );1166 1167 describe("Today", () => {1168 it.effect(1174- "shows a maintainer at most the budget's decisions, soonest to expire first, and counts the rest as overflow",1169+ "shows a maintainer every open decision, soonest to expire first; one taken leaves the list and a flag raised joins it",1170 () =>1171 Effect.map(1172 Effect.flatMap(begun, (api) =>1173 Effect.andThen(openRed(api, "parse-iso"), filling(api))1174 ).pipe(Effect.provide(worldOf(scenario, "memory"))),1175 (seen) => {1176 expect({1182- budget: seen.full.budget,1177 decider: seen.full.decider,1178 decisions: idsOf(seen.full.decisions),1185- overflow: seen.full.overflow,1179 }).toStrictEqual({1187- budget: { finishes: 0, total: 5, used: 0 },1180 decider: alice.handle,1189- decisions: decisionIds(1, 5),1190- overflow: 1,1181+ decisions: decisionIds(1, 6),1182 });1192- expect({1193- budget: seen.afterOne.budget,1194- decisions: idsOf(seen.afterOne.decisions),1195- overflow: seen.afterOne.overflow,1196- }).toStrictEqual({1197- budget: { finishes: 0, total: 5, used: 1 },1198- decisions: decisionIds(2, 5),1199- overflow: 2,1200- });1183+ expect(idsOf(seen.afterOne.decisions)).toStrictEqual(1184+ decisionIds(2, 7)1185+ );1186 expect(seen.bobToday).toStrictEqual(new NotDecider({}));1187 }1188 )1189 );303 unmodified linesmodified:packages/project/test/project-store-sqlite.test.ts+1 added
18 unmodified lines19 Effect.gen(function* () {20 expect(yield* migrate).toStrictEqual([21 [1, "project_state"],22 [2, "visibility"],23+ [3, "drop_budget_days"],24 ]);25 expect(yield* migrate).toStrictEqual([]);26 }).pipe(Effect.provide(database))27 );12 unmodified linesmodified:packages/project/test/project-store.contract.ts+18 added-36 removed
19 unmodified lines20 import {21 AnswerRow,22 AskRow,23 AttemptRow,24- BudgetDayRow,24 ClaimRow,25 DecisionRow,26 EnvValueRow,27 LandingRow,47 unmodified lines75 const project = {76 createdAt: at(0),77 initializer: "alice",78 landed: sha(1),80- policy: { budget: { decisionsPerDay: 5 } },79+ policy: { decisions: { expireDays: 14 } },80 policyAt: sha(1),81 project: "alice/datekit",82 state: "live",83 } satisfies (typeof ProjectRow)["Encoded"];77 unmodified lines161 proposal: ProposalId.make("prop-000001"),162 }),163 } satisfies (typeof DecisionRow)["Encoded"];164 166-const budgetDay = {167- day: "2026-10-07",168- decider: "alice",169- finishes: 0,170- used: 1,171-} satisfies (typeof BudgetDayRow)["Encoded"];172-165 const ratchet = {166 at: sha(1),167 count: 12,168 ratchet: "anyCount",100 unmodified lines269 const EncodedSnapshot = Schema.Struct({270 answers: Schema.Array(AnswerRow),271 asks: Schema.Array(AskRow),272 attempts: Schema.Array(AttemptRow),281- budgetDays: Schema.Array(BudgetDayRow),273 claims: Schema.Array(ClaimRow),274 decisions: Schema.Array(DecisionRow),275 envValues: Schema.Array(EnvValueRow),276 landings: Schema.Array(LandingRow),10 unmodified lines287 const empty = {288 answers: [],289 asks: [],290 attempts: [],300- budgetDays: [],291 claims: [],292 decisions: [],293 envValues: [],294 landings: [],76 unmodified lines371 ).toStrictEqual([answerState]);372 }).pipe(Effect.provide(layer))373 );374 385- it.effect(386- "loads landings, proposals, decisions, budget days and ratchets",387- () =>388- Effect.gen(function* () {389- const store = yield* ProjectStore;375+ it.effect("loads landings, proposals, decisions and ratchets", () =>376+ Effect.gen(function* () {377+ const store = yield* ProjectStore;378 391- yield* store.commit({392- budgetDays: decodedAll(BudgetDayRow, [budgetDay]),393- decisions: decodedAll(DecisionRow, [decision]),394- landings: decodedAll(LandingRow, [landingOf(1), landingOf(2)]),395- proposals: decodedAll(ProposalRow, [proposal]),396- ratchets: decodedAll(RatchetRow, [ratchet]),397- });379+ yield* store.commit({380+ decisions: decodedAll(DecisionRow, [decision]),381+ landings: decodedAll(LandingRow, [landingOf(1), landingOf(2)]),382+ proposals: decodedAll(ProposalRow, [proposal]),383+ ratchets: decodedAll(RatchetRow, [ratchet]),384+ });385 399- expect(yield* loaded).toStrictEqual({400- ...empty,401- budgetDays: [budgetDay],402- decisions: [decision],403- landings: [landingOf(2), landingOf(1)],404- proposals: [proposal],405- ratchets: [ratchet],406- });407- }).pipe(Effect.provide(layer))386+ expect(yield* loaded).toStrictEqual({387+ ...empty,388+ decisions: [decision],389+ landings: [landingOf(2), landingOf(1)],390+ proposals: [proposal],391+ ratchets: [ratchet],392+ });393+ }).pipe(Effect.provide(layer))394 );395 396 it.effect("replaces a row written again under its key, in its place", () =>397 Effect.gen(function* () {8 unmodified lines406 brief: { want: "An empty date is refused" },407 };408 409 const released = { ...claim, state: json('{"_tag":"Released"}') };424- const spent = { ...budgetDay, used: 2 };410 const lowered = { ...ratchet, count: 11 };411 const retried = { ...firstOutbox, attempts: 1 };412 413 yield* store.commit({414 ...everything,430- budgetDays: decodedAll(BudgetDayRow, [budgetDay]),415 ratchets: decodedAll(RatchetRow, [ratchet]),416 });417 418 yield* store.commit({419 answers: decodedAll(AnswerRow, [later]),420 asks: decodedAll(AskRow, [renamed]),437- budgetDays: decodedAll(BudgetDayRow, [spent]),421 claims: decodedAll(ClaimRow, [released]),422 outbox: decodedAll(OutboxRow, [retried]),423 project: decoded(ProjectRow, { ...project, landed: sha(9) }),424 queue: { order: [] },3 unmodified lines428 expect(yield* loaded).toStrictEqual({429 ...empty,430 answers: [later],431 asks: [renamed, askB],449- budgetDays: [spent],432 claims: [released],433 lastSeq: 2,434 outbox: [retried, secondOutbox],435 project: { ...project, landed: sha(9) },321 unmodified linesmodified:packages/protocol/src/domain/decision.ts+1 added-6 removed
62 unmodified lines63 });64 65 export type Decision = typeof Decision.Type;66 67+/** A decider's open decisions, every one, ordered by expiry. */68 export const Today = Schema.Struct({68- budget: Schema.Struct({69- finishes: Schema.Int,70- total: Schema.Int,71- used: Schema.Int,72- }),69 decider: Handle,70 decisions: Schema.Array(Decision),71 expiringSoon: Schema.Array(DecisionId),72 newcomers: Schema.Array(Handle),77- overflow: Schema.Int,73 unattended: Schema.Array(LandingView),74 });75 76 export type Today = typeof Today.Type;modified:packages/protocol/src/domain/policy.ts+13 added-9 removed
10 unmodified lines11 import { VisibilityPolicy } from "./visibility.ts";12 13 const Source = Schema.Literals(["config", "defaults"]);14 15-const Budget = Schema.Struct({16- decisionsPerDay: AtLeastOne,15+/** How long an undecided decision waits before it takes its default. */16+const Decisions = Schema.Struct({17 expireDays: AtLeastOne,18 });19 20+const defaultDecisions = { expireDays: 14 };21+22+/** Throttles on people nobody has vouched for; a vouched person and a maintainer are never held. */23 const Caps = Schema.Struct({24 claimsPerPerson: AtLeastOne,25 /** `0` turns proposals off. */26 proposalsPerPerson: NoneOrMore,29 unmodified lines56 export const Policy = Schema.Struct({57 agents: Agents,58 asks: Schema.Array(Ask),59 at: LandedSha,57- budget: Budget,60 caps: Caps,61 claims: Claims,62 deciders: Schema.Array(63 Schema.Struct({ handles: Schema.NonEmptyArray(Handle), paths: Glob })64 ),65+ // Defaulted here too: a policy kept as JSON before this key existed still reads.66+ decisions: Decisions.pipe(67+ Schema.withDecodingDefaultKey(Effect.succeed(defaultDecisions))68+ ),69 functions: Functions,70 judge: Schema.Struct({71 paths: Schema.Array(Glob),72 pointers: Schema.Array(Schema.NonEmptyString),53 unmodified lines126 127 export const PolicyInput = Schema.Struct({128 agents: Agents.pipe(Schema.withDecodingDefaultKey(Effect.succeed("trailer"))),129 asks: Schema.Array(AskInput),124- budget: Budget.pipe(125- Schema.withDecodingDefaultKey(126- Effect.succeed({ decisionsPerDay: 5, expireDays: 14 })127- )128- ),130 caps: Caps.pipe(131 Schema.withDecodingDefaultKey(131- Effect.succeed({ claimsPerPerson: 3, proposalsPerPerson: 2 })132+ Effect.succeed({ claimsPerPerson: 20, proposalsPerPerson: 20 })133 )134 ),135 claims: Claims.pipe(136 Schema.withDecodingDefaultKey(8 unmodified lines145 ]),146 paths: Glob,147 })148 ),149+ decisions: Decisions.pipe(150+ Schema.withDecodingDefaultKey(Effect.succeed(defaultDecisions))151+ ),152 functions: Functions,153 kinds: Schema.Array(AskKind),154 ratchets: Schema.Array(RatchetSpec),155 record: RecordWindow.pipe(19 unmodified linesmodified:packages/protocol/src/contracts.ts+2 added-2 removed
383 unmodified lines384 success: Today,385 })386 .annotate(387 Description,388- "Show the caller's Today: the decisions to take, held to their budget, each with its evidence and a safe default."388+ "Show the caller's Today: every open decision, soonest to expire first, each with its evidence and a safe default."389 )390 .annotate(Audience, "decider")391 .annotate(Visibility, "maintainers")392 .annotate(ReadOnly, true)220 unmodified lines613 }),614 })615 .annotate(616 Description,617- "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."617+ "Show a project's evaluated config folder at its landed commit: who decides which paths, its vouches, caps, decision expiry and claim timing; for an import, its source."618 )619 .annotate(Audience, "public")620 .annotate(Visibility, "public")621 .annotate(ReadOnly, true)574 unmodified linesmodified:packages/protocol/test/fixtures/contracts.jsonnot shown
Its text is not shown, modified.
modified:packages/protocol/test/fixtures/domain.jsonnot shown
Its text is not shown, modified.
modified:packages/protocol/test/domain.test.ts+3 added-4 removed
184 unmodified lines185 expect(186 Schema.decodeUnknownSync(PolicyInput)(fixture.withoutDefaults)187 ).toMatchObject({188 agents: "trailer",189- budget: { decisionsPerDay: 5, expireDays: 14 },190- caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },189+ caps: { claimsPerPerson: 20, proposalsPerPerson: 20 },190 claims: { lapseAfterMs: 86_400_000, warnAfterMs: 7_200_000 },191+ decisions: { expireDays: 14 },192 record: { countsAfterDays: 30, windowDays: 365 },193 vouch: { file: `${Brand.configDir}/vouched.td`, mode: "forCode" },194 });195 });2 unmodified lines198 // sdk; the policy is where a count or a span that can't hold is refused.199 const [kind] = wire.withoutDefaults.kinds;200 201 it.each([202- ["budget", { budget: { decisionsPerDay: 0, expireDays: 14 } }],203- ["budget", { budget: { decisionsPerDay: 5, expireDays: -1 } }],202+ ["decisions", { decisions: { expireDays: 0 } }],203 ["caps", { caps: { claimsPerPerson: 0, proposalsPerPerson: 2 } }],204 ["caps", { caps: { claimsPerPerson: 3, proposalsPerPerson: -1 } }],205 ["claims", { claims: { lapseAfterMs: 0, warnAfterMs: 7_200_000 } }],206 ["claims", { claims: { lapseAfterMs: 86_400_000, warnAfterMs: -1 } }],156 unmodified linesmodified:packages/rules/src/finish.tsnot shown
Its text is not shown, modified.
modified:packages/rules/test/fixtures/cm/project.jsonnot shown
Its text is not shown, modified.
modified:packages/rules/test/fixtures/json-only/policy.jsonnot shown
Its text is not shown, modified.
modified:packages/rules/test/evaluate.test.tsnot shown
Its text is not shown, modified.
modified:packages/sdk/src/project.tsnot shown
Its text is not shown, modified.
modified:packages/sdk/test/sdk.test.tsnot shown
Its text is not shown, modified.
modified:packages/testkit/src/scenarios.tsnot shown
Its text is not shown, modified.
modified:DESIGN.md+1 added-1 removed
516 unmodified lines517 The platform's own label, never rewritten, through the state badge: a lock and the word in sealed violet for postures that keep something sealed, an open lock in ink for Open, muted for Source available. Said once per page: in the project header, in a list's group heading, or on an Explore card; never per row. `data-posture` carries the literal.518 519 ### Decisions, the inbox and the finish520 521-- **Inbox** (`/inbox`, once Home and Today, which redirect to it with their query kept): the reader's handle and record, the budget as one sentence for a decider, then sections under sticky headers: the decisions (Due today, Within your budget, Waits for tomorrow), each decided in its row; Your claims, each answer's stage strip under its row and its next command as the row's copy action; Asks you may take; and what happened lately in the projects the reader decides for (Newcomers to welcome, Landed without a decision). `?project=` narrows it to one project. A personal page: never kept at the edge.521+- **Inbox** (`/inbox`, once Home and Today, which redirect to it with their query kept): the reader's handle and record, how many decisions wait as one sentence for a decider, then sections under sticky headers: the decisions (Due today, Later), every open one, each decided in its row; Your claims, each answer's stage strip under its row and its next command as the row's copy action; Asks you may take; and what happened lately in the projects the reader decides for (Newcomers to welcome, Landed without a decision). `?project=` narrows it to one project. A personal page: never kept at the edge.522 - **Choices:** one tap each, no confirm. Primary buttons, the default the outline button with "default" beside its name; 36 px in a row from 640 px, 44 px in a two-column grid on a phone. Under each, a 13 px muted consequence line written from what the platform does. After a choice the record replaces the buttons, landed green only for a choice that took effect.523 - **Finish:** the changed files in the tree column with status letters, `+n −m` and a local read mark; the diff with sticky file headers and "Mark read"; the want, verdict, choices and the finish commands in a strip.524 525 ### Code browser (the Code tab)115 unmodified linesmodified:GLOSSARY.md+1 added-4 removed
135 unmodified lines136 One choice put to a project's maintainers, with its evidence and a safe default that is taken if nobody decides before it expires. Where a path asks for more than one maintainer, the choice takes effect once that many have chosen alike, and waits until then.137 _Avoid_: approval, vote, review request, quorum138 139 **Today**:140-A maintainer's daily list of open decisions, ordered by expiry and held to their budget; the overflow waits for a later day. The CLI prints it as `today`; the web shows it in the inbox.140+A maintainer's list of open decisions, ordered by expiry: every one shows, and each takes its default if nobody decides before it expires. The CLI prints it as `today`; the web shows it in the inbox.141 _Avoid_: queue, dashboard142 143 **Inbox**:144 A person's own page on the web: the decisions waiting for them (their Today), the asks they hold with where each answer stands in the gate, and the asks they may take next. It is read with their session and kept by no cache.145 _Avoid_: home, notifications, dashboard146 147-**Budget**:148-The number of decisions a maintainer takes per day; a decision past it waits, and one that expires undecided takes its default.149-147 **Vouch**:148 A line in the project's vouch file by which a member admits a person to claim and to submit sealed answers; it may carry the member's reason and the landing it followed, and it is read as a line, never counted.149 _Avoid_: approval, whitelist, endorsement, trust score150 102 unmodified linesmodified:PRODUCT.md+4 added-4 removed
14 unmodified lines15 Three kinds of people, and the agents that work for them. The words below are product words; inside the domain a contributor answering an ask is an **answerer** and a maintainer is anyone the config names to take decisions for a path.16 17 1. **Maintainers** keep a project. Their jobs:18 - say what the project wants, as asks: a file on main with a want, a territory and a check that fails on main, which opens only when the check is red first;19- - set how the project takes changes, as typed code in its config folder on main (maintainers, ask kinds, budgets, vouches, ratchets, the run block, visibility), read from the platform's last landing;20- - spend a daily budget of decisions on Today: open or decline a proposal, waive an escape, accept a posture change, finish a passing answer; doing nothing lets nothing in;19+ - set how the project takes changes, as typed code in its config folder on main (maintainers, ask kinds, decision expiry, vouches, ratchets, the run block, visibility), read from the platform's last landing;20+ - take the decisions on Today: open or decline a proposal, waive an escape, accept a posture change, finish a passing answer; doing nothing lets nothing in;21 - vouch for the people who may claim, each vouch a line that may say why and name the landing it followed, and denounce those who may not propose; a vouch is read as its line, never counted;22 - keep checks of their own in a layer only they read, and set write-only env values from a terminal;23 - land their own changes through the same gate as anyone else.24 2. **Contributors** answer asks, often a newcomer looking for a first one. Their jobs:3 unmodified lines28 - propose an ask nobody wrote yet, as a proposal that expires unless a maintainer accepts it;29 - own what lands: their name is on the commit, and their record is built from those commits.30 3. **Their harnesses**, the coding agents a person works through (Claude Code, OpenCode, Amp, pi, others). Their jobs: read the project's AGENTS.md block or skill, an ask as Markdown, `llms.txt` and the MCP tools; act only through their person's token; read refusals as typed JSON and run each one's `next`. An agent holds no account and no credit: the person's claim carries identity, and a landing discloses the agent apart (`Assisted-by`).31 32-Contributors meet four nouns, and only four: **ask**, **answer**, **check** and **refusal**. Everything else (budget, layer, ledger, posture, ratchet) is maintainer or platform vocabulary.32+Contributors meet four nouns, and only four: **ask**, **answer**, **check** and **refusal**. Everything else (decision, layer, ledger, posture, ratchet) is maintainer or platform vocabulary.33 34 ## Product Purpose35 36 Myr is a git platform where everything a project ships is public, the contribution process is typed code on main, and a change lands only by passing a typed gate. It turns the front door around: the project says what it wants, anyone (a person, or an agent working for one) may answer, an answer that passes its check lands with credit for every person involved, and work nobody asked for has nowhere to go. It is a prototype.44 unmodified lines81 - **Answer** (`/$project/answers/$ask`): the outcome, the gate's stages, the rounds, the lanes, held-back results as one line per area, the refusal, and the landing. A waiting answer says the one thing the contributor needs; a landed one is told as a sentence first, then credits its people, and only then shows its sealed roots.82 - **Person** (`/people/$handle`): their credits by role and area, in words, never a number or a score.83 - **Policy** (`/$project/people`): who decides which paths, who is vouched for or denounced, the limits and the agent rules, read from the config folder at the landed commit, with the commands that change them.84 - **Proposals** (`/$project/proposals/new`, `/$project/proposals/$proposal`): a want proposed from the web or the CLI, the platform's agent's draft if one was asked for (the ask file, the check, its red-first runs), and the decision it waits on.85- - **Inbox** (`/inbox`; `/home` and `/today` move here): the reader's own page. A maintainer's decisions in sections (due today, within the budget, waiting for tomorrow), each with its evidence, safe default, expiry and one-tap choices whose consequence is written under each, against the budget said as a sentence; the asks the reader holds and where each answer stands in the gate; the asks they may take next. Each decision has its own page (`/$project/decisions/$decision`), where a finish shows the answer's diff with refusals marked at their lines.85+ - **Inbox** (`/inbox`; `/home` and `/today` move here): the reader's own page. A maintainer's decisions in sections (due today, later), every open one, each with its evidence, safe default, expiry and one-tap choices whose consequence is written under each, with how many wait said as a sentence; the asks the reader holds and where each answer stands in the gate; the asks they may take next. Each decision has its own page (`/$project/decisions/$decision`), where a finish shows the answer's diff with refusals marked at their lines.86 - **Visibility** (`/$project/visibility`; `/$project/ledger` and `/$project/env` move here): the posture, each declared layer with its reason, each sealed area's count, authors, committed root and admission; the Environment, every item the project's committed `.env.schema` declares, parsed at the landed commit and never resolved, with who set a sensitive item's value and when, never a value; and the ledger, newest first.87 - **Settings** (`/settings`): the theme, the system's or its opposite, kept in this browser's `localStorage`, never a cookie.88 - **Sign-in** (`/auth/signin`): through the platform's own accounts; the session lives in an HttpOnly cookie the browser cannot read.89 - **Install** (`/install`; `/agents` moves here, and `/agents.md` stays): every way in, the CLI, remote and stdio MCP, the skills and `llms.txt`, each snippet copyable. The reference lives in the docs (`/docs`), over `/llms.txt`, `/llms-full.txt`, each project's `/$project/llms.txt`, `/.well-known/mcp.json` and the skills under `/.well-known/agent-skills/`.35 unmodified lines