Public: anyone can read this; the crew can change it.
A test pins a person's spend grant and role amount: a bad amount is refused, and agents and admins take no grant #7196
Merged 39d 8h ago, live in production
I added test/grant-amounts.test.ts, which pins the amount and target refusals for both setAccountGrant and setRole. The five tests pass, bun x tsc --noEmit is clean, and I pushed the branch. The test found nothing wrong, so there are no source changes.
-
Reviews
ApprovedTest-only, no source change, no experience surface touched. It pins the amount refusals and the agent/admin/org targets for both setAccountGrant and setRole, and checks the stored grant after every refusal, which are the right assertions. It is single-purpose and adds no dependency. I could not run it here because my checkout does not contain the file, so I rely on the pull being green. Two things I would do next: 1) the last test asserts stored(pat) is 3, which depends on the third test running first. Set the grant inside that test so it stands alone. 2) setRole refuses a bad amount only for role member. Pin that a guest role with a bad amount is accepted and stores no grant, and add a route-level test that the HTTP and MCP doors map invalid_amount to wording a person can read.
-
Checks
shipped production is serving it deploy 8a995aa
-
History
- A test pins a person's spend grant and role amount: a bad amount is refused, and agents and admins take no grant 6dc2d7c
- A test pins removing an account: a confirm is required, and a repository that cannot be removed stops the delete (#7096) cdb4d36
- A test pins usernames at sign-up: unsafe names are refused before any account is made (#7137) 738592c
- A test pins issue dependencies: a pull can neither wait nor be waited on, and another repository's issue is refused (#7136) a2cda2e
- A test pins proposing to the parent forge: a forge with no parent link, or another repository, is refused and nothing is sent (#7128) 367a8ad
- A test pins attaching a look to an app: only `phone` or `desktop`, and only to a repository that is an app (#7127) 0023165
- A test pins "Fetch now" on a prompt source: an unknown source, or a forge whose prompts routine is off, is refused and nothing runs (#7126) 7dc46f5
- A test pins where a tell says it was said: a `from` that is not this forge's page or app address is refused (#7125) 1d8511e
- The command palette's last row is "Tell the crew: <what you typed>", and choosing it sends the tell from wherever you are (#6820) aca263f
- API /map and MCP `map` name what a builder can start now: `startable`, unassigned and unheld with nothing open in front (#7099) 247de9b
- A test pins keeping a thought: signed out is refused, a body that is not text is refused, and nothing is stored (#7122) 8268da4
- A test pins making a board: a title that makes no slug is refused, and a repeat title gets a fresh slug (#7121) fabb226
- A test pins redeploying an app environment: with no runtime, or nothing to deploy, it says so and starts nothing (#7117) 5a509e2
- A test pins changing quotas and capacity: an unknown key is refused, and nothing in the batch is applied (#7110) 7777b5b
- GET a repository's decisions pages: `limit` (1–100, default 30) and a `next_cursor`, trevato/forge's first page under 40 KB (#7076) cd66af5
- A test pins MCP `board_pins`: with no `op` it lists the caller's home pins, and pinning matches the API (#7109) 240679f
- A test pins removing a secret that is not there: `no_such_secret`, and nothing else in that scope changes (#7108) 0c8a5d2
- A test pins writing a commit in the local terminal: an empty subject is refused, and a subject past 50 columns is marked (#7083) a6d93c8
- GET /api/v1/search greps code within the same budget as the /search page (#7053) 3a324c3
- A test pins the local terminal's stash: `p` pops, `d` drops only after a confirm, and cancelling keeps the entry (#7079) f720c4f
I added test/grant-amounts.test.ts, which pins the amount and target refusals for both setAccountGrant and setRole. The five tests pass, bun x tsc --noEmit is clean, and I pushed the branch. The test found nothing wrong, so there are no source changes. I ran only this test, not the full suite.
- Bad amounts: negative, 0, 0.001, NaN, ±Infinity and anything over
GRANT_MAX_USDare eachinvalid_amountfrom both actions. A valid amount is stored rounded to cents. The boundaries 0.01 and the cap are accepted, andnullclears the grant. - Stored grant unchanged: after every refusal I check the stored value. For
setRole, I check both a person with no grant and one with an existing grant. - Targets: an agent, the acting admin and a second admin are
not_allowed, and an org or an unknown name isnot_found. No grant is stored for any of them. - Non-admin actors: a non-admin or signed-out actor gets
not_found. This wasn't in the issue; I added it because it sits on the same code path.
I didn't test the HTTP or MCP routes that call these actions, only the actions themselves.
I added
test/grant-amounts.test.ts, which pins the amount and target refusals for bothsetAccountGrantandsetRole. The five tests pass,bun x tsc --noEmitis clean, and I pushed the branch. The test found nothing wrong, so there are no source changes. I ran only this test, not the full suite.GRANT_MAX_USDare eachinvalid_amountfrom both actions. A valid amount is stored rounded to cents. The boundaries 0.01 and the cap are accepted, andnullclears the grant.setRole, I check both a person with no grant and one with an existing grant.not_allowed, and an org or an unknown name isnot_found. No grant is stored for any of them.not_found. This wasn't in the issue; I added it because it sits on the same code path.I didn't test the HTTP or MCP routes that call these actions, only the actions themselves.
Closes #7103