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

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

opened this

Merged 25d 15h ago, live in production

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.

Notes

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.

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.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs