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

Parked opened this
Closed without merging

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.

Notes

stopped parked by the crew deploy 44ab67d

opened this

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: map takes { app, first: <issue number> } and answers { first, says }. A call without first still only reads, so ro tokens can read the map as before. The argument is named app, like the tool's other argument, not the repo the 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/first through the usual origin and scope checks (src/web/pages/map_first.ts).
  • Rank event: a rank is an issue.ranked event carrying the actor, written by src/actions/first.ts. The latest rank leads. Closed, blocked, Later-gated, non-issue or not-ready issues answer invalid; a stranger gets unauthorized and a non-writer forbidden.
  • Order:
    • The map's "Ready now" list and readyNow put 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.
  • Docs: docs/MCP.md is regenerated. The map tool's description is trimmed to stay under the MCP size ceilings, which I did not raise. The how-to is in docs/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.

Closes #7657

3 earlier comments · 1 event
commented

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: map takes { app, first: <issue number> } and answers { first, says }. A call without first still only reads, so ro tokens can read the map as before. The argument is named app, like the tool's other argument, not the repo the 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/first through the usual origin and scope checks (src/web/pages/map_first.ts).
  • Rank event: a rank is an issue.ranked event carrying the actor, written by src/actions/first.ts. The latest rank leads. Closed, blocked, Later-gated, non-issue or not-ready issues answer invalid; a stranger gets unauthorized and a non-writer forbidden.
  • Order:
    • The map's "Ready now" list and readyNow put 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.
  • Docs: docs/MCP.md is regenerated. The map tool's description is trimmed to stay under the MCP size ceilings, which I did not raise. The how-to is in docs/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.
commented

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: map takes { app, first: <issue number> } (not repo, 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.ranked event carrying the actor, and the latest rank leads. Closed, blocked, Later-gated or non-issue targets answer invalid. A stranger gets unauthorized and a non-writer forbidden.
  • 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.ts ranks 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.md is regenerated, and the how-to is in docs/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.

Changes requested — before the latest push

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:

  1. 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.
  2. 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 ro token calling map with first is refused; the forbidden path is checked over MCP.
  3. 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.

commented

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 map takes first: <issue number>. The map page's ready rows get a "First" button for writers. Both go through putFirst and write an issue.ranked event.
  • Only an open issue that is ready now can be ranked.
  • readyNow puts the latest rank first, and the crew's slotOrder starts ranked issues before the rest, including small ones past their share.

Review changes

  • Terminal: f on a ready line of the plan screen (src/tui/screens/plan.ts) calls putFirst. 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 in test/tui-plan-first.test.ts.
  • Route tests: POST /issues/:number/first is now tested for a guest sent to sign in, a cross-origin post and an ro token 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 ro token calling map with first is refused over MCP, and so is a non-writer (forbidden).
  • Cleanups:
    • I renamed of2 to rankAt rather than folding the two sorts into one, because the earlier sorts rely on being stable.
    • src/actions/first.ts uses the RANKED constant.
    • The redundant ternary in src/http/mcp/tools/map.ts is gone.
    • The stray comma in the test/map-first.test.ts test name is gone.
  • Cost of rankedInRepo: the existing event_repo_kind_number_at index covers (repo_id, kind, payload number), so only that repository's issue.ranked events are read. I noted this in the code and added no migration.

Left out

  • The First form is still in the row's children slot, which I did not change. The row's trail slot sits inside the row's <a>, and a form inside an anchor is invalid. I named the pattern in docs/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

  1. Call MCP map with {app, first: N}.
  2. Open /<owner>/<app>/map as a writer and press First.
  3. In the terminal, open Plan and press f.
commented

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)

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs