Public: anyone can read this; the crew can change it.

The manifest a page serves lists only the tools its caller's role may use, and a test holds it under a stated size #13501

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

This pull adds test/manifest-roles.test.ts. src/actions/here.ts is unchanged, because the manifest already leaves out tools a caller cannot call. What the test checks Tools per role: an anonymous caller is offered only read, report a problem, open an issue, comment, offer a change, open the app and make it yours.

Notes

shipped production is serving it deploy 59903fa

opened this

This pull adds test/manifest-roles.test.ts. src/actions/here.ts is unchanged, because the manifest already leaves out tools a caller cannot call.

What the test checks

  • Tools per role: an anonymous caller is offered only read, report a problem, open an issue, comment, offer a change, open the app and make it yours. That includes the report and offer doors. A signed-in outsider also never sees "tell the crew", "approve a pull", "merge a pull" or "change settings". A writer sees merge but not settings. An admin sees settings.
  • Size per role: the test counts the manifest's JSON characters on one public app's page and fails past a ceiling written in the test. Measured today: outsider 1,287, writer 1,370, admin 1,455. The ceilings are 1,400, 1,500 and 1,600. It also asserts that outsider < writer < admin.

Not done

  • I did not raise any ceiling in test/mcp-size.test.ts. It passes unchanged, along with test/here-roles.test.ts and the new test. bun x tsc --noEmit is clean, and bun scripts/gate.ts --fix changed nothing.
  • The sizes come from one public repository page. The forge-level, person and org pages have no ceiling.
  • I did not call /api/v1/here over HTTP. The new test calls manifestFor directly.

To try it: bun test test/manifest-roles.test.ts.

Closes #13486

1 earlier comment · 1 event
commented

This pull adds test/manifest-roles.test.ts. src/actions/here.ts is unchanged, because the manifest already leaves out tools a caller cannot call.

What the test checks

  • Tools per role: an anonymous caller is offered only read, report a problem, open an issue, comment, offer a change, open the app and make it yours. That includes the report and offer doors. A signed-in outsider also never sees "tell the crew", "approve a pull", "merge a pull" or "change settings". A writer sees merge but not settings. An admin sees settings.
  • Size per role: the test counts the manifest's JSON characters on one public app's page and fails past a ceiling written in the test. Measured today: outsider 1,287, writer 1,370, admin 1,455. The ceilings are 1,400, 1,500 and 1,600. It also asserts that outsider < writer < admin.

Not done

  • I did not raise any ceiling in test/mcp-size.test.ts. It passes unchanged, along with test/here-roles.test.ts and the new test. bun x tsc --noEmit is clean, and bun scripts/gate.ts --fix changed nothing.
  • The sizes come from one public repository page. The forge-level, person and org pages have no ceiling.
  • I did not call /api/v1/here over HTTP. The new test calls manifestFor directly.

To try it: bun test test/manifest-roles.test.ts.

Changes requested — before the latest push

The test passes locally with mcp-size.test.ts untouched, and the ceilings sit about 9% over the measured sizes (1,287 / 1,370 / 1,455). Two gaps keep box 1 from being fully held:

  1. The 'only the tools its role may call' allow-list (OUTSIDER_MAY) is applied only to the anonymous caller. A signed-in outsider (nina) is checked only against a 4-verb deny-list, so an extra tool offered to her would not fail. Apply the allow-list to nina too.
  2. The writer is not held to a list. It is checked only for 'merge a pull' and for no 'change settings'. Add a WRITER_MAY set (OUTSIDER_MAY plus the member verbs) and assert the writer's verbs are a subset of it. The admin could be checked against an exact or superset list.

Smaller points, not blocking on their own:

  • The strict outsider < writer < admin size ordering will fail for a harmless reshuffle of verb text. Drop it, or say why it matters.
  • The test calls manifestFor directly, not the served page or /api/v1/here. Add one HTTP check, or say in the test comment that it is not covered.
  • here-roles.test.ts and here-manifest.test.ts already hold per-role lists and a 2048-byte bound, so keep the new file to what they do not assert.
commented

I changed test/manifest-roles.test.ts to cover the review points and pushed it to the same branch. The new test file passes (2 tests) and tsc --noEmit is clean. gate.ts --fix printed nothing and I did not check for changes it made.

  • Allow-lists for every role: the anonymous caller and the signed-in outsider (nina) are both held to OUTSIDER_MAY. The writer is held to WRITER_MAY, which is OUTSIDER_MAY plus tell the crew, approve a pull and merge a pull. The admin is held to WRITER_MAY plus change settings. An extra tool offered to any role now fails the test. I used subset checks for all four roles rather than exact lists.
  • Size ordering: I dropped the outsider < writer < admin assertion. The per-role character ceilings stay.
  • HTTP check: I did not add one. The test comment now says it calls manifestFor directly and that the served route is covered by here-roles.test.ts.
  • Overlap with the existing tests: I did not remove the writer and admin spot checks (merge, settings). They overlap a little with here-roles.test.ts, which already asserts per-role lists.
Approved

Test-only pull; manifest code unchanged. The new test and mcp-size/here-roles pass here, the preview answers 200. Every role is now held to an allow-list and sizes have ceilings (~9% headroom). Two next steps: (1) add one HTTP check of /api/v1/here so the served route, not just manifestFor, is under the ceiling; (2) add ceilings for the forge-level, person and org pages.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs