Repository navigation
feat: staff mode (sign-in + allow-list; no lead, cap exempt; ships inert) [rebased #160] - #162
Merged
Merged
Conversation
… migration draft Not wired into routes yet. Unset AEO_STAFF_EMAILS means nobody is staff. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…adge, token sent on audit start - unlock: an allow-listed staff sign-in gets the unlock cookie without name/email; no lead row, no HubSpot sync - report: a signed-in browser asks once; the server decides; public visitors unchanged - header: Staff badge after the server confirms (GET /api/staff, yes/no only) - audit form sends the sign-in token, for the run gate's staff rule Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rked and left out of the count Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ore unlocking Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…count too Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Nov 10, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
TDD task AEO-T-013 / FR-014, staff mode. Nothing changes until
AEO_STAFF_EMAILSis set; it is unset on production.The check (
src/lib/staff.ts): a caller counts as staff only when all three hold:Authorization: Bearertoken verifies with Supabase (server-side, using the service client);AEO_STAFF_EMAILS.Anything else counts as public: no list, no token, a bad header, an unconfirmed email, or an auth error.
Unlock: a staff member gets the unlock cookie without the name/email form. No lead row is written and HubSpot gets no call (AC-020). The per-IP limiter and the audit-ready check still apply.
Start: staff skip
staff_onlyand the daily cap (AC-019). Pause, config and preview rules still apply. Staff rows getrequested_by = 'staff'. Once staff are configured, the daily count only includes rows whererequested_byis null.Browser:
GET /api/staffreturns only{staff: boolean}./api/stafffirst, then unlocks for staff only, so a signed-in non-staff browser uses none of the unlock limit.supabase/drafts/008_*: adds the nullablerequested_bycolumn. It is not applied.Order before anyone sets
AEO_STAFF_EMAILS(the owner's steps):AEO_STAFF_EMAILS.Rebased onto main after #151 and #154 (replaces #160). The staff token check now runs after the per-IP limiter, so a caller over their limit costs no auth call. The custom-prompts gate from #151 also leaves staff audits out of the count.
Pipeline: /tdd (staff.test, the unlock staff cases, the gate staff case and the start staff cases each failed first; the confirmed-email rule was also checked by removing it, and 1 test fails without it) → code-reviewer subagent with a security lens
Risk
AEO_STAFF_EMAILSis unset. The count query and the insert are the same as today.AEO_STAFF_EMAILS, or revert the PR.Code review: the code-reviewer subagent rated it "safe with notes". Its High finding was that an unconfirmed email could pass as staff once the list is set; that is fixed and has a test. Its Low finding was that the report's auto-check used up unlock attempts; that is fixed with the
/api/staffcheck first. Left as is:/api/staffhas no rate limit of its own. It answers only yes or no, and it does nothing until a list is set.Checks:
npx vitest runpassed 228/228 tests in 20 files, on the rebased branch.npx tsc --noEmitis clean.🤖 Generated with Claude Code