Skip to content
Myr

Say which limit a CapReached reached and when to try again, and that a fork takes branches only

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

- CapReached gains two optional keys: `limit` (claims, proposals or drafts; absent still means claims held, so the claim lifecycle and the gate's parse stage raise it unchanged) and `retryAfter` (whole seconds, at least 1, only for a rate limit). Tag, retryable and next are unchanged: a client that ignores the keys still decodes the refusal, and MCP sends them as JSON. - The platform's rate limits fill `limit` by kind and `retryAfter: 60`, the bindings' period: a binding cannot say when its window resets, so the whole period is the honest upper bound. MemoryRateLimits shares the same refusal. - The open-proposals cap fills `proposals` and the draft-rounds cap `drafts`, neither with `retryAfter`: they lift when a proposal is decided, or never. - One reason per (limit, retryAfter) in protocol/render, singular when the cap is 1; every variant names the number, a rate also the wait. - DirectPush's doc comment widens to any ref the pusher may not move; its reason keeps today's text for refs/heads/... and, for any other ref, says the platform writes it and to push the answer with `git push <slug> HEAD:main`. - The skills' repair line for CapReached covers every limit; only that line moves in the regenerated goldens. - Tests: render.test.ts (eleven CapReached readings, DirectPush on a notes ref), refusal.test.ts (the keys round-trip through JSON, a refusal without them encodes and decodes as before, a zero wait is refused), and the cap expectations in handlers, draft workflow, proposals, draft-settle and deciders tests. mcp.test.ts passes unchanged. - bytes:check, no limit changed: platform 1680808 of 1900000, sandbox 570714 of 656000, web entry 711006 of 818000 (JavaScript 3569319 of 4075000). - ASSUMPTION: "in the last minute" in a rate reason holds while every binding's period is 60 s, as wrangler.jsonc sets it today.

authored by oscabriel · committed by oscabriel · parent 261dbca · Browse files · 18 files+235 added−30 removed
This commit

State

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

Diff stats

18 files+235 added−30 removed

  • tests:+154 added−18 removed
  • other:+81 added−12 removed

18 files+235 added−30 removed

modified:apps/platform/src/adapters/rate-limits.ts+20 added-2 removed
modified:apps/platform/test/workflows/draft.test.ts+1 added-1 removed
662 unmodified lines
663 past,664 plain: plain.proposal.draft,665 }).toStrictEqual({666 drafted: "Drafting",667 past: new CapReached({ cap: 1 }),667 past: new CapReached({ cap: 1, limit: "drafts", retryAfter: 60 }),668 plain: undefined,669 });670 }).pipe(671 Effect.provide(
11 unmodified lines
modified:apps/platform/test/handlers.test.ts+27 added-5 removed
306 unmodified lines
307 ask: trimInput,308 project: datekit.project,309 });310311 expect(past).toStrictEqual(new CapReached({ cap: 1 }));311 expect(past).toStrictEqual(312 new CapReached({ cap: 1, limit: "claims", retryAfter: 60 })313 );314 expect(bobs.claim.claimant).toBe("bob");315 }).pipe(Effect.provide(platform({ limits: { claim: 1, proposal: 5 } })))316 );317});
25 unmodified lines
343 reason: "The want names a file.",344 });345346 expect(proposed.proposal.proposer).toBe("bob");345 expect(flagged).toStrictEqual(new CapReached({ cap: 1 }));347 expect(flagged).toStrictEqual(348 new CapReached({ cap: 1, limit: "proposals", retryAfter: 60 })349 );350 expect({351 flags: carols.proposal.flags,352 proposer: carols.proposal.proposer,353 }).toStrictEqual({ flags: "parse-iso", proposer: "carol" });
511 unmodified lines
865866 expect(spent).toStrictEqual([867 Result.void,868 Result.void,865 Result.fail(new CapReached({ cap: WorkerCaps.claim })),869 Result.fail(870 new CapReached({871 cap: WorkerCaps.claim,872 limit: "claims",873 retryAfter: 60,874 })875 ),876 Result.void,877 Result.void,868 Result.fail(new CapReached({ cap: WorkerCaps.proposal })),878 Result.fail(879 new CapReached({880 cap: WorkerCaps.proposal,881 limit: "proposals",882 retryAfter: 60,883 })884 ),885 Result.void,870 Result.fail(new CapReached({ cap: WorkerCaps.draft })),886 Result.fail(887 new CapReached({888 cap: WorkerCaps.draft,889 limit: "drafts",890 retryAfter: 60,891 })892 ),893 ]);894 expect(claims.keys).toStrictEqual(["alice", "alice", "alice", "bob"]);895 expect(proposals.keys).toStrictEqual(["alice", "alice"]);896 expect(drafts.keys).toStrictEqual(["alice", "alice"]);
56 unmodified lines
modified:packages/agent-kit/src/refusals.ts+1 added-1 removed
50 unmodified lines
51 AttemptsExhausted: {52 todo: "Wait until `resetsAt`: you used every attempt on that area's held-back checks for now.",53 },54 CapReached: {55 todo: "Release a claim you hold, or land one, before you take another.",55 todo: "Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again.",56 },57 ChecksFailed: {58 nextNames: "the command that reproduces the failure",59 todo: "Run `next` to see the failure, fix it, and push again.",
118 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins-stdio.txt+1 added-1 removed
53 unmodified lines
54| --- | --- | --- | --- |55| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |56| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |57| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |58| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |58| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |59| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |60| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |61| `RepoBusy` | yes | `git push` | Push again. |62| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
35 unmodified lines
modified:packages/agent-kit/test/golden/agent-plugins.txt+1 added-1 removed
54 unmodified lines
55| --- | --- | --- | --- |56| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |57| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |58| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |59| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |59| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |60| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |61| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |62| `RepoBusy` | yes | `git push` | Push again. |63| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
32 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin-stdio.txt+1 added-1 removed
52 unmodified lines
53| --- | --- | --- | --- |54| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |55| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |56| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |57| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |57| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |58| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |59| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |60| `RepoBusy` | yes | `git push` | Push again. |61| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
70 unmodified lines
modified:packages/agent-kit/test/golden/claude-plugin.txt+1 added-1 removed
53 unmodified lines
54| --- | --- | --- | --- |55| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |56| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |57| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |58| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |58| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |59| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |60| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |61| `RepoBusy` | yes | `git push` | Push again. |62| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
68 unmodified lines
modified:packages/agent-kit/test/golden/platform-skill.txt+1 added-1 removed
46 unmodified lines
47| --- | --- | --- | --- |48| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |49| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |50| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |51| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |51| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |52| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |53| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |54| `RepoBusy` | yes | `git push` | Push again. |55| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
21 unmodified lines
modified:packages/agent-kit/test/golden/project-skill.txt+2 added-2 removed
80 unmodified lines
81| --- | --- | --- | --- |82| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |83| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |84| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |85| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |85| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |86| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |87| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |88| `RepoBusy` | yes | `git push` | Push again. |89| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
102 unmodified lines
192| --- | --- | --- | --- |193| `NotClaimed` | yes | `__CLI__ claim <ask>` | Claim the ask, then push again. |194| `ClaimLapsed` | yes | `__CLI__ claim <ask>` | Your claim lapsed after a spell without a push: claim the ask again if it is still open. |195| `NotVouched` | no | `__CLI__ status` | Ask a member of the project to vouch for you. |196| `CapReached` | yes | `__CLI__ status` | Release a claim you hold, or land one, before you take another. |196| `CapReached` | yes | `__CLI__ status` | Read `limit`: for claims, release or land a claim you hold; for proposals, wait for an open one to be decided; for drafts, the proposal has had every draft round it takes; with `retryAfter`, wait that many seconds and try again. |197| `AskFull` | yes | `__CLI__ asks` | Someone else holds the claim: pick another ask. |198| `NoAsk` | no | `__CLI__ asks` | Push to the fork your claim gave you, which names its ask. |199| `RepoBusy` | yes | `git push` | Push again. |200| `DirectPush` | no | `__CLI__ asks` | Main moves only by a landing: push your answer to your claim's fork. |
21 unmodified lines
modified:packages/project/src/attention/proposals.ts+4 added-2 removed
136 unmodified lines
137 if (unvouched) {138 return Result.fail(new NotVouched({}));139 }140141 return openCount >= cap ? Result.fail(new CapReached({ cap })) : Result.void;141 return openCount >= cap142 ? Result.fail(new CapReached({ cap, limit: "proposals" }))143 : Result.void;144};145146/** The fields every proposal opens with, expiring after the policy's days. */147const opening = (policy: Policy, proposer: Proposer, now: DateTime.Utc) => ({
241 unmodified lines
389 ? { round, startedAt: now }390 : { note, round, startedAt: now };391392 return round > DRAFT_ROUNDS391 ? Result.fail(new CapReached({ cap: DRAFT_ROUNDS }))393 ? Result.fail(new CapReached({ cap: DRAFT_ROUNDS, limit: "drafts" }))394 : Result.succeed(395 Option.some({396 effects: [],397 lines: [],
8 unmodified lines
modified:packages/project/test/attention/proposals.test.ts+2 added-2 removed
106 unmodified lines
107 });108109 it("refuses a person who already has the cap's proposals open", () => {110 expect(proposalOf(byCarol({ openCount: 2 }))).toStrictEqual(111 Result.fail(new CapReached({ cap: 2 }))111 Result.fail(new CapReached({ cap: 2, limit: "proposals" }))112 );113 });114115 it("lets a person with one fewer than the cap open propose", () => {
116 unmodified lines
232 expect([233 proposalOf(flagBy({ openCount: 2 })),234 proposalOf(flagBy({ denounced: true })),235 ]).toStrictEqual([236 Result.fail(new CapReached({ cap: 2 })),236 Result.fail(new CapReached({ cap: 2, limit: "proposals" })),237 Result.fail(new Denounced({})),238 ]);239 });240});
33 unmodified lines
modified:packages/project/test/deciders.test.ts+1 added-1 removed
491 unmodified lines
492 ]);493 expect(run.alarm).toStrictEqual(Option.some(daysAfter(noon, 14)));494 expect([run.second.proposal.state, run.third]).toStrictEqual([495 "open",496 new CapReached({ cap: 2 }),496 new CapReached({ cap: 2, limit: "proposals" }),497 ]);498 })499 );500
1044 unmodified lines
modified:packages/project/test/draft-settle.test.ts+1 added-1 removed
613 unmodified lines
614 expect([drafting, outsider, unknown, fourth, closed]).toStrictEqual([615 DraftInProgress.of(proposal),616 new NotDecider({}),617 new UnknownProposal({ proposal: ProposalId.make("prop-000009") }),618 new CapReached({ cap: 3 }),618 new CapReached({ cap: 3, limit: "drafts" }),619 new ProposalClosed({ proposal }),620 ]);621 expect(second.proposal.draft).toStrictEqual(622 DraftState.cases.Drafting.make({ round: 2, startedAt: noon })
77 unmodified lines
modified:packages/protocol/src/refusal.ts+16 added-3 removed
67 unmodified lines
68 ...Final,69 ...nextIs(cli("status")),70}) {}7172/** The pusher already holds as many claims as the project allows. */72/**73 * The caller reached a limit of `cap`. `limit` says which: claims held (also74 * when absent, the first meaning, so a claim cap needs no key), open75 * proposals, or a proposal's draft rounds. A rate limit across the platform76 * also gives `retryAfter`, the seconds until one more is let through; a cap77 * without it lifts when something held is released, landed or decided.78 */79export class CapReached extends Schema.TaggedError<CapReached>()("CapReached", {80 ...Retryable,81 ...nextIs(cli("status")),82 cap: Schema.Int,83 /** Which limit: claims held (also when absent), proposals, or drafts. */84 limit: Schema.optionalKey(Schema.Literals(["claims", "proposals", "drafts"])),85 /** For a rate limit: seconds until one more is let through. */86 retryAfter: Schema.optionalKey(87 Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))88 ),89}) {}9091/** Someone else holds the ask's one claim. */92export class AskFull extends Schema.TaggedError<AskFull>()("AskFull", {
14 unmodified lines
107 ...nextIs("git push"),108}) {}109110/**99 * The push tried to move a canonical ref directly. Main moves only by a100 * landing; an answer goes to the claim's fork.111 * The push tried to move a ref the pusher may not move: a canonical ref112 * (main moves only by a landing; an answer goes to the claim's fork), or, on113 * a fork, a ref outside `refs/heads/`, which the platform writes itself.114 */115export class DirectPush extends Schema.TaggedError<DirectPush>()("DirectPush", {116 ...Final,117 ...nextIs(cli("asks")),
417 unmodified lines
modified:packages/protocol/src/render.ts+40 added-4 removed
3 unmodified lines
45import type { AnswerReceipt } from "./domain/answer.ts";6import { Outcome } from "./domain/outcome.ts";7import { ChecksFailed } from "./refusal.ts";8import type { Refusal } from "./refusal.ts";8import type { CapReached, Refusal } from "./refusal.ts";910const short = (sha: string) => sha.slice(0, 7);1112const list = (items: readonly string[]) => items.join(", ");1314const counted = (count: number, noun: string) =>15 `${count} ${noun}${count === 1 ? "" : "s"}`;1617type CapLimit = NonNullable<CapReached["limit"]>;1819// A cap with no `retryAfter` is held: it lifts when a claim is released or20// landed, a proposal decided; a proposal's draft rounds never lift.21const held = {22 claims: (cap) =>23 `you already hold ${counted(cap, "claim")}, the most this project allows`,24 drafts: (cap) =>25 `this proposal was already drafted ${cap === 1 ? "once" : `${cap} times`}, the most one proposal takes`,26 proposals: (cap) =>27 `you already have ${counted(cap, "open proposal")} here, the most this project allows`,28} as const satisfies Record<CapLimit, (cap: number) => string>;2930// A rate limit counts what one person made across the platform in a window.31const rated = {32 claims: { noun: "claim", verb: "made" },33 drafts: { noun: "draft", verb: "started" },34 proposals: { noun: "proposal", verb: "made" },35} as const satisfies Record<CapLimit, { noun: string; verb: string }>;3637const capReason = ({38 cap,39 limit = "claims",40 retryAfter,41}: CapReached): string =>42 retryAfter === undefined43 ? held[limit](cap)44 : `you ${rated[limit].verb} ${counted(cap, rated[limit].noun)} in the last minute, the most the platform allows; try again in ${retryAfter}s`;4546// A branch is what a person pushes; every other ref the platform writes.47const BRANCH = "refs/heads/";4849// Reasons name only what the refusal's reader may see: held-back checks give50// their area and suite, never a case or an input. A shape refusal's reason51// ends with how to repair it, after its first clause; `next` stays the command.52const reason = Match.typeTags<Refusal, string>()({
1 unmodified line
54 `${ask} waits on ${list(blockedBy)} to land first`,55 AskFull: ({ ask }) => `someone else holds the claim on ${ask}`,56 AttemptsExhausted: ({ area, resetsAt }) =>57 `no attempts left on ${area} until ${DateTime.formatIso(resetsAt)}`,23 CapReached: ({ cap }) =>24 `you already hold ${cap} claims, the most this project allows`,58 CapReached: capReason,59 ChecksFailed: ({ lane, logRef }) =>60 logRef === ChecksFailed.withheld61 ? `the ${lane} checks failed; their log was withheld`62 : `the ${lane} checks failed; the log is at ${logRef}`,
2 unmodified lines
65 `${decision} was already decided, or expired to its default`,66 Denounced: () =>67 "this project's vouch file denounces you, so it takes no claims or proposals from you",68 DirectPush: ({ ref }) =>35 `main moves only by a landing, so ${ref} takes no direct push; push your answer to your claim's fork`,69 ref.startsWith(BRANCH)70 ? `main moves only by a landing, so ${ref} takes no direct push; push your answer to your claim's fork`71 : `${ref} is written by the platform, not pushed; a fork takes branches only, so push your answer with git push ${Brand.slug} HEAD:main`,72 DraftInProgress: ({ proposal }) =>73 `the platform is already drafting ${proposal}'s ask`,74 Flake: ({ lane }) =>75 `the ${lane} checks failed, then passed on the same tree; the platform will run them again`,
119 unmodified lines
modified:packages/protocol/test/refusal.test.ts+40 added-1 removed
1import { describe, expect, it } from "@effect/vitest";2import { Brand } from "@repo/brand";3import { Schema } from "effect";45import { RepoPath } from "../src/ids.ts";5import { groups, Refusal, StaleBase } from "../src/refusal.ts";6import { CapReached, groups, Refusal, StaleBase } from "../src/refusal.ts";7import { base, examples, main } from "./examples.ts";89// What Effect's MCP server sends for a declared tool failure that has no10// message: the failure schema's encoding, through JSON.stringify
28 unmodified lines
39 expect(decoded.message).toBe("");40 expect(decoded).toStrictEqual(refusal);41 });4243 it("sends a cap's limit and wait as JSON keys, and decodes one without them as before", () => {44 const rate = new CapReached({ cap: 2, limit: "drafts", retryAfter: 60 });45 const held = new CapReached({ cap: 3 });4647 expect(JSON.parse(overTheWire(rate))).toStrictEqual({48 _tag: rate._tag,49 cap: 2,50 limit: "drafts",51 next: `${Brand.cli} status`,52 retryAfter: 60,53 retryable: true,54 });55 expect(JSON.parse(overTheWire(held))).toStrictEqual({56 _tag: held._tag,57 cap: 3,58 next: `${Brand.cli} status`,59 retryable: true,60 });61 expect(62 [rate, held].map((refusal) =>63 Schema.decodeUnknownSync(Refusal)(JSON.parse(overTheWire(refusal)))64 )65 ).toStrictEqual([rate, held]);66 });6768 it("refuses a cap's wait below one second", () => {69 const zero = {70 ...Schema.encodeSync(CapReached)(71 new CapReached({ cap: 3, retryAfter: 60 })72 ),73 retryAfter: 0,74 };7576 expect(() => Schema.decodeUnknownSync(Refusal)(zero)).toThrow(77 /retryAfter/u78 );79 });8081 // MCP tool schemas come from this document. A bare `Schema.Number` admits82 // the strings "Infinity" and "NaN"; a bare `Schema.optional` admits `null`.83 it("has a JSON Schema with no non-finite numbers and no nulls", () => {84 const document = JSON.stringify(Schema.toJsonSchemaDocument(Refusal));
146 unmodified lines
modified:packages/protocol/test/render.test.ts+75 added
13 unmodified lines
14 RepoPath,15 RequestId,16} from "../src/ids.ts";17import {18 CapReached,19 ChecksFailed,20 DirectPush,21 DraftInProgress,22 OutOfScope,
193 unmodified lines
216 ]217 );218 });219220 it("tells a push to a ref the platform writes that a fork takes branches only", () => {221 expect(222 explain([new DirectPush({ ref: `refs/notes/${Brand.slug}` })])223 ).toStrictEqual([224 `DirectPush: refs/notes/${Brand.slug} is written by the platform, not pushed; a fork takes branches only, so push your answer with git push ${Brand.slug} HEAD:main`,225 ` next: ${Brand.cli} asks`,226 " retryable: no",227 ]);228 });229230 // A cap names the limit it reached, and a rate limit when to try again; a231 // cap with no limit is claims held, as it always was.232 it.each([233 {234 reason: "you already hold 3 claims, the most this project allows",235 refusal: new CapReached({ cap: 3 }),236 },237 {238 reason: "you already hold 1 claim, the most this project allows",239 refusal: new CapReached({ cap: 1, limit: "claims" }),240 },241 {242 reason:243 "you made 10 claims in the last minute, the most the platform allows; try again in 60s",244 refusal: new CapReached({ cap: 10, limit: "claims", retryAfter: 60 }),245 },246 {247 reason:248 "you made 5 proposals in the last minute, the most the platform allows; try again in 60s",249 refusal: new CapReached({ cap: 5, limit: "proposals", retryAfter: 60 }),250 },251 {252 reason:253 "you made 1 proposal in the last minute, the most the platform allows; try again in 60s",254 refusal: new CapReached({ cap: 1, limit: "proposals", retryAfter: 60 }),255 },256 {257 reason:258 "you already have 2 open proposals here, the most this project allows",259 refusal: new CapReached({ cap: 2, limit: "proposals" }),260 },261 {262 reason:263 "you already have 1 open proposal here, the most this project allows",264 refusal: new CapReached({ cap: 1, limit: "proposals" }),265 },266 {267 reason:268 "you started 2 drafts in the last minute, the most the platform allows; try again in 60s",269 refusal: new CapReached({ cap: 2, limit: "drafts", retryAfter: 60 }),270 },271 {272 reason:273 "you started 1 draft in the last minute, the most the platform allows; try again in 30s",274 refusal: new CapReached({ cap: 1, limit: "drafts", retryAfter: 30 }),275 },276 {277 reason:278 "this proposal was already drafted 3 times, the most one proposal takes",279 refusal: new CapReached({ cap: 3, limit: "drafts" }),280 },281 {282 reason:283 "this proposal was already drafted once, the most one proposal takes",284 refusal: new CapReached({ cap: 1, limit: "drafts" }),285 },286 ])("reads CapReached as: $reason", ({ refusal, reason }) => {287 expect(explain([refusal])).toStrictEqual([288 `CapReached: ${reason}`,289 ` next: ${Brand.cli} status`,290 " retryable: yes",291 ]);292 });293294 // A code read names what it could not find and how to look with git; a295 // draft names the proposal, and where to follow it.296 it.each([297 {
144 unmodified lines