Skip to content

fix(kitchen-sink): re-key the hired-seat visitor test to the kitchen-sink org (FIX-1563) - #2191

Merged
jhoffner merged 3 commits into
mainfrom
fix/FIX-1563-rekey-visitor-test
Sep 24, 2026
Merged

jhoffner merged 3 commits into
mainfrom
fix/FIX-1563-rekey-visitor-test

Conversation

@jhoffner

@jhoffner jhoffner commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

main's kitchen-sink tests fail because #2169 merged before its re-key. #2169 added test/hired-seat-visitor-auth.test.ts with an acme:tok-acme admin token. #2159 had already merged, and it makes the app accept only tokens bound to kitchen-sink. So the test's token is refused at boot, and on main the suite ends 2 failed | 154 passed (156).

What this does

It rewrites that one test so it runs on the wiring production has, as Codex asked on #2169. The test now boots the app's real fsdev.config.ts, the same way named-org.test.ts does. That brings in the real resolveKitchenSinkPrincipal host resolver, the real registrar and the real admin flow. The admin token is kitchen-sink:<tok>. The in-app hire goes through mara's own hire tool, with a scripted model, instead of a hand-built registration. It checks the same four things:

  • a visitor opens and runs a seat mara hired, with no token;
  • an admin-hired seat still returns 401 with no token;
  • an admin-hired seat still answers the org's admin token.

No production code changes. The fix from #2169 is already on main and untouched.

What's asked of you

Nothing to decide. This makes main green again.

Parts worth reviewing closely

  • apps/kitchen-sink/test/named-org.test.ts: one added line, vi.setConfig({ testTimeout: 30_000 }), and the same line in the new test. Each file cold-imports the whole app, which takes about 4.8 s. named-org V18 took 4798 ms on its own against vitest's 5 s default. With two such files in parallel workers, V18 timed out 2 out of 2 runs. With the timeout in both files, the full suite passed 2 out of 2.

Linear: FIX-1563 · Follows #2169 and #2159 (both merged) · Merges to main · No changeset (kitchen-sink is private)

How to review this — bug fix on the direct route; this PR is the only gate

How to review this. This is a bug fix on the direct route: there is no spec and no
spec PR, because the hard part was the diagnosis and it happened in code. This PR is the
only gate
, so unlike a spec-backed change, the approach is in scope — nothing here was
signed off upstream.

Most valuable here: the diagnosis chain — does the repro actually reproduce the reported
failure, is the named cause the real one, does the fix address that cause rather than the
symptom, and does the regression test fail without the fix? Then the second path (the legacy
shape, the null boundary, the concurrent case, the cancel path).

In scope to challenge: where the guard was placed, any behaviour change a user could
notice, and whether this should have been a spec'd feature instead of a fix.

Verification — main red, then green; both red states reproduced on the re-keyed test

All runs had FSDEV_DEFAULT_MODEL and FSDEV_INTENT_* unset.

main at 95f8992, unmodified (pnpm --filter @flow-state-dev/kitchen-sink test):

[workforce-admin] refusing a WORKFORCE_ADMIN_TOKENS entry that names organization "acme" — this app runs as "kitchen-sink" only, ...
FAIL test/hired-seat-visitor-auth.test.ts > a seat hired over workforce-admin, beside the visitor's resolver > still refuses a caller with no credential, ...
  AssertionError: expected 404 to be 401
FAIL test/hired-seat-visitor-auth.test.ts > ... > still answers the organization's admin credential
Test Files  1 failed | 21 passed (22)
     Tests  2 failed | 154 passed (156)

Why it fails: with its only token refused, the admin flow has no resolver. So the "admin" hire runs as the test's visitor, and nothing lands at the admin-user address.

Re-keyed test, lib fix reverted (lib files from 5c57608): the visitor cases go red.

× ... opens a session for a visitor who sends no credential      expected 401 to be 201
× ... runs an action for a visitor who sends no credential       "error": "workforce-admin requires an admin credential: ..."
✓ ... still refuses a caller with no credential
✓ ... still answers the organization's admin credential
Tests  2 failed | 2 passed (4)

Re-keyed test, admin-resolver attach removed: the admin cases go red.

✓ ... opens a session for a visitor who sends no credential
✓ ... runs an action for a visitor who sends no credential
× ... still refuses a caller with no credential                  expected 404 to be 401
× ... still answers the organization's admin credential          expected 404 to be 201
Tests  2 failed | 2 passed (4)

Both restored: the file gives 4 passed (4). The full kitchen-sink suite gives 22 files / 156 tests passing, on two runs. Root pnpm typecheck and pnpm lint both exit 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB


Generated by Claude Code


Note

Low Risk
Test-only changes; no production code paths are modified.

Overview
Re-keys the hired-seat visitor auth regression test so it boots kitchen-sink’s real fsdev.config.ts (like named-org.test.ts) instead of a minimal in-memory stack with an acme admin token that #2159 now rejects at boot.

The test still covers the same four behaviors (visitor access to mara’s in-app hire vs admin-hired seats), but in-app hire is exercised through mara’s scripted hire tool and HTTP via the app router, with WORKFORCE_ADMIN_TOKENS set to kitchen-sink:<token>. named-org.test.ts gets a 30s Vitest timeout so cold full-app imports in parallel workers don’t hit the 5s default.

Reviewed by Cursor Bugbot for commit 4beaeb7. Configure here.

…-sink org (FIX-1563)

The test landed with `acme:tok-acme` as its admin credential. The app now
refuses any token that does not name `kitchen-sink`, so the admin flow
ran without its resolver and both admin-seat cases failed on main.

The test now boots the app's real `fsdev.config.ts`, as named-org.test.ts
does: the real host resolver, registrar and admin flow, with the token
bound to `kitchen-sink`. The in-app hire goes through mara's own `hire`
tool rather than a hand-built registration.

Both config-booting files get a 30s test timeout. A cold import of the
app takes about 4.8s alone, and two of them in parallel workers outran
vitest's 5s default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
flow-state-dev-docs Ignored Ignored Sep 24, 2026 8:51pm UTC
flow-state-dev-kitchen-sink Ignored Ignored Sep 24, 2026 8:51pm UTC
flow-state-dev-ui Ignored Ignored Preview Sep 24, 2026 8:51pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-24T20:46:37.769660Z 4beaeb7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5c9c2898-d920-44b9-b92e-fe02bf72acc6)

@linear-code

linear-code Bot commented Sep 24, 2026

Copy link
Copy Markdown

FIX-1563

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second-look / improve-codebase-architecture pass on this PR (automated).

The fix itself looks sound: it re-keys the test to boot the app's real fsdev.config.ts the same way named-org.test.ts already does, which is the right level of fidelity for a production-wiring bug (a hand-built minimal boot is exactly what let the original regression through). The red/green evidence in the description is convincing and I found no correctness issue with the approach.

Left one finding below: this PR is the moment the real-app-boot mock/cleanup scaffolding (and a settle-poll act helper already duplicated once in hired-seat-auth.test.ts) became duplicated a second time across test files, which is a concrete, in-scope extraction opportunity rather than a drive-by refactor — non-blocking, for a follow-up agent to weigh.


Generated by Claude Code

…chen-sink tokens (FIX-1563)

#2184 (FIX-1552) merged catalog cases written against the pre-#2159 acme/bravo
constants, which #2159 removed, so main fails kitchen-sink typecheck. The
operator's leg now lists with the kitchen-sink admin token; the other-org leg
uses the token whose entry was refused at boot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ANuyMVi3YS653fcghb9gtB

Copy link
Copy Markdown
Collaborator Author

Typecheck & Test was red on 4beaeb7, and the cause is on main, not in this PR's change. #2184 (FIX-1552) merged new catalog cases into apps/kitchen-sink/test/hired-seat-auth.test.ts that still refer to the ACME/BRAVO constants. #2159 had removed those constants, so main itself fails kitchen-sink typecheck with TS2304: Cannot find name 'ACME' and TS2552: Cannot find name 'BRAVO'.

This PR's job is to turn main green, so the fix is in it:

  • cb80cdf (after merging main) re-keys both catalog legs. The operator's leg lists with the kitchen-sink admin token. The other-organization leg uses the token whose entry was refused at boot.
  • Checked locally: kitchen-sink tsc --noEmit is clean, and the full kitchen-sink suite passes 22 files / 158 tests.

Generated by Claude Code

jhoffner pushed a commit that referenced this pull request Sep 24, 2026
main is red in kitchen-sink's hired-seat tests; #2191 fixes them. Ported
here so this PR's CI can go green. It no-ops once #2191 merges.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01V5TdMqMDvZFfm8UyokY5dh
jhoffner pushed a commit that referenced this pull request Sep 24, 2026
…n base

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D
jhoffner pushed a commit that referenced this pull request Sep 24, 2026
…'s CI runs green

main is red on kitchen-sink typecheck and test after FIX-1563's tests met the
named-org change. #2191 is the fix; this carries the same three files and
no-ops once it lands.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HjqxvkwpzxMZtZgtK7EsRt
jhoffner pushed a commit that referenced this pull request Sep 24, 2026
…n base

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018e4MkWPYX62KRow9TSn75D

@jhoffner jhoffner left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Architect coherence: merge-ready.

Right fix for FIX-1563: exercise visitor vs admin hire on the real kitchen-sink org/resolver/registrar, not an acme token #2159 refuses. ACME/BRAVO cleanup restores typecheck. Prefer this first among the open set so other PRs aren’t judged against main’s known red.

Not owner approval / not the merge gate.

— FSD Architect

@jhoffner
jhoffner merged commit 75cc5f4 into main Sep 24, 2026
12 checks passed
jhoffner pushed a commit that referenced this pull request Sep 24, 2026
Ported verbatim from #2191 (cb80cdf): hired-seat-auth.test.ts and
hired-seat-visitor-auth.test.ts referenced ACME/BRAVO, which main's
FIX-1552/FIX-1563 merge left undefined, so kitchen-sink typecheck is red on
main too. No-op once #2191 merges.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZYLbMRNDkNp68tSBgftDN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants