Skip to content

Authenticated fixtures reach audit readiness (#914) - #918

Merged
jimhoyd merged 3 commits into
mainfrom
claude/authenticated-fixtures
Sep 29, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/authenticated-fixtures

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #914, found by the #841 agent trial: auth: true routes couldn't reach audit readiness.

Decisions

  • Sign in through the provider's real endpoint; no test principal.

    • A steps fixture signs in through the provider's real endpoint and uses the [Request]: let urlcode test fixtures carry a cookie session between steps #811 cookie jar. That already worked end to end, and both proofs were already audit-ready this way; the trial agent missed it because it was only documented under "Cookies".
    • The docs now give it a section: "Authenticated routes (auth: true)", with accounts from npx urlcode-auth create-user.
    • No test-principal mechanism was added, to avoid a new trust surface that grants identity.
  • Waivers. A coveredElsewhere waiver is honoured only when the route is shown to be served. Each honoured waiver reports its basis:

    • route-covered: another method of the same route is covered.
    • gate-refusal: the route is gated by a principal-providing extension, and a passing fixture asserts the gate's anonymous 401 with a body or headers.

    A bare status, or a 401 from an ungated function, doesn't count. The inventory reports gatedBy.

  • HEAD. A covered GET implies HEAD (impliedRouteMethods); the runtime strips HEAD bodies for every handler.

  • A 200 with no body assertion still doesn't count, because it can't tell the right handler from a catch-all. A new coverageNotes field explains why: unasserted-success, gated-route-uncovered, waiver-without-proof.

  • Origin.

    • Fixtures can use {{origin}}, the configured site origin. It works in single and steps fixtures and in the benchmark.
    • There is no automatic Origin header, so "no Origin → 403" stays expressible.
    • A status mismatch in urlcode test shows the start of the response body (redacted), so reason codes like cross_origin_refused are visible.

Evidence (macOS, Node 26)

  • New test/authenticated-fixtures.test.ts (5 tests).
  • Both proofs use {{origin}} and assert the cross_origin_refused body. They audit again under a second origin with no sign-in coverage notes.
  • npm test 1180, test:proof 12/12, test:proof:authjs 13/13.
  • npm run verify passes after merging main. test:package passed before the merge.
  • Core budget raised to 948 / 3722 KiB (measured 966,016 / 3,807,570 bytes).

Limits

  • The gate-refusal waiver trusts the author's stated reason for where the signed-in path is tested.
  • Implying HEAD from GET assumes the handler doesn't branch on HEAD.

🤖 Generated with Claude Code

jimhoyd and others added 2 commits September 29, 2026 08:37
- {{origin}}: a built-in fixture reference to the site origin (single and
  steps fixtures, benchmark, verify-deployment), so one fixture file works
  under any --origin; it cannot be captured.
- A status mismatch in `urlcode test` carries the start of the response body,
  so a refusal shows its reason code (cross_origin_refused,
  authentication_required).
- Coverage: HEAD is implied by a covered GET (impliedRouteMethods); a
  coveredElsewhere waiver on a route behind a principal gate is honoured once
  the gate's asserted anonymous 401 is observed (basis: gate-refusal); the
  inventory reports gatedBy; coverageNotes explain unasserted successes,
  uncovered gated routes and ignored waivers.
- Signed-in coverage stays a steps fixture through the provider's real
  sign-in endpoint and the cookie jar: no test principal is added.
- Proofs use {{origin}} and are audited ready under a second --origin.
- Docs: READINESS coverage rules and authenticated routes, AI-AUTHORING,
  TOOLING, auth README, proof READMEs, agents guide, llms.
- Core package budget raised with measured sizes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 29, 2026 13:44
@jimhoyd
jimhoyd merged commit 6cba87b into main Sep 29, 2026
25 checks passed
@jimhoyd
jimhoyd deleted the claude/authenticated-fixtures branch September 29, 2026 14:00
jimhoyd added a commit that referenced this pull request Sep 29, 2026
jimhoyd added a commit that referenced this pull request Sep 29, 2026
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.

auth: true routes can't reach audit readiness: fixtures can't sign in, waivers are ignored, and 403s give no reason

1 participant