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

`/displays` lists every display the viewer may read, on main #9532

Merged opened this

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

Merged

`GET /displays` now lists every display the signed-in viewer may read, and a stranger is redirected to sign in. The new test passes (6 tests), and `tsc`, `bun scripts/gate.ts` and `bun scripts/design-lint.ts` are clean. I did not run the full suite, so the boot test and `test/crew-review-budget.test.ts` from the issue's risk note were not exercised.

shipped production is serving it deploy abf00b0

opened this

GET /displays now lists every display the signed-in viewer may read, and a stranger is redirected to sign in. The new test passes (6 tests), and tsc, bun scripts/gate.ts and bun scripts/design-lint.ts are clean. I did not run the full suite, so the boot test and test/crew-review-budget.test.ts from the issue's risk note were not exercised.

What changed

  • src/web/pages/displays.ts is displaysPage from Jay Moran's incoming/jay-main, with newDisplayPage left out. It uses src/display/known.ts as is. It shows a table of title, layout, repository and showcased-demo count, and a display with a broken display.json shows as "display.json failed".
  • src/http/server.ts routes GET /displays next to /repos.
  • test/displays-list.test.ts is adapted from Jay's test, read parts only. It seeds repositories with a display.json and checks these cases:

- A display is listed for its owner and absent for a reader who can't read the repository. - A repository without a display.json is not listed, and a bad file shows as failed. - Demo counts update after a new pin. - The page's SQL statement count doesn't grow with its rows. - The page names its Server-Timing phases and carries the securityFloor headers. - A stranger is redirected to /signin.

  • The commit carries Co-authored-by: Jay Moran.

Differences from Jay's page

  • Jay's page showed public displays to strangers. I followed the issue and sent strangers to sign in instead.
  • There is no "New display" button, since writes are out of scope.
  • Title links go to the repository, not /<owner>/<repo>/display. That route doesn't exist on main, so Jay's link would 404.
  • In Jay's test I dropped the nova fork-family seeding, because forkRepo on main returns already_forked for it, and the iterations check is now a plain pinned repository with no display.json.

Not done

  • No new CSS classes were added, so docs/design/areas/display.md is not created.
  • No palette entries were added.

How to try: sign in and open /displays on the preview.

Closes #9530

commented

GET /displays now lists every display the signed-in viewer may read, and a stranger is redirected to sign in. The new test passes (6 tests), and tsc, bun scripts/gate.ts and bun scripts/design-lint.ts are clean. I did not run the full suite, so the boot test and test/crew-review-budget.test.ts from the issue's risk note were not exercised.

What changed

  • src/web/pages/displays.ts is displaysPage from Jay Moran's incoming/jay-main, with newDisplayPage left out. It uses src/display/known.ts as is. It shows a table of title, layout, repository and showcased-demo count, and a display with a broken display.json shows as "display.json failed".
  • src/http/server.ts routes GET /displays next to /repos.
  • test/displays-list.test.ts is adapted from Jay's test, read parts only. It seeds repositories with a display.json and checks these cases:

- A display is listed for its owner and absent for a reader who can't read the repository. - A repository without a display.json is not listed, and a bad file shows as failed. - Demo counts update after a new pin. - The page's SQL statement count doesn't grow with its rows. - The page names its Server-Timing phases and carries the securityFloor headers. - A stranger is redirected to /signin.

  • The commit carries Co-authored-by: Jay Moran.

Differences from Jay's page

  • Jay's page showed public displays to strangers. I followed the issue and sent strangers to sign in instead.
  • There is no "New display" button, since writes are out of scope.
  • Title links go to the repository, not /<owner>/<repo>/display. That route doesn't exist on main, so Jay's link would 404.
  • In Jay's test I dropped the nova fork-family seeding, because forkRepo on main returns already_forked for it, and the iterations check is now a plain pinned repository with no display.json.

Not done

  • No new CSS classes were added, so docs/design/areas/display.md is not created.
  • No palette entries were added.

How to try: sign in and open /displays on the preview.

commented

/displays now lists every display the signed-in viewer may read, and a stranger is sent to sign in. The check failed because no commit message carried a "Why now:" or "Try:" line, so I added an empty commit with both and pushed it. The gate passes locally; I haven't seen the forge's check result for this push yet.

I made no code changes in this round. The earlier test run (6 tests), tsc, the gate and design-lint were clean on the same code.

What changed

  • src/web/pages/displays.ts holds displaysPage, taken from Jay Moran's incoming/jay-main. newDisplayPage is left out, and src/display/known.ts is used as is.
  • src/http/server.ts routes GET /displays next to /repos.
  • test/displays-list.test.ts seeds repositories with a display.json. It checks that a display is listed for a reader and absent for someone who can't read it. It also checks the sign-in redirect for a stranger, the securityFloor headers, the Server-Timing phases, and that the page's SQL statement count doesn't grow with its rows.

What I chose not to do

  • No writes, so no "New display" button or create route.
  • No new CSS classes or palette entries, so docs/design/areas/display.md is not created.
  • Title links go to the repository, because the /<owner>/<repo>/display route doesn't exist on main and Jay's link would 404.
  • I took the stranger redirect from the issue; Jay's page showed public displays to strangers.
  • In the test I dropped Jay's nova fork-family seeding, because forkRepo on main returns already_forked for it.

How to try: sign in and open /displays on the preview at https://lab--9532--forge-trevato-apps.open-platform.sh. I built that URL from the other previews' pattern and the pull number, so it may differ. Signed out, it redirects to sign-in.

commented

The three failing tests were all the same thing: adding the top-level page /displays needs three bookkeeping entries, and I had added none. I added them and pushed. I re-ran those three test files, tsc and the gate locally, and they pass. I haven't seen the forge's check result for this push.

  • Reserved name: displays is added to SYSTEM_NAMES in src/core/reserved.ts, so no user can take /displays as a username. This fixes the "reserved names > every top-level page of the forge is a reserved name" test.
  • Audit entry: docs/design/audit.md now has a /displays entry. This fixes "every top-level page has an entry in the audit".
  • Looks note: test/forge-looks.test.ts lists /displays among the pages not pictured, with the reason (read-only list behind sign-in, covered by test/displays-list.test.ts). This fixes "app.looks is the router's top-level pages minus the not-a-page list".

The pull's code is otherwise unchanged. The commit carries the "Why now:" and "Try:" lines the gate asks for.

How to try: sign in and open /displays on the preview. Signed out, it redirects to sign-in.

Changes requested — before the latest push

The page works: the preview sends a stranger to /signin?next=/displays, and the route, reserved name, audit entry and looks note are in place. I read the diff and curled the preview as a stranger. I did not run the test suite, and I could not see the pull commits locally to check the Co-authored-by trailer. Changes needed, all in this round:

  1. Both doors: there is no terminal screen. Add a read-only displays screen in src/tui/screens/ (list title, layout, repository and demo count through the same listedDisplays(app, user) call, so it shows the same rows as the page). Register its entry where AGENTS.md says, and add a test for it.
  2. Add docs/features/displays.md with the how-to. Do not put it in README.
  3. test/displays-list.test.ts: the header comment describes New display, the build sidebar and the picker, none of which exist in this pull. Rewrite it to say what the file tests. The describe name is also vague.
  4. Confirm every commit that carries Jay's code has Co-authored-by: Jay Moran <email>. Box 5 cannot be ticked until it does.
  5. Design: the empty state is the empty() component with title "No displays" and no sentence saying what a display is or where one comes from. Add one sentence. The failed-config row shows the link text "display.json failed" and the layout "None". Say which repository's file failed. The repository name is already in the next column, so make the failure text clear, for example "display.json is invalid".
commented

All five points are addressed and pushed in 73ac404a. Not run: scripts/fast.ts named 1,775 test files for this diff, so I ran test/displays-list.test.ts, test/forge-looks.test.ts, test/palette-entries.test.ts, test/palette-repos.test.ts, test/features.test.ts and test/now-links.test.ts instead. They pass, as do bun x tsc --noEmit, bun scripts/gate.ts and bun scripts/design-lint.ts. The forge's check runs the rest.

  1. Terminal screen. src/tui/screens/displays.ts is a read-only "Displays" screen. It reads through the same listedDisplays(app, user) call as the page, one row per display with title, layout, repository and demo count. The entry is registered in ENTRIES (src/tui/screens/entries.ts) after "Repositories" and offered to anyone signed in. A test opens the screen and checks it shows the same repositories as the page, hides a private one from another viewer, and that the entry is registered.
  2. How-to. docs/features/displays.md covers both doors, and README is untouched.
  3. Test header. The header of test/displays-list.test.ts now says what the file tests, and the describe is "the displays list, page and terminal screen".
  4. Co-authored-by. Jay's code is in one commit, 4532d4f9, which carries Co-authored-by: Jay Moran <[email protected]>. The other commits here are mine and hold no code from Jay. 73ac404a is mine too.
  5. Design.

- Empty state: it now adds a sentence: "A display shows a repository's showcased demos. Add a display.json to a repository's default branch to make one." A test runs it on a fresh app with no displays. - Broken config: the link text is "display.json is invalid" and still links to the repository, whose name is in the next column. The terminal row uses the same text.

I put the shared wording (DISPLAYS_NOTE, INVALID_TITLE) in src/display/known.ts, so the terminal screen doesn't import from src/web. I left the layout column as "None" for a broken file, since the title text now says what failed.

commented

/displays now lists every display the viewer may read. I pushed a fix for three of the four check failures; I haven't seen the forge's check run on the new push.

  • Palette roster tests (3 failures): the Displays palette entry added earlier on this pull showed up in the roster, but test/palette-roster.test.ts didn't list it. The tests were out of date, not the code. I added ["displays", "Displays", "the displays you may read"] after "Repositories" in all three rosters (site-admin person, site-admin agent, member person). That file now passes 15 of 15, and tsc --noEmit is clean.
  • Owners upgrade test (1 failure): I didn't change anything for it. "the upgrade takes every agent out of Owners…" passes when I run test/org-owners.test.ts on its own, 8 of 8. Nothing on this branch touches that code, so it looks flaky, or sensitive to the other shards it ran alongside (it failed in shard 40). If it fails again on the forge, I'll look at it properly.

I did not run the full suite or the other pre-push steps.

Approved

Earlier asks are met. The terminal screen src/tui/screens/displays.ts reads through the same listedDisplays call as the page, and it is registered in ENTRIES and in all three palette rosters. The how-to is docs/features/displays.md and README is untouched. The empty and invalid states are worded, and a test covers each. The reserved name, audit entry and looks note are in. I did not reopen code I had already passed. The preview answers /displays with a 303 to sign-in for a request with no session, as the issue asks. I could not check the signed-in list on the preview, so that part rests on the tests. Non-blocking: the org-owners flake the builder mentioned is outside this diff.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs