Skip to content

Commit bde2ca7

Browse files
raphaeltmclaude
andcommitted
docs: update staging auth instructions to use smoke test token
Replace references to demo-credentials.md for staging login with the smoke test token flow via SAM_PLAYWRIGHT_PRIMARY_USER env var and POST /api/auth/token-login. Production auth still uses GitHub OAuth. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0b7ebc8 commit bde2ca7

3 files changed

Lines changed: 19 additions & 8 deletions

File tree

.claude/rules/02-quality-gates.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ String containment tests on structured output create false confidence. The test
203203
**Full details in `.claude/rules/13-staging-verification.md`.** Summary of the hard requirements:
204204

205205
1. **Staging deployment MUST be green.** The `Deploy Staging` workflow is manual — you must trigger it via `gh workflow run deploy-staging.yml --ref <branch>`. Check for existing active runs first and wait at least 5 minutes if one is in progress. A failed staging deployment is the same severity as a failed test — it blocks merge.
206-
2. **Live app MUST be verified via Playwright.** After staging deploys, log into `app.sammy.party` (staging — NOT `app.simple-agent-manager.org`, which is production) using test credentials at `/workspaces/.tmp/secure/demo-credentials.md`, and actively test the application.
206+
2. **Live app MUST be verified via Playwright.** After staging deploys, authenticate to `app.sammy.party` (staging — NOT `app.simple-agent-manager.org`, which is production) using the smoke test token in `SAM_PLAYWRIGHT_PRIMARY_USER` env var via `POST https://api.sammy.party/api/auth/token-login` with body `{ "token": "<value>" }`, then navigate and actively test the application. See `.claude/rules/13-staging-verification.md` for the full login procedure.
207207
3. **Existing workflows MUST be confirmed working.** Navigate the dashboard, projects, settings. Verify no regressions — pages load, data displays, navigation works, no new console errors.
208208
4. **New feature/fix MUST be verified on staging.** The specific changes in the PR must work correctly on the live staging environment.
209209
5. **Evidence MUST be reported.** Include screenshots, API responses, or Playwright observations in the PR.
@@ -213,7 +213,7 @@ String containment tests on structured output create false confidence. The test
213213
- A "small refactor" still deploys and verifies — prove no behavior changed
214214
- A "fix for broken staging" is the STRONGEST reason to verify — confirm the fix works
215215
- "Tests pass" is not sufficient — tests passed for bugs that only manifested in the real environment
216-
- If you cannot authenticate, ask the human — do NOT skip verification
216+
- If you cannot authenticate (e.g., `SAM_PLAYWRIGHT_PRIMARY_USER` env var not set), ask the human — do NOT skip verification
217217

218218
## Post-Push CI Procedure (Required)
219219

@@ -227,6 +227,6 @@ After ANY merge to main, the production deployment triggers automatically. You M
227227

228228
1. Wait for the Deploy Production workflow to complete successfully in GitHub Actions.
229229
2. Use Playwright to navigate to `app.simple-agent-manager.org` (production) and test the deployed feature end-to-end.
230-
3. Use the test credentials stored at `/workspaces/.tmp/secure/demo-credentials.md` to authenticate. If the file is missing, ask the human for credentials.
230+
3. Authenticate using GitHub OAuth credentials at `/workspaces/.tmp/secure/demo-credentials.md` (production uses GitHub OAuth, not smoke test tokens). If the file is missing, ask the human for credentials.
231231
4. If the feature cannot be tested via Playwright, document why and what was verified manually.
232232
5. Report results to the user — do not assume deployment success just because CI passed.

.claude/rules/13-staging-verification.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,19 @@ If the deployment fails:
6262

6363
After staging deployment succeeds, use Playwright to test the live app:
6464

65-
1. Navigate to `https://app.sammy.party` (staging)
66-
2. Authenticate using test credentials at `/workspaces/.tmp/secure/demo-credentials.md`
67-
- If the file is missing, ask the human for credentials — do NOT skip this step
65+
1. Authenticate using the smoke test token via the token-login API:
66+
```typescript
67+
// In Playwright, use page.request to POST to the token-login endpoint.
68+
// This sets the session cookie on the browser context automatically.
69+
const loginResp = await page.request.post('https://api.sammy.party/api/auth/token-login', {
70+
data: { token: process.env.SAM_PLAYWRIGHT_PRIMARY_USER },
71+
headers: { 'Content-Type': 'application/json' },
72+
});
73+
// Verify login succeeded (status 200, response has success: true)
74+
```
75+
- The `SAM_PLAYWRIGHT_PRIMARY_USER` env var contains the smoke test token
76+
- If the env var is not set, ask the human — do NOT skip this step
77+
2. Navigate to `https://app.sammy.party` (staging) — the session cookie from step 1 authenticates you
6878
3. Verify your changes work as intended (see verification checklists below)
6979
4. Verify existing core workflows still work (see regression checklist below)
7080

@@ -128,7 +138,7 @@ If you find a bug unrelated to your PR, file it as a backlog task (`tasks/backlo
128138
- **App doesn't load** → fix the issue, do not merge
129139
- **Your feature doesn't work on staging** → fix the issue, do not merge
130140
- **Existing workflow is broken** → investigate whether your PR caused it; if yes, fix it; if pre-existing, file a backlog task but still do not merge with NEW regressions
131-
- **Cannot authenticate** → ask the human for credentials, do not skip verification
141+
- **Cannot authenticate**check that `SAM_PLAYWRIGHT_PRIMARY_USER` env var is set; if not, ask the human do not skip verification
132142

133143
## Feature-Specific Verification Is Mandatory (Not Just Page Loads)
134144

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ Claude Code supports dual authentication: **API keys** (pay-per-use from Anthrop
156156

157157
## Testing
158158

159-
- **Test credentials** for the live app are at `/workspaces/.tmp/secure/demo-credentials.md` (outside repo)
159+
- **Staging authentication**: Use the smoke test token in `SAM_PLAYWRIGHT_PRIMARY_USER` env var. POST it to `https://api.sammy.party/api/auth/token-login` with body `{ "token": "<value>" }` to get a session cookie, then navigate to `https://app.sammy.party`. See `.claude/rules/13-staging-verification.md` for full procedure.
160+
- **Production authentication**: Use GitHub OAuth credentials at `/workspaces/.tmp/secure/demo-credentials.md` (outside repo)
160161
- **Live test cleanup required**: delete test workspaces/nodes after verification
161162
- **Staging verification required for every code PR** — see `.claude/rules/13-staging-verification.md`
162163
- See `.claude/rules/02-quality-gates.md` for full testing requirements

0 commit comments

Comments
 (0)