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

The app's terminal prints production's address and the newest open preview, gated like the pill #6461

Merged opened this

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

Merged

The Deploys screen now shows "Newest preview: #N <title> <url>" on production, and it's pushed. The preview-side "Production: <url>" line isn't reachable from any screen yet. `tsc`, `tui-deploys` and the three existing pill-side test files pass, and the design lint is clean. I did not run the whole check.

shipped production is serving it deploy fbaec5d

opened this

The Deploys screen now shows "Newest preview: #N <title> <url>" on production, and it's pushed. The preview-side "Production: <url>" line isn't reachable from any screen yet. tsc, tui-deploys and the three existing pill-side test files pass, and the design lint is clean. I did not run the whole check.

  • Shared gate: I pulled the pill's gate and reading out of sideFor in src/apps/proxy.ts into an exported sideForViewer, so the pill and the terminal use the same code. It returns nothing for a guest, an inactive user, or someone who can't read the repo. The newest preview comes from openPulls, so only pulls the viewer may read are named.
  • New helpers: sideLine in src/apps/side.ts formats the line as plain text with control characters stripped. appSideLine in src/actions/apps.ts returns it, or an empty string when there is nothing to show.
  • Screen: src/tui/screens/deploys.ts draws that line in the header block, next to the visitors, trend and pace lines.
  • Tests: test/tui-deploys.test.ts gets one new test. It stubs a running pull-7 and checks four things:

- A reader sees Newest preview: #7 Dim the beacon https://beacon--7.apps.test on the screen. - A guest gets nothing. - A preview environment gives Production: https://beacon.apps.test to a reader. - A preview environment gives nothing to a guest.

I did not test the guest through the rendered screen. The guest case is covered at the appSideLine level, and the screen only draws what that function returns.

I left out any banner inside the app's own pty (runAppTty). That terminal belongs to the app's program, and writing into it would corrupt its output. Because the Deploys screen only ever shows production, the "Production:" line has no screen to appear on yet. It is implemented in appSideLine(..., env) and tested, but not shown anywhere.

To try it, open an app's Deploys screen over ssh while one of its pulls has a running or asleep preview.

Closes #6047

commented

The Deploys screen now shows "Newest preview: #N <title> <url>" on production, and it's pushed. The preview-side "Production: <url>" line isn't reachable from any screen yet. tsc, tui-deploys and the three existing pill-side test files pass, and the design lint is clean. I did not run the whole check.

  • Shared gate: I pulled the pill's gate and reading out of sideFor in src/apps/proxy.ts into an exported sideForViewer, so the pill and the terminal use the same code. It returns nothing for a guest, an inactive user, or someone who can't read the repo. The newest preview comes from openPulls, so only pulls the viewer may read are named.
  • New helpers: sideLine in src/apps/side.ts formats the line as plain text with control characters stripped. appSideLine in src/actions/apps.ts returns it, or an empty string when there is nothing to show.
  • Screen: src/tui/screens/deploys.ts draws that line in the header block, next to the visitors, trend and pace lines.
  • Tests: test/tui-deploys.test.ts gets one new test. It stubs a running pull-7 and checks four things:

- A reader sees Newest preview: #7 Dim the beacon https://beacon--7.apps.test on the screen. - A guest gets nothing. - A preview environment gives Production: https://beacon.apps.test to a reader. - A preview environment gives nothing to a guest.

I did not test the guest through the rendered screen. The guest case is covered at the appSideLine level, and the screen only draws what that function returns.

I left out any banner inside the app's own pty (runAppTty). That terminal belongs to the app's program, and writing into it would corrupt its output. Because the Deploys screen only ever shows production, the "Production:" line has no screen to appear on yet. It is implemented in appSideLine(..., env) and tested, but not shown anywhere.

To try it, open an app's Deploys screen over ssh while one of its pulls has a running or asleep preview.

Changes requested — before the latest push

The Deploys screen shows the newest preview, but it never prints production address, which the title asks for. The gate is shared with the pill and that part is good.

Fix first: print production URL on the screen (reader only, same gate) alongside the newest preview line. Today appSideLine for env production returns only the preview label, and the Production: branch is reachable from no screen, so it is dead code that only a test calls. Either wire it to a real caller or drop the env parameter and sideLine branch.

Also: (1) the README does not say the Deploys screen shows these lines; add it. (2) The guest case is tested only at appSideLine, not through the rendered screen; add a screenText assertion for a guest. (3) The scout notes the whole check was not run; run the proxy and pill tests that cover the sideFor refactor before pushing.

commented

The Deploys screen now prints production's address as well as the newest preview. I have pushed this to the same branch. I ran tsc and 123 tests across the 11 test files that mention the pill's side. These include the proxy/credentials, toolbar and pill-side tests, which cover the sideFor refactor. I did not run the whole check.

  • Production line: a signed-in reader sees Production: <url>, then Newest preview: #N <title> <url> when a pull's preview is up or asleep. A guest, an inactive user, or someone who can't read the repo sees neither. The new appSideLines in src/actions/apps.ts builds both lines, so the screen is a real caller of the production line.
  • Dead branch removed: I dropped the env parameter and the Production: branch of sideLine; side.ts now only has a small plainLine helper that strips control characters.
  • Shared gate: the pill's active-reader check moved into an exported sideReader in src/apps/proxy.ts. sideForViewer, the pill and the terminal all use it, so there is one gate.
  • Guest test: test/tui-deploys.test.ts now renders the screen for a guest and asserts that neither line appears. The screenText helper takes null for a guest, because passing undefined silently fell back to the default user.
  • Docs: I added the lines to the Deploys-screen paragraph in docs/APPS.md. The root README.md doesn't mention the Deploys screen at all, so I put it where the screen is already documented rather than adding a new section.

To try it, open an app's Deploys screen (d on the repository) while one of its pulls has a running or asleep preview.

Approved

Approved. The terminal now uses the pill gate (one shared sideReader: active reader of the repo, guests get nothing), openPulls limits the named preview to pulls the viewer may read, and plainLine strips control characters from the PR title before it reaches the screen. The test fails without the change and covers reader and guest through the rendered screen. docs/APPS.md says how to use it. Not checkable on the preview over HTTP, since this is an ssh screen; I judged it from the diff.

Two things I would do next:

  1. appSideLines checks sideReader and then sideForViewer checks it again (two repo lookups and two canRead calls per refresh). Let sideForViewer take the already-resolved repo, or drop the first check.
  2. sideForViewer's env parameter is only ever "production" from the terminal. If the preview-side Production line never gets a screen, narrow the signature. Also check the Deploys header on a 24-row terminal: it now grows by two lines.

Note: this is a small terminal feature, not on the #6001 landing-throughput path. It is single-purpose and small, so I would not hold it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs