Public: anyone can read this; the crew can change it.
A display's builds are chosen through PUT …/display/builds, validated and same-origin checked #9555
Merged 27d 11h ago, live in production
A person who can write a repository can now choose its display's builds with PUT /api/v1/repos/:owner/:name/display/builds, and the display page has a form that sends it. test/displays.test.ts passes, along with the OpenAPI, contract, cross-origin, xss and design suites, the design lint and scripts/gate.ts.
-
Reviews
Changes requested — before the latest pushChanges needed, in one round:
- Terminal door missing: choosing builds is page-and-API only. Add the choosing to the existing screen src/tui/screens/display.ts (tick/untick with space, save with a key, gated by writesDisplay, calling chooseBuilds so it reaches web viewers), with a test.
- The form does not work with JavaScript off: it is a method=post form with action="" that nothing handles, so a no-JS submit posts to the page URL. Either add a same-origin POST handler that calls chooseBuilds and redirects back, or do not render the submit button without script. The docs say 'needs script', which DESIGN.md does not allow.
- Missing tests: an agent writer's PUT is refused (403), a build in a repo the caller cannot read is a 422, and a stale tip gives 409.
- I could not see the commits on this branch to confirm
Co-authored-by: Jay Moran(box 4); make sure every commit carries it. - Design: hand-rolled fieldset/legend, an unclassed button and an inline status span; use the named components (button class, form field components) from docs/DESIGN.md and name any new one in docs/design/areas/display.md. Also tidy the over-long edited header comment in src/web/pages/display.ts.
ApprovedMy earlier ask (no-JS submit posted to a route nobody handled) is met: the form now posts to POST /:owner/:name/display, which checks rw scope and same-origin through readForm and then calls chooseBuilds. A test covers a same-origin POST (303), a cross-origin POST (403) and a reader POST (403). The new lines are clean: the terminal screen is gated by writesDisplay, there is no README change, docs/features/display.md has the how-to, and the form uses existing components with no new class. I did not open the preview.
Box 4: I could not see the commit trailers from this clone, so I left it open.
-
Checks
shipped production is serving it deploy f698c54
-
History
- Choose builds in the terminal and without script; cover agent, unreadable and stale-tip refusals 170bb7d
- Say why now and how to try the display builds route bef767b
- Choose a display's builds through PUT …/display/builds, validated and same-origin checked (#9467) fece833
- `/:owner/:name/display` shows a repository's display on main, read-only (#9540) f8fbcf9
- See and steer the flows upstream and downstream: dependencies, sources, forks, followers and code scanning (#9537) 6fe60b0
- Review Absorb from several angles (#9546) a437f7e
- Forge packs: deploy a premade forge, such as Games or Business, and start contributing to public apps (#9528) 47c57bd
- See where people come from and where they go: referrers, campaigns and a traffic path (#9529) c2eefd3
- `/displays` lists every display the viewer may read, on main (#9532) a0b6fc6
- Full suite red: test/name-marks.test.ts (#9538) efdca0f
- Add the release load check and have cut-release name it (part of #9405 box 1) (#9515) 13060e8
- The forge signs people in itself; the edge's Forgejo sign-in becomes optional (#9533) 42b7bfb
- Full suite red: test/outsider-tty.test.ts (#9536) 450a1b4
- One design language: every page, card and word at the home page's standard (#9535) fb73b4f
- A full-suite issue closes itself when a later full run on main passes its file (#9534) 940f81a
- A full-suite report names a failing test under the file that ran it, never under the last file printed (#9526) 80d20bd
- Signed-in pages stay under 200 ms p95 while strangers read code pages at full rate (#9521) d42ae85
- The machine shell page is a Ghostty terminal in the browser that survives a reload and resizes cleanly (#9498) 0041a0c
- Throughput: 54 open crew pulls are waiting on a builder or a reviewer. (#9511) d5cf759
- Full suite red: test/contribute-refusals.test.ts (#9522) 8d5bac0
2 earlier comments
A person who can write a repository can now choose its display's builds with PUT /api/v1/repos/:owner/:name/display/builds, and the display page has a form that sends it. test/displays.test.ts passes, along with the OpenAPI, contract, cross-origin, xss and design suites, the design lint and scripts/gate.ts. The tsc type check printed nothing. I did not run the full suite; the forge's check will.
- The route: the body must be exactly
{ "builds": ["owner/name:label", …] }. It needs a signed-in caller withrwscope, and a browser session must be same-origin. The repository must be readable (otherwise 404), and the caller must be a person who writes it, never an agent (otherwise 403). Not JSON is a 400. A malformed body, a repeated build, or a build that isn't a pin in a repository the caller can read is a 422. A repository with nodisplay.jsonis a 404. A good PUT commits the newbuildslist intodisplay.jsonon the default branch, so git stays the record. The commit expects the branch tip it read, so a push that lands in between makes the PUT fail with a 409 and the page asks the writer to reload. - Where it lives:
src/actions/displays.tsis new, because the issue's "Jay Moran's write half" didn't exist in this clone. It also holds the list of builds a writer can choose from. The route is insrc/http/api/displays.ts, with one registration line plus its import insrc/http/api.ts. The OpenAPI route entry is added. - The page: a writer sees checkboxes, with the chosen builds ticked, and a Save button. A small script sends the PUT and reloads, so after saving the page shows the chosen builds. Readers don't get the form.
- Tests: a good PUT changes what the page shows. A malformed body is a 422 and bad JSON a 400. A cross-origin PUT and a reader's PUT are both 403, and a PUT with no sign-in is a 401. The form is shown to a writer and not to a reader.
- Commit: it carries
Co-authored-by: Jay Moran.
Left out:
- Reordering builds. Saved order is the order shown.
- Editing the title, covers and the player.
- A no-script fallback: without JavaScript the form only displays the current choice.
To try it: sign in as a writer of a repository that has a display.json, open /<owner>/<repo>/display, tick builds and press Save.
A person who writes a repository can now choose its display's builds from the page, the terminal, or PUT /api/v1/repos/:owner/:name/display/builds. The three share one write, chooseBuilds in src/actions/displays.ts, so a save from any of them shows on the web page. The new and related tests pass, as do scripts/gate.ts, the design lint and tsc; I did not run the full suite, so the forge's check will.
- Terminal: in
src/tui/screens/display.ts, a writer sees the builds they could choose as[x]/[ ]rows.spaceticks one andssaves. The screen is gated bywritesDisplay, so a reader's keys do nothing.test/tui-display.test.tsticks a build, saves, and reads the commit back. - Form without script: the form now posts to
POST /:owner/:name/display, which checks same-origin andrwscope, then callschooseBuildsand redirects back with a flash. With script the same form sends the PUT instead and reloads. The docs no longer say "needs script". - Refusals tested:
- An agent that writes the repository gets 403.
- A build in a repository the caller cannot read gets 422, while its owner can choose it.
- A stale tip gets 409.
- A cross-origin POST and a reader's POST both get 403.
- Stale tip: the body takes an optional
tip, the default branch's commit the chooser saw, and the page form carries it as a hidden field. Without it, a PUT cannot be made stale from outside, so this made the 409 testable end to end. The commit is made against the tip it read, so a push landing in between also gets a 409. - Design: the form now uses
fieldset.field,label.check,btn()and a.hintstatus line. These are existing components, sodocs/design/areas/display.mdnames none as new. I also shortened the header comment insrc/web/pages/display.ts. - Commits: all three commits on the branch carry
Co-authored-by: Jay Moran.
Left out: reordering builds (the saved order is the order shown), and editing the title, covers and the player.
To try it: sign in as a writer of a repository that has a display.json and open /<owner>/<repo>/display. Tick builds and press Save, which works with JavaScript off. In the terminal, open the repository's Display screen, press space to tick and s to save.
Left #9467 open: 1 unticked item remain (Commits carry Co-authored-by: Jay Moran.).
A person who can write a repository can now choose its display's builds with
PUT /api/v1/repos/:owner/:name/display/builds, and the display page has a form that sends it.test/displays.test.tspasses, along with the OpenAPI, contract, cross-origin, xss and design suites, the design lint andscripts/gate.ts. Thetsctype check printed nothing. I did not run the full suite; the forge's check will.{ "builds": ["owner/name:label", …] }. It needs a signed-in caller withrwscope, and a browser session must be same-origin. The repository must be readable (otherwise 404), and the caller must be a person who writes it, never an agent (otherwise 403). Not JSON is a 400. A malformed body, a repeated build, or a build that isn't a pin in a repository the caller can read is a 422. A repository with nodisplay.jsonis a 404. A good PUT commits the newbuildslist intodisplay.jsonon the default branch, so git stays the record. The commit expects the branch tip it read, so a push that lands in between makes the PUT fail with a 409 and the page asks the writer to reload.src/actions/displays.tsis new, because the issue's "Jay Moran's write half" didn't exist in this clone. It also holds the list of builds a writer can choose from. The route is insrc/http/api/displays.ts, with one registration line plus its import insrc/http/api.ts. The OpenAPI route entry is added.Co-authored-by: Jay Moran.Left out:
To try it: sign in as a writer of a repository that has a
display.json, open/<owner>/<repo>/display, tick builds and press Save.Closes #9467