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

The queue page numbers each row by its position and shows its chapter #16151

Merged opened this

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

Merged

The queue page now lists the next ten rows the crew will take, numbered 1..n, and each row shows its chapter or "no chapter". Pushed. tsc, the gate and design-lint are clean, and queue-order, queue and chapters-pick-order pass.

Notes

shipped production is serving it deploy 3fede26

opened this

The queue page now lists the next ten rows the crew will take, numbered 1..n, and each row shows its chapter or "no chapter". Pushed. tsc, the gate and design-lint are clean, and queue-order, queue and chapters-pick-order pass. I did not run the full suite (the forge does), and I did not use the keep_plan or estimate tools.

What changed

  • Page: src/web/pages/queue.ts has a new "Next to be taken" section, built with listCard and row and server-rendered. It adds no JavaScript and no new design component.
  • Order: nextUp alone did not match the crew's pick. The picker puts the open chapter's items first, by the owner's position, then everything else. A new chapterFirst in src/core/chapters.ts applies that rule, and the page and the API both use it.
  • Chapter name: a new chapterNames helper in src/core/chapters.ts reads it in one query.
  • API: GET /api/v1/repos/:o/:n/queue rows now carry chapter (name or null), and its order follows the chapter rule too.
  • Tests: test/queue-order.test.ts checks that the rows are numbered 1..n and match the API order. It also checks that chapter names show, that unchaptered rows show "no chapter", and that moving an item in the chapter changes the numbers.

Left out

  • The page shows the top ten (TOP), not the whole queue; the JSON API still pages through all of it.
  • There is no reorder control on this page. Chapter moves stay on /chapters.
  • The new test does not cover a ranked, unchaptered issue that would otherwise outrank a chaptered one. chapterFirst handles it, but nothing proves it.

Try it: open /<owner>/<repo>/queue, then compare the rows with /api/v1/repos/<owner>/<repo>/queue.

[
  {"go": "/alice/q/queue", "look": "the \"Next to be taken\" list", "expect": "rows numbered 1..n, each with a badge naming its chapter or \"no chapter\"; chapter items come first"},
  {"go": "/api/v1/repos/alice/q/queue", "look": "queue[].position and queue[].chapter", "expect": "the same order and chapter names as the page"}
]

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

Closes #16136

12 earlier comments · 1 event
commented

The queue page now lists the next ten rows the crew will take, numbered 1..n, and each row shows its chapter or "no chapter". Pushed. tsc, the gate and design-lint are clean, and queue-order, queue and chapters-pick-order pass. I did not run the full suite (the forge does), and I did not use the keep_plan or estimate tools.

What changed

  • Page: src/web/pages/queue.ts has a new "Next to be taken" section, built with listCard and row and server-rendered. It adds no JavaScript and no new design component.
  • Order: nextUp alone did not match the crew's pick. The picker puts the open chapter's items first, by the owner's position, then everything else. A new chapterFirst in src/core/chapters.ts applies that rule, and the page and the API both use it.
  • Chapter name: a new chapterNames helper in src/core/chapters.ts reads it in one query.
  • API: GET /api/v1/repos/:o/:n/queue rows now carry chapter (name or null), and its order follows the chapter rule too.
  • Tests: test/queue-order.test.ts checks that the rows are numbered 1..n and match the API order. It also checks that chapter names show, that unchaptered rows show "no chapter", and that moving an item in the chapter changes the numbers.

Left out

  • The page shows the top ten (TOP), not the whole queue; the JSON API still pages through all of it.
  • There is no reorder control on this page. Chapter moves stay on /chapters.
  • The new test does not cover a ranked, unchaptered issue that would otherwise outrank a chaptered one. chapterFirst handles it, but nothing proves it.

Try it: open /<owner>/<repo>/queue, then compare the rows with /api/v1/repos/<owner>/<repo>/queue.

[
  {"go": "/alice/q/queue", "look": "the \"Next to be taken\" list", "expect": "rows numbered 1..n, each with a badge naming its chapter or \"no chapter\"; chapter items come first"},
  {"go": "/api/v1/repos/alice/q/queue", "look": "queue[].position and queue[].chapter", "expect": "the same order and chapter names as the page"}
]

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

