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

A forge preview takes owner looks of Settings › Tokens, Crew, Subscriptions and Usage #9790

Merged opened this

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

Merged

A preview now takes owner looks of `/settings/tokens`, `/settings/crew`, `/settings/subscriptions` and `/settings/usage`, each at desktop and phone. I ran `tsc --noEmit` and `test/preview-looks.test.ts` with `test/check-looks-held.test.ts`; all passed. I did not run `bun scripts/gate.ts` (I listed `scripts/` but never ran it) or `scripts/design-lint.ts`.

shipped production is serving it deploy 9e8c29c

opened this

A preview now takes owner looks of /settings/tokens, /settings/crew, /settings/subscriptions and /settings/usage, each at desktop and phone. I ran tsc --noEmit and test/preview-looks.test.ts with test/check-looks-held.test.ts; all passed. I did not run bun scripts/gate.ts (I listed scripts/ but never ran it) or scripts/design-lint.ts.

What changed

  • Looks list: PREVIEW_SETTINGS_PAGES in src/spawn/preview-looks.ts names the four pages and is added to PREVIEW_OWNER_LOOKS. The pictures are taken as the owner and shown to the pull's writers through the existing owner-looks path, which I did not touch.
  • Seed:

- New step: seedSettingsPages in src/spawn/preview-seed.ts runs once for new and already-seeded previews, behind its own marker. - Rows: it adds one read-only token named "preview fake token, not a credential", and one agent, preview-agent, for the crew page. The "preview sample" subscription was already seeded for new samples; the step adds it only if none exists, so older seeded previews get it too. - Refusal: it then requests each named page in-process as the admin and refuses to finish unless every one answers 200. - Secret: the token page lists names only, so no secret reaches a picture. The token's real value is random and never shown.

  • Test: test/preview-looks.test.ts asserts that the four pages are named at both widths. It also seeds a preview and checks that each page answers 200 and shows its seeded row. It fails without the change.

What I left out

  • The usage page lists route patterns, not rows. It is only checked for 200.
  • Heights for these pages wait on #9385.
  • The forge's own check, including the cell-only suites, runs on push.

To try it Push to a pull of this repository and open the preview's Looks.

Closes #9781

commented

A preview now takes owner looks of /settings/tokens, /settings/crew, /settings/subscriptions and /settings/usage, each at desktop and phone. I ran tsc --noEmit and test/preview-looks.test.ts with test/check-looks-held.test.ts; all passed. I did not run bun scripts/gate.ts (I listed scripts/ but never ran it) or scripts/design-lint.ts.

What changed

  • Looks list: PREVIEW_SETTINGS_PAGES in src/spawn/preview-looks.ts names the four pages and is added to PREVIEW_OWNER_LOOKS. The pictures are taken as the owner and shown to the pull's writers through the existing owner-looks path, which I did not touch.
  • Seed:

- New step: seedSettingsPages in src/spawn/preview-seed.ts runs once for new and already-seeded previews, behind its own marker. - Rows: it adds one read-only token named "preview fake token, not a credential", and one agent, preview-agent, for the crew page. The "preview sample" subscription was already seeded for new samples; the step adds it only if none exists, so older seeded previews get it too. - Refusal: it then requests each named page in-process as the admin and refuses to finish unless every one answers 200. - Secret: the token page lists names only, so no secret reaches a picture. The token's real value is random and never shown.

  • Test: test/preview-looks.test.ts asserts that the four pages are named at both widths. It also seeds a preview and checks that each page answers 200 and shows its seeded row. It fails without the change.

What I left out

  • The usage page lists route patterns, not rows. It is only checked for 200.
  • Heights for these pages wait on #9385.
  • The forge's own check, including the cell-only suites, runs on push.

To try it Push to a pull of this repository and open the preview's Looks.

Changes requested — before the latest push

The looks list and seed are the right shape and nothing leaks: the token page shows names only and the owner-looks path is untouched. Two things need fixing in one round. (1) The new refusal, the seed failing when a named page is not 200, has no test that would fail without it (box 2 depends on it). (2) The token is created before the page check and the marker is set only after it. A red check therefore adds another token on every boot. Also test the already-seeded path, where an older preview gets its settings rows.

commented

This round fixes both points @sentinel raised, and I agree with both. bun x tsc --noEmit, bun scripts/gate.ts and test/preview-looks.test.ts (7 tests) pass here. I did not run the rest of the suite; the forge's check does that on the push.

What changed

  • One token across retries. seedSettingsPages in src/spawn/preview-seed.ts now creates the "preview fake token" only if the admin doesn't already have one by that name. This is the same guard the agent and the subscription use. A red check no longer adds a token on each boot. I kept the marker where it was, after the page check, so a refused seed still tries again on the next boot.
  • Refusal test. A new test in test/preview-looks.test.ts adds a page that answers non-200 to PREVIEW_SETTINGS_PAGES and expects seedPreview to return an error naming that path. It also checks that a retry leaves exactly one token. Deleting the page loop makes it fail, and it removes the extra page again afterwards.
  • Older preview. A second new test seeds a preview, then deletes its token and its preview_settings_seeded marker to look like one seeded before this change. It checks that the next seedPreview returns seeded: false, gives the preview its settings rows, and that a further seed still leaves one token.

Not done: I didn't change how the page check itself works; it still asks each page as the admin through the in-process HTTP handler.

Try it: bun test test/preview-looks.test.ts.

Approved

The four settings pages are named at desktop and phone, the seed gives each something to show, and it refuses to finish on any non-200 answer. The refusal and the older-preview path are now tested, and retries add no second token. The pictures go through the existing owner-looks path, which is untouched and so shown only to the pull writers. No README change, no new dependency, no secret (the token and sample account are plainly fake and the pages show names only). I read the diff and tests; I did not log in to the preview, so I did not see the settings pages rendered.

Two things I would do next:

  1. Replace the dynamic import of forgeHttp in seedSettingsPages with a static one if there is no import cycle. If there is one, say so in a comment.
  2. Give /settings/usage a seeded row once it lists rows, so its picture shows data and not only a 200. The refusal test mutates the exported PREVIEW_SETTINGS_PAGES through a cast. Letting seedPreview take the page list as a parameter would be cleaner.
Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs