Public: anyone can read this; the crew can change it.
A person puts a ready issue first: MCP `map` `first` and the map page reorder what the crew starts next #7773
A writer can now put a ready issue first, from MCP map or from a First button on the map page, and the crew starts ranked ready issues before the rest. bun x tsc --noEmit is clean. The new test/map-first.test.ts, the map and autonomy suites, and the MCP size, docs and event-audience tests pass.
stopped parked by the crew deploy 44ab67d
3 earlier comments · 1 event
A writer can now put a ready issue first, from MCP map or from a First button on the map page, and the crew starts ranked ready issues before the rest. bun x tsc --noEmit is clean. The new test/map-first.test.ts, the map and autonomy suites, and the MCP size, docs and event-audience tests pass. The design lint ran and reported nothing. I did not run the full suite; the forge's check does that on push.
What changed
- MCP:
maptakes{ app, first: <issue number> }and answers{ first, says }. A call withoutfirststill only reads, sorotokens can read the map as before. The argument is namedapp, like the tool's other argument, not therepothe issue wrote. - Map page: each ready issue in the "Ready now" list shows a First button to a writer. It posts to
/:owner/:name/issues/:number/firstthrough the usual origin and scope checks (src/web/pages/map_first.ts). - Rank event: a rank is an
issue.rankedevent carrying the actor, written bysrc/actions/first.ts. The latest rank leads. Closed, blocked, Later-gated, non-issue or not-ready issues answerinvalid; a stranger getsunauthorizedand a non-writerforbidden. - Order:
- The map's "Ready now" list and
readyNowput ranked issues first, so the page, the MCP and the crew all agree. - The crew's pick order puts ranked issues ahead of raised, roadmap and small work.
- A rank only reorders what is already ready, so the Later gate and pillar order are untouched.
- The map's "Ready now" list and
- Docs:
docs/MCP.mdis regenerated. The map tool's description is trimmed to stay under the MCP size ceilings, which I did not raise. The how-to is indocs/features/map-first.md.
Test: it ranks B over A and finds driveRepo assigns B. It also checks that closed and blocked issues are refused with no event written, that the event carries the actor, and that the map page shows the First button.
Chosen on purpose
- A ranked small issue is not held to the small-work share, since a person asked for it by name.
- There is no "unrank" and no explicit order list; ranking again moves an issue to the front.
- The POST route is not exercised by a test. The test only checks the button renders.
A writer can now put a ready issue first, from MCP map or from a First button on the map page, and the crew starts ranked ready issues before the rest.
The check failure: test/mcp.test.ts ("map and wait_for are the plan's own actions") expected map to carry the read-only hint. map now takes first, which writes, so the hint is false. I changed that one assertion to [false, false] and left a comment saying why; the test was out of date, not the code. A call without first still only reads, so read-only tokens can still read the map. I re-ran that file, the MCP docs and size tests, and the other tests that mention map or the read-only hint; all pass. I did not re-run the full suite; the forge's check does that on this push.
What changed
- MCP:
maptakes{ app, first: <issue number> }(notrepo, to match the tool's other argument) and answers{ first, says }. - Map page: each ready issue in the "Ready now" list shows a First button to a writer, posting to
/:owner/:name/issues/:number/first. - Rank: it is an
issue.rankedevent carrying the actor, and the latest rank leads. Closed, blocked, Later-gated or non-issue targets answerinvalid. A stranger getsunauthorizedand a non-writerforbidden. - Dispatcher: ranked ready issues are picked ahead of raised, roadmap and small work. A rank only reorders what is already ready, so the Later gate and pillar order are untouched. The map's "Ready now" list shows the same order.
- Test:
test/map-first.test.tsranks B over A and finds the dispatcher picks B. It also checks that closed and blocked issues are refused with no event written, and that the event carries the actor. - Docs:
docs/MCP.mdis regenerated, and the how-to is indocs/features/map-first.md.
Left out
- There is no "unrank"; ranking again moves an issue to the front.
- A ranked small issue is not held to the small-work share, since a person asked for it by name.
- The POST route has no test of its own; the page test only checks that the button renders.
To try it: on a repo's /map, press First on an issue in "Ready now", or call map with { app: "owner/name", first: 12 } using an rw token.
Fix first: the terminal door. The plan screen in the terminal UI (src/tui/screens/plan.ts) lists ready issues and has no way to put one first, so a person can do on the page what they cannot do in the terminal. Add a key there that calls putFirst. Its refusals should read like the page's, and it needs a test.
Also needed:
- The POST /issues/:number/first route has no test. Add tests for: a guest is sent to sign in; a cross-origin or ro-scope post is refused; a non-writer gets forbidden and no event is written; a writer's post writes the event and flashes.
- Add tests for the other behaviours this adds. These would pass if the code were removed: the latest rank leads when two issues are ranked; a ranked small issue is not held to the small share (slotOrder); a page without writer rights shows no First button; an
rotoken callingmapwithfirstis refused; the forbidden path is checked over MCP. - This is a feature, and the direction says pipeline items come first. The issue was assigned, so I am not blocking on that alone.
Smaller cleanups are in the line comments.
A writer can now put a ready issue first from the MCP, the map page, and the terminal plan screen. All the review points are addressed except the form placement on the map, where I chose to document the pattern instead (see Left out). My new tests pass (12) and tsc and the design lint are clean. I ran only the tests covering this change, not the full suite, since scripts/fast.ts found 1,282 test files affected. The forge runs the full check on this push.
What it does
- MCP
maptakesfirst: <issue number>. The map page's ready rows get a "First" button for writers. Both go throughputFirstand write anissue.rankedevent. - Only an open issue that is ready now can be ranked.
readyNowputs the latest rank first, and the crew'sslotOrderstarts ranked issues before the rest, including small ones past their share.
Review changes
- Terminal:
fon a ready line of the plan screen (src/tui/screens/plan.ts) callsputFirst. It toasts "#N is first in line." on success and the page's own refusal words otherwise, including for a non-writer or a non-ready line. It is tested intest/tui-plan-first.test.ts. - Route tests:
POST /issues/:number/firstis now tested for a guest sent to sign in, a cross-origin post and anrotoken both refused (403), a non-writer refused with no event written, and a writer's post writing the event and flashing. - Other tests: the latest rank leads when two are ranked, and a ranked small issue skips the small share while an unranked one does not. A page without writer rights shows no First button, and the writer's button is a POST form. An
rotoken callingmapwithfirstis refused over MCP, and so is a non-writer (forbidden). - Cleanups:
- I renamed
of2torankAtrather than folding the two sorts into one, because the earlier sorts rely on being stable. src/actions/first.tsuses theRANKEDconstant.- The redundant ternary in
src/http/mcp/tools/map.tsis gone. - The stray comma in the
test/map-first.test.tstest name is gone.
- I renamed
- Cost of
rankedInRepo: the existingevent_repo_kind_number_atindex covers (repo_id, kind, payload number), so only that repository'sissue.rankedevents are read. I noted this in the code and added no migration.
Left out
- The First form is still in the row's
childrenslot, which I did not change. The row'strailslot sits inside the row's<a>, and a form inside an anchor is invalid. I named the pattern indocs/design/areas/map.md. It posts with JavaScript off. - This is a feature while the direction puts pipeline items first. I'm leaving that call to you, as you said you weren't blocking on it.
Try it
- Call MCP
mapwith{app, first: N}. - Open
/<owner>/<app>/mapas a writer and press First. - In the terminal, open Plan and press
f.
Parked by the crew: the check failed ("event audience coverage > every kind the source emits is classified") and the decider saw no point in another try try 1: docs/MCP.md, docs/design/areas/map.md, docs/features/map-first.md, src/actions/first.ts (+13 more)
A writer can now put a ready issue first, from MCP
mapor from a First button on the map page, and the crew starts ranked ready issues before the rest.bun x tsc --noEmitis clean. The newtest/map-first.test.ts, the map and autonomy suites, and the MCP size, docs and event-audience tests pass. The design lint ran and reported nothing. I did not run the full suite; the forge's check does that on push.What changed
maptakes{ app, first: <issue number> }and answers{ first, says }. A call withoutfirststill only reads, sorotokens can read the map as before. The argument is namedapp, like the tool's other argument, not therepothe issue wrote./:owner/:name/issues/:number/firstthrough the usual origin and scope checks (src/web/pages/map_first.ts).issue.rankedevent carrying the actor, written bysrc/actions/first.ts. The latest rank leads. Closed, blocked, Later-gated, non-issue or not-ready issues answerinvalid; a stranger getsunauthorizedand a non-writerforbidden.readyNowput ranked issues first, so the page, the MCP and the crew all agree.docs/MCP.mdis regenerated. The map tool's description is trimmed to stay under the MCP size ceilings, which I did not raise. The how-to is indocs/features/map-first.md.Test: it ranks B over A and finds
driveRepoassigns B. It also checks that closed and blocked issues are refused with no event written, that the event carries the actor, and that the map page shows the First button.Chosen on purpose
Closes #7657