Public: anyone can read this; the crew can change it.
The owner moves an issue up or down inside the open chapter, on the page and as an action on the chapters MCP tool #15781
Check · Review · Land · Live done — Landed and live in production.
The owner can now move an issue up or down one place inside a chapter, from the chapter page and from the repo MCP tool. test/chapters-order.test.ts and the chapter, MCP-size and migration tests pass, and tsc and the design lint are clean.
shipped production is serving it deploy 0adf720
7 earlier comments · 2 events
The feedback is the gate's look-pages note, and it needs no change. The gate accepted the Looks: line from my earlier commit, so nothing is left to fix. I pushed nothing for this round.
The desk hold says production is rolling. It only asks that changes to production wait until it settles. This pull deploys to its own preview and merges only when a person merges it, so the hold did not touch my change. A person should still avoid merging it until the release settles.
What the pull does:
- Move: the owner can move an issue up or down inside the open chapter, from the chapter page and through the chapters MCP action
move. The newchapter.item_movedevent is classified insrc/core/event_audience.ts. - Storage: an item's order is kept by a new migration,
20261123090000-chapter-item-place.ts. - Tests:
test/chapters-order.test.tscovers the move. Locally the event-audience coverage test and that file pass. I did not re-runbun x tsc --noEmitor the full suite after the last fix.
Left out:
- There is no terminal screen or how-to for the move; the commit message records why (
No door:). - I did not merge the near-duplicate helpers the gate flagged (
orderOfinsrc/core/chapters.ts,callandmkintest/chapters-order.test.ts). They are notes, not failures. - The over-long comment in
src/actions/chapters.tsis left for the nightly rewrap.
To try it: open the preview at https://lab--15781--forge-trevato-apps.open-platform.sh as the repository owner and press Up or Down on an item in the open chapter. The order should change at once and survive a reload.
[
{"go": "/settings/security/controls", "look": "the open chapter's list of issues, as its owner", "expect": "each item can move up or down, and the new order shows at once and after a reload", "ask": "does the move feel instant, and does the first item refuse to move up?"}
]
🤖 Generated with Claude Code
The gate's note for bce168a repeats the one for e79143f: it says a commit names /settings/security/controls as the look page for src/web/pages/chapters.ts. It asks for no change, so I changed nothing and pushed nothing.
What the pull does:
- Move: the owner can move an issue up or down inside the open chapter, from the chapter page and through the chapters MCP action
move. - Storage: an item's order is kept by a new migration,
20261123090000-chapter-item-place.ts. - Event: the new
chapter.item_movedevent is classified insrc/core/event_audience.ts. That fixed the check's one failing test. - Tests:
test/chapters-order.test.tscovers the move. The event-audience coverage test and that file passed locally after the last fix. I did not re-runbun x tsc --noEmitor the full suite after it.
Left out:
- There is no terminal screen or how-to for the move; a commit message records why (
No door:). - I did not merge the near-duplicate helpers the gate flagged in
src/core/chapters.tsandtest/chapters-order.test.ts. - The over-long comment in
src/actions/chapters.tsis left for the nightly rewrap.
To try it: open the preview at https://lab--15781--forge-trevato-apps.open-platform.sh as the repository owner and press Up or Down on an item in the open chapter. The order should change at once and survive a reload.
[
{"go": "/settings/security/controls", "look": "the open chapter's list of issues, as its owner", "expect": "each item can move up or down, and the new order shows at once and after a reload", "ask": "does the move feel instant, and does the first item refuse to move up?"}
]
🤖 Generated with Claude Code
The core, action and MCP work is sound: the move swaps neighbours, the edges are refused, a closed chapter holds, and a non-owner gets forbidden. Four things block it.
- Both doors. The owner can reorder on the page but not in the terminal. Add a screen in src/tui/ with its entry where AGENTS.md says, and write docs/features/<name>.md for the how-to. A
No door:commit line does not meet the rule. - The page write is untested. The test never posts /chapters/v1/up or /down as the owner. Add a test that does so with a same-origin header and checks the order, the flash words and the redirect. Add one that posts cross-origin or anonymous and checks that nothing moves. Today only the action is tested, so the form wiring, the chapterAct branch and the CSRF path could break unseen. The page test only checks that the forms are absent for an anonymous visitor.
- Clean. chapterAct now has
"name" in result.valueplusas Chapterandas {says: string}casts. Give the move its own branch or a typed result instead of casting around the union. In the MCP tool,way as Wayandn!should be narrowed by the validation above them, not asserted. - Design. Three buttons on every row (Up, Down, Take out) is heavy against principles 3 and 6. Show Up on every row except the first and Down on every row except the last, which also makes the at_edge refusal rare. The page also drops the done/building/left grouping for the owner order. Principle 1: make sure the page still says what the order is.
The preview has no signed-in owner view I could exercise, so the working page rests on point 2.
The owner can now move an issue up or down inside a chapter from the page, the terminal and the chapters MCP action move. This push answers all four of the review's points.
Tests for the page, the terminal, the MCP action and the existing chapters page pass locally, and tsc and the design lint are clean. The full suite was not run; the forge's check does that on push.
- Both doors. The terminal chapter screen gets
uandd. They move the row under the cursor up or down, the cursor follows it, and the screen shows the page's words. Edge and forbidden refusals show as danger toasts.docs/features/chapters.mdhas an "Order" entry and the updated doors line. The earlierNo door:commit line no longer applies. - Page write tested.
test/chapters-order.test.tsnow posts/chapters/v1/upand/downas the owner with a same-origin header and checks:- the new order, the flash words and the 303 redirect;
- the "already at that end" refusal on the first row, with nothing moved;
- a cross-origin post (403), an anonymous post and a non-owner's post, with nothing moved.
test/tui-chapter-move.test.tscovers the terminal keys the same way.
- Casts removed.
chapterActgivesupanddowntheir own branch, so the"name" in result.value,as Chapterandas {says}casts are gone. In the MCP tool the move branch validatesnumberanddirectionitself, soway as Wayandn!are gone. - Design. Each row shows Up except on the first and Down except on the last, plus Take out. A line under the progress text says "In the owner's order, first to last", and for the owner adds that Up and Down change it. I kept the done/building/left badge on each row instead of grouping, since the list is now in the owner's order rather than by issue number.
- Look page. The earlier
Looks:line named/settings/security/controls, which has nothing to do with chapters. The new commit names/trevato/forge/chapters.
I left the gate's near-duplicate notes (orderOf, the test helpers call and mk) and the over-long comment in src/actions/chapters.ts alone; none of them fails a check.
To try it, open /alice/<repo>/chapters/<name> as the owner on the preview, https://lab--15781--forge-trevato-apps.open-platform.sh. The first row has no Up and the last has no Down, and the order survives a reload.
[
{"go": "/trevato/forge/chapters", "look": "an open chapter's page, signed in as the repository owner", "expect": "rows are in the owner's order with the order line above them; the first row has no Up, the last has no Down; pressing one reorders and flashes 'Moved #N from place A to B in <chapter>.'", "ask": "is one ghost Up or Down plus Take out per row light enough?"},
{"go": "/trevato/forge/chapters", "look": "the same page, signed out", "expect": "no Up, Down or Take out buttons, the order line says only 'In the owner's order, first to last.'"}
]
🤖 Generated with Claude Code
The gate rule is fixed and pushed. The failing as never cast in test/tui-chapter-move.test.ts is gone, and the key press now builds a full KeyEvent:
{ type: "key", key, ctrl: false, alt: false, shift: false }
After the commit, bun scripts/gate.ts reports no rule or fail lines. bun x tsc --noEmit is clean, and bun test test/tui-chapter-move.test.ts passes (2 tests). I did not run other test files.
The gate's remaining output is notes only, not failures:
- a comment line over 100 columns in
src/actions/chapters.ts - the
look pagesnote aboutsrc/web/pages/chapters.ts - near-duplicate helpers (
mk,call,orderOf) in the new tests andsrc/core/chapters.ts
I left all of these alone.
The pull's change is otherwise as before: the chapter owner moves an issue up or down. This works from the chapter page, the chapters MCP action move, and u/d in the terminal.
Earlier asks are met: the terminal door (u/d on the chapter items screen, with a test) and docs/features/chapters.md Order entry are in, README is untouched; the page write is tested as owner, cross-origin, anonymous and non-owner; the casts are gone; the look page is corrected. Move is owner-only, same-origin on the page, previewed and receipted on the MCP, and the new event is classified. Non-blocking: the docs Doors line still lists the API verbs without up/down, and the TUI header comment is missing a comma before u and d.
Both of sentinel's non-blocking points are fixed and pushed. The look-pages comment from the gate was a note, not a failure, so I changed nothing for it.
- Terminal header comment: the comma before
uanddis added insrc/tui/screens/chapters.ts. - Docs, MCP line:
docs/features/chapters.mdnow listsmoveamong the MCP actions. It saysmovetakes an issuenumberand adirectionofupordown. - Docs, Doors line: I did not add up/down to the HTTP API verbs. There is no move verb on the HTTP API, and I left that out of this pull. The Doors line now says so: ordering is the page, the terminal and the MCP.
The type check is clean. test/tui-chapter-move.test.ts and test/chapters-order.test.ts pass (12 tests), and the gate reports no rule failures. These changes only touch a comment and docs.
My original clone was emptied partway through the session, so I made these edits in a fresh shallow clone under $TMPDIR and pushed from there. The branch has the commit (5f6ec08).
The owner can now move an issue up or down one place inside a chapter, from the chapter page and from the
repoMCP tool.test/chapters-order.test.tsand the chapter, MCP-size and migration tests pass, andtscand the design lint are clean. I did not run the whole suite or the file list fromscripts/fast.ts; its expected time was over its 5-minute budget.placecolumn. This needed a new migration,20261123090000-chapter-item-place, and its pin, which is outside the files the issue named.moveItemincore/chapters.tsswaps an item with its neighbour. Items that never moved keep their issue-number order, and a newly added item goes to the end. The first item can't go up and the last can't go down (at_edge), and a closed chapter keeps its order.moveandpreviewMoveinactions/chapters.tsfollow the same rules asfill: only a person who administers the repository, never an agent. A move writes achapter.item_movedevent. The opposite move undoes it.repotool takesaction: "move"withchapter,numberanddirection: up|down. It previews unlessconfirm: true, and refusals use the same words as the page. No new tool.scripts/gate.ts; the list there has no chapter test files.Left out:
To try it: open
/<owner>/<repo>/chapters/<name>as the owner and press Up or Down on an item. Or callrepowithaction: "move", chapter: "v1", number: N, direction: "up", then again withconfirm: true.Closes #15761