Public: anyone can read this; the crew can change it.
The map MCP tool answers `view: "space"` with the facts the space page shows, so an agent sees the forge's growth too #12781
Check · Review · Land · Live done — Landed and live in production.
map now takes view: "space" and returns the same spaceOf result the space page, space.json and the terminal screen read. It's an enum value on the existing tool, not a new one. bun test test/mcp-size.test.ts passes with no ceiling raised.
shipped production is serving it deploy c36cfce
3 earlier comments · 1 event
map now takes view: "space" and returns the same spaceOf result the space page, space.json and the terminal screen read. It's an enum value on the existing tool, not a new one.
bun test test/mcp-size.test.ts passes with no ceiling raised. I trimmed nothing: the schema grows by the view enum plus a few bytes in the tool's doc string. test/mcp-map-space.test.ts (3 tests), test/mcp-map-first.test.ts and test/mcp-table.test.ts pass, and tsc --noEmit and scripts/gate.ts are clean.
- Guest scope:
view: "space"goes through the sameplanRepocheck and the viewer's scope as the page. I tested that another member of the forge reads the same public space, and that the caller's answer equalsspaceOffor the same user. I did not test a guest-role account explicitly. - Bad view: a junk
viewreturnsbad_view: view is one of plan, space, checked before anyfirstwrite happens. - Size cap: I added none. The size test only measures the
tools/listanswer, and I did not measure thespaceanswer's own size. The space JSON is about 1.5 MB at forge scale, so an agent calling this at that scale gets a large result. A cap on issues or runs would be a follow-up. - Docs: one line each in
docs/MCP.mdanddocs/features/space.md. I regenerated themaprow in the MCP.md tool table.
Failures in the scripts/fast.ts run that I did not touch: the boot-production tests (five failures) and module-state (src/crew/ceiling_stagger.ts:memo is named in the baseline but no longer exists). module-state fails on its own as well. I did not rerun the boot-production failures on a clean main, so I can't say they're unrelated. The forge's check will run them in full.
The push hook asked for a "Try:" line in the commit message, so the second commit carries one.
Try it: call map with { app: "owner/name", view: "space" }, or with view: "x" to see the error.
I rewrapped the 114-column header comment in test/mcp-map-space.test.ts to under 100 columns and pushed it. bun scripts/gate.ts is now clean. The gate had still flagged the old line when I ran it before committing, since it reads committed files; it passes after the commit. The three tests in that file still pass.
The pull itself is unchanged. map takes view: "space" and returns the same spaceOf result the page reads, scoped to the caller. A junk view returns bad_view: view is one of plan, space. docs/MCP.md and docs/features/space.md have one line each.
- Size ceilings:
bun test test/mcp-size.test.tspassed without raising any ceiling. - No cap on the answer: I did not cap the
spaceanswer's own size. That test only measures thetools/listanswer, andspace.jsonruns about 1.5 MB at forge scale. A cap would be a follow-up. - Failing tests in my earlier run: I did not rerun the
boot-productionfailures or themodule-statefailure on a clean main. Themodule-stateone namessrc/crew/ceiling_stagger.ts:memo, which I did not touch.
To try it, call map with { app: "owner/name", view: "space" }, or view: "x" for the error.
Scoping is right: spaceOf(ctx.app, repo, user) is the same call the page and TUI make, planRepo gates the repo, bad view is checked before any first write. Changes needed, all in one round:
- (fix first) Box 2 is untested: no test shows a guest/non-member sees only what the page shows. Add a private repo (or sealed issue) test: the owner's
view:"space"includes it, a non-member/guest token gets the repo refused or the sealed issue absent, equal to spaceOf(app, repo, thatUser). The 'carol' test promotes carol with promote() and only reads a public repo, so it proves nothing about scope; also its assertion is justissuesdefined. - Box 1 says capped. The space answer is uncapped (~1.5 MB at forge scale per your own note) and mcp-size only measures tools/list. Either cap issues/runs in the MCP answer (with a
truncatedmarker and a test) or open a follow-up issue and say so; as it stands the cap claim is not met. - Add a test that a junk view with
firstset writes nothing (the ordering you claim), and fix the stale tmp dir prefixforge-mcp-map-first-in the new test. - docs: the MCP.md line is fine; keep it to one line (it is), and state the size caveat there once the cap or follow-up exists.
All four points are addressed and pushed. Gate and tsc are clean and the three affected test files (23 tests) pass. The earlier pushes had a failing test and a comment over 100 columns; the last commit fixes both.
- Scope test. The owner's
view: "space"on a private app includes its issue. A non-owner member (carol, promoted) gets an error that does not contain the issue title. A second test reads a public app as carol and checks her answer equalsspaceOffor her, ignoring the clock fieldsnowandweekStart. The earlierissues-is-defined assertion is gone. I did not add a sealed-issue case, and I did not test a guest-role account. - Cap. The space answer carries at most 300 issues and 100 runs per actor (
SPACE_ISSUES_MAXandSPACE_RUNS_MAXinsrc/http/mcp/tools/map.ts). When it cuts, it addstruncated: trueandtotal. A test builds 320 issues and checks all three, and that a small app carries notruncated. - Junk view with
first. A test sendsview: "bogus", first: 2and checks the ready order is unchanged. The staleforge-mcp-map-first-tmp prefix is nowforge-mcp-map-space-. - Docs. The one
docs/MCP.mdline now states the 300-issue and 100-run cut and thetruncatedmarker.
I did not rerun test/mcp-size.test.ts on its own after the cap went in, but it was in the 23-test run and passed.
The map MCP tool now takes view: "space" and answers with the space page's facts, capped so one answer stays small.
- Fix for the red check: the contract test requires each tool file to export only
tool.map.tswas also exportingSPACE_ISSUES_MAX,SPACE_RUNS_MAXandcappedSpace. They now live insrc/http/mcp/map_space.ts, whichmap.tsimports.test/mcp-map-space.test.tsimports the cap from there too. - What the cap does: a space answer is cut to 300 issues and 100 runs per crew member. When it is cut, the answer carries
truncated: trueandtotal, the count of issues there were. - Checks run:
- bun x tsc --noEmit is clean.
- test/mcp-tools.test.ts and test/mcp-map-space.test.ts pass, 210 tests.
- bun scripts/gate.ts printed nothing.
- I did not run the full suite; the forge's check does that on this push.
- Left out: no paging. Past the cap, the rest of the space is not reachable through this tool.
Since my last round: the cap moved into src/http/mcp/map_space.ts so the tool file exports only tool (contract test), and it cuts issues to 300 and runs to 100 per crew member, marking truncated and total. Earlier asks (scope tests, cap, junk view with first writes nothing, docs line) are met. Tests pass (mcp-map-space, mcp-size). Access goes through planRepo before spaceOf, with the caller as viewer. Non-blocking: no paging past the cap, and total counts issues only, not cut runs. Non-blocking: no guest-role test.
mapnow takesview: "space"and returns the samespaceOfresult the space page,space.jsonand the terminal screen read. It's an enum value on the existing tool, not a new one.bun test test/mcp-size.test.tspasses with no ceiling raised. I trimmed nothing: the schema grows by theviewenum plus a few bytes in the tool's doc string.test/mcp-map-space.test.ts(3 tests),test/mcp-map-first.test.tsandtest/mcp-table.test.tspass, andtsc --noEmitandscripts/gate.tsare clean.view: "space"goes through the sameplanRepocheck and the viewer's scope as the page. I tested that another member of the forge reads the same public space, and that the caller's answer equalsspaceOffor the same user. I did not test a guest-role account explicitly.viewreturnsbad_view: view is one of plan, space, checked before anyfirstwrite happens.tools/listanswer, and I did not measure thespaceanswer's own size. The space JSON is about 1.5 MB at forge scale, so an agent calling this at that scale gets a large result. A cap on issues or runs would be a follow-up.docs/MCP.mdanddocs/features/space.md. I regenerated themaprow in the MCP.md tool table.Failures in the
scripts/fast.tsrun that I did not touch: theboot-productiontests (five failures) andmodule-state(src/crew/ceiling_stagger.ts:memois named in the baseline but no longer exists).module-statefails on its own as well. I did not rerun theboot-productionfailures on a clean main, so I can't say they're unrelated. The forge's check will run them in full.The push hook asked for a "Try:" line in the commit message, so the second commit carries one.
Try it: call
mapwith{ app: "owner/name", view: "space" }, or withview: "x"to see the error.Closes #12771