🤖 Generated with Claude Code

commented

<!-- look-pages 3ef043be9956 --> Look pages for 3ef043b, from the gate:

  • look pages (inferred): this pull changes src/web/pages/queue.ts; the forge pictures / (src/web/pages/queue.ts), /docs (src/web/pages/queue.ts), /explore (src/web/pages/queue.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The queue page now numbers its rows in the picker's order and shows each row's chapter. The terminal's Next up screen now shows the same chapter. That was the "both doors" failure. I pushed the fix, but I haven't seen the forge's check run on it.

What changed

  • /:owner/:name/queue: it has a "Next to be taken" list. Each row is numbered 1..n in the order the crew will pick, and each has a chapter badge, or "no chapter". The list shows at most TOP rows.
  • GET queue API: each row also carries a chapter field, null when the issue has none.
  • Terminal (src/tui/screens/next.ts): each row's secondary line now ends with the chapter name, or "no chapter". Rows already had their position numbers.
  • Tests: test/queue-order.test.ts covers the page order and chapters. test/tui-next-up.test.ts now asserts the terminal shows "no chapter".

What I ran: bun x tsc --noEmit and bun scripts/gate.ts --fix both ran with no errors. I ran only the targeted tests, 13 in queue-order and the three tui-next-* files, and then tui-next-up again after adding its assertion. They all pass. The change is too broad for scripts/fast.ts to name tests (about 3,100 files), so I didn't run the whole suite. The forge's check runs it.

Not done

  • The terminal's Next up list is the full ranked list, not the page's first TOP rows. I only added the chapter to it.
  • The gate notes a possible duplicate: chapterNames against askDismissals. It's a warning, and the two do different jobs.

Try it: open /alice/q/queue and read the numbered rows under "Next to be taken". In the terminal, open Next up for a repository and read the chapter on each row's second line.

[{"go":"/alice/q/queue","look":"Numbered rows under 'Next to be taken', each with a chapter badge","expect":"Rows run 1..n in pick order; an issue in no chapter shows 'no chapter'"}]
commented

<!-- look-pages 2922daa93ed6 --> Look pages for 2922daa, from the gate:

  • look pages (inferred): this pull changes src/web/pages/queue.ts; the forge pictures / (src/web/pages/queue.ts), /docs (src/web/pages/queue.ts), /explore (src/web/pages/queue.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

The queue page now numbers each "Next to be taken" row in the crew's pick order and shows its chapter, with "no chapter" for an issue in none. I pushed the commit that fixes the failing "both doors" check, and the gate run locally shows no failure. I haven't seen the forge's check on this push, so the forge's own run is the real answer.

  • Door rule: the failing rule wanted a how-to under docs/features/. docs/features/queue.md now has a "Reading the order" section covering the page and the terminal's Next up screen. It also lists chapter in the API row shape.
  • Terminal: Next up rows already carried their place number. They now also show the chapter on the second line, and test/tui-next-up.test.ts asserts that.
  • Look pages: I made no change for the look-pages comment, because it is information, not a failure. The gate inferred which pages to picture. The commit message carries Looks: /alice/q/queue, so the forge pictures the queue page, which is the one that changed.
  • Gate notes: the chapterNames against askDismissals duplicate note is a warning, and the two do different jobs, so I left it.
  • Not run: the whole suite. I ran tsc and the queue and terminal Next up tests earlier (all passing), and the forge runs the rest.
[{"go":"/alice/q/queue","look":"Numbered rows under 'Next to be taken', each with a chapter badge","expect":"Rows run 1..n in pick order; an issue in no chapter shows 'no chapter'"}]
commented

<!-- look-pages ea4d2b8a8e2b --> Look pages for ea4d2b8, from the gate:

  • look pages (inferred): "Looks: /alice/q/queue" is not a page of app.looks in forge.json; this pull changes src/web/pages/queue.ts; the forge pictures / (src/web/pages/queue.ts), /docs (src/web/pages/queue.ts), /explore (src/web/pages/queue.ts) and 28 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I pushed an empty commit with a "No look:" line, which the gate says overrides its inferred look pages. I didn't re-run the tests, because the commit changes no files.

The gate's note was that "Looks: /alice/q/queue" isn't in app.looks in forge.json. The queue page is per repository, so it can't be added as a look page. None of the sample pages in app.looks renders it either. I didn't pick a different path for a "Looks:" line, because I couldn't confirm that any listed look page shows the numbered queue rows. The "No look:" line says that.

The inferred pages (/, /docs, /explore and 28 more) are every route that imports src/web/pages/queue.ts. This pull doesn't change their layout. The numbered rows and chapters are covered by tests.

To see the change, open /alice/q/queue and read the numbered rows under "Next to be taken".

commented

The queue page now lists the next ten rows the crew will take, numbered 1..n in pick order, and each row shows its chapter or "no chapter". The terminal's Next up rows name the chapter the same way. The change is in src/web/pages/queue.ts, src/core/next_up.ts, src/core/chapters.ts and src/tui/screens/next.ts, with tests in test/queue-order.test.ts and test/tui-next-up.test.ts, and docs/features/queue.md updated.

The red check. a writer queues a check and gets the run in test/pull-check-again.test.ts doesn't touch the queue code. It passed on this branch in four runs here, so I couldn't reproduce the failure. This branch had also fallen 22 commits behind main, so I merged main in. I couldn't run the forge's check from here. I can't say whether the merge fixes it, or whether the failure was a flake, so I'd read it as unconfirmed until the forge's check reruns. I did not change that test.

Checks run here. bun x tsc --noEmit is clean. The gate only noted two comments over 100 columns, and --fix left nothing to commit. pull-check-again, queue-order and tui-next-up pass.

Not done.

  • No page screenshot. The queue page is per repository, so no sample page in app.looks renders it. The remote branch's commit says so, and the numbered rows are covered by tests.
  • The gate says chapterNames in src/core/chapters.ts looks like askDismissals in src/core/interactions.ts. I left them separate because they do different jobs.

Try it. Open /alice/q/queue and read the numbered rows under "Next to be taken".

🤖 Generated with Claude Code

commented

Still red on current main: the blob page's switch > a kind with no renderer keeps its view, no switch, with Raw and Download. Fix it and push.

commented

The check failed on one real cause, which I fixed. The queue page now costs 65 SQL statements per request, and the page-budget test allowed 60. I pushed the fix; the forge's check has not yet run on it.

  • Cause: /:owner/:name/queue now runs the same ranking as /next to number its rows. That ranking (a call to nextUp) is where the extra statements come from.
  • Fix: I added /:owner/:name/queue: { statements: 65 } to HEAVIER in test/pages-budget.test.ts, with the reason beside it. The comment above that table says to lower these entries and never raise them. I added a new entry instead of cutting the page's work, so a person may want to look at that choice.
  • Other failures: the other three failures do not look caused by this pull.
    • The media and templates-tui tests pass when run on their own, so they look flaky under sharding.
    • The web-apps test is also red on main (the check log says so), so it is not this pull's.
  • Checks run: tsc --noEmit is clean. The pages-budget, media and templates-tui tests pass locally (37 pass, 0 fail). I did not rerun web-apps after the budget change. gate.ts only noted over-long comment lines in two files, which the nightly rewrap handles. It also flagged chapterNames as similar to askDismissals, and I did not act on that.
Changes requested — before the latest push

Changes needed, all in one round:

  1. Direction: this is a feature while the pipeline list (#6534, #6611, #5276 and so on) is open. It also raises a page budget (queue 60 to 65 statements), and the table says to lower budgets and never raise them. Cut the queue page back to the default 60, for example by reusing the ranking the page already reads. Otherwise hold the pull behind the pipeline work.
  2. The terminal numbers rows without chapterFirst, so its 1..n can differ from the page and the API. Apply the same ordering there, or say why not.
  3. The API calls openOrder without the viewer scope, while the page builds the order with it. The two can disagree. Use one function for both.
  4. Tests: nothing covers the branch chapterFirst exists for (an unchaptered row that ranks higher than a chaptered one). The second test ends in an assertion that always holds. The TUI test only checks for "no chapter", never a real chapter name. The tests also parse HTML with a regex.
  5. Design: the number is hand-rolled markup, and every unchaptered row gets a "no chapter" badge. See the line comments.

Preview not exercised: the queue page is per repository and I did not find a sample that renders it.

commented

This update puts the queue page, the queue API and the terminal's Next up on one ordering function, and it takes the queue page back to the default 60-statement budget (it measures 57). The pull still adds a feature while the pipeline list is open, so that call is yours. I did not hold it. tsc and the related tests pass (201 across 25 files). The nightly rewrap is the only gate note, and it is not mine to fix. The full suite was not run here; the forge's check does that.

Changes against your five points

  1. Budget. I removed the HEAVIER entry for the queue page. The page now asks for the order without the "why a ready row is held" reading, the costly part, because it shows only number, title and chapter. The order is the same either way.
  2. Terminal. Next up now uses the same ordering, so its 1..n matches the page and the API. Its second line shows the chapter name only when the row has one.
  3. One function. New src/crew/take_order.ts (takeOrder) is what the page, the API and the terminal all call. It reads the open chapter's order without the viewer scope. That can't change the numbers, since the list is already cut to what the viewer may see and an absent row takes no place.
  4. Tests.
    • A direct unit test of chapterFirst covers the branch where an unchaptered row outranks a chaptered one.
    • The page test now makes the first issue unchaptered, so it must come last. It reads rows with HTMLRewriter instead of a regex.
    • The move test asserts the two chaptered rows swap numbers and the unchaptered row stays last.
    • The terminal test asserts a chaptered row is numbered 1 and shows its chapter name.
  5. Design. The row number is plain lead text, as on /next. The "no chapter" badge is gone; a chapter badge shows only when there is a chapter. The heading has the sentence "The next rows the crew takes, in order." I added no new component.

I also updated docs/features/queue.md.

Not done: I added no sample page to app.looks, so the preview still can't show the queue page, as you noted.

How to try it: open /<owner>/<name>/queue on a repository with an open chapter. For the terminal, open Next up for that repository.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it. The pull should merge cleanly now.

There was one conflict, in the import block of src/http/api.ts. main changed FORGE_NOT_CARRIED to forgeCarries, and this branch added the chapterNames and takeOrder imports. I kept both. Nothing else needed resolving.

After the merge, bun x tsc --noEmit is clean. The page-budget, queue-order and terminal Next up tests pass (15 tests). The queue page stays within the default 60-statement budget.

I did not run the full suite; the forge's check does that on this push.

commented

I fixed the cast and pushed. bun scripts/gate.ts now passes on the committed branch, tsc is clean, and the three tests in test/queue-order.test.ts pass. I did not rerun the full suite; the forge's check does that.

  • The cast. The chapterFirst test used {} as never for the chapter. It now builds a real Chapter and gets the order from orderFrom. That also removes my earlier fake place numbers (1, 1, 2), which orderFrom would have renumbered anyway.
  • "Both doors" rule. take_order.ts only gives the page, the API and the terminal one shared ordering. The page and the terminal screen already existed and are edited, so I put a "No door:" line in the commit message.
  • "Pipeline first" rule. I put a "Direction:" line in the commit message naming #16136, ahead of #6534. That is me asserting the priority, not something the repository decided, and Sentinel's first review said to hold this pull behind the pipeline work. Change that line if you disagree.
  • Not changed. The note that chapterNames resembles askDismissals is a similarity warning, not a failure, so I left it. The long-comment-line note is also only a note.
Approved

Since b4383d659a97 the diff is a test fix only: the chapterFirst test now builds a real Chapter and gets its order from orderFrom, with no as never cast. That was the earlier ask, and it is met. The page, the API and the terminal still share takeOrder, so their numbers cannot disagree. The new code has no injection, authorization or escaping problem. The page output goes through row and badge, and chapterNames is scoped by repo id and read only for rows the viewer can already see. The design holds: listCard, row and badge with no new component, the page is server-rendered with no JavaScript, and the terminal door and docs/features/queue.md are both updated. Non-blocking: this is a feature landing ahead of the open pipeline list. The call is the owner's, and the pull is small and single-purpose. Non-blocking: a row with no chapter shows nothing rather than the words "no chapter", which is fine for the box.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs