Repository navigation
Description
Depends on: #2654 (its PRs #2840 and #2856 move the per-call ID-JAG tests to the real AS-1 and add the real-AS-1 test fixture this work builds on).
Problem
The offline identity harness still runs a fake AS-1 next to the real one. Most identity tests now use the real AS-1 (ToolHive's embedded authorization server, hosted by the as1server adapter), but some still sign in at the fake, mint tokens with it, or rely on its revocation and RFC 7009 endpoints. Two AS-1s means two behaviours to keep in step, and tests that pass against the fake can still fail against the real one.
#2677 settled that tests use the real in-process AS-1 wherever it can serve, with faults injected in front of it, and keep the fake only for what ToolHive can't do yet. ToolHive v0.66.0 now does everything these tests need, except an RFC 7009 revocation endpoint.
Design
- implementation.md: ToolHive work list: a broker refresh token is revoked by an RFC 7009 endpoint or, while the broker runs inside mecak8s, in process; the endpoint is RFC 7009 token revocation endpoint toolhive#6966.
- implementation.md: Modulith constraints: the broker's in-process calls to AS-1 go through the same handler and checks as its network routes.
Requirements
- Every identity test that needs an AS-1 uses the real AS-1. This covers:
- mecak8s with the identity broker: session ownership, a second client, conversion, bad tokens, and hard expiry;
- the TUI and
clientauthsign-in, and refresh-token rotation; - the broker's session-open checks;
- AS-2's redemption tests in
mcpbroker; - the gateway-call tests;
- the authorize tests that need AS-1's own
revokedandparent_revokedanswers.
- Tests that need malformed or foreign-signed access tokens (wrong claims, wrong
typ, unknown key) build them with a test helper beside the real-AS-1 fixture, not with the fake. - AS-1's
revokedanswers in tests come from revoking the grant inside the real AS-1, through an in-process revoke on theas1serveradapter. authserverclient's RFC 7009 revocation is tested against a stub endpoint, since the real AS-1 has none until RFC 7009 token revocation endpoint toolhive#6966.- Once nothing uses it, the fake AS-1 is deleted: its sign-in, session open, ID-JAG issuance, revocation, and client authentication. The test-only actor-validator bridge goes with it, and the harness no longer starts an AS-1.
- The harness keeps what the real AS-1 needs offline: the upstream IdP, the browser consent helper, the fault transport, the CA and key helpers, and the gateway stand-in (until Connect provider accounts at the embedded gateway #2537 and External gateway: Gateway implementation, operator setup, and end-to-end test #2812).
- Coverage doesn't drop: each moved test keeps its assertions, or the PR says which existing real-AS-1 test already covers it.
- A test that duplicates an existing real-AS-1 test is deleted, not moved.
- Remove the
// Shortcut: … removed by #2568markers on the harness revocation fixture. Sign-out and revocation #2568 itself keeps its scope: production revocation reasons.
Suggested split: one PR for the token helper and the tests that can move now; one PR for the in-process revoke, the revocation tests, and deleting the fake AS-1.
How it fits
Test infrastructure for Phase 1, Slice 4. It removes the last offline stand-in for AS-1, so the slice's tests exercise only the real authorization servers, the real broker, and a fake upstream IdP.
Done when
- No test outside the harness's own package uses the harness's AS-1, and the harness no longer has one.
- AS-1 answering
revoked(andparent_revoked) is shown against the real AS-1, and the broker still closes the session or retries with a newer grant. - RFC 7009 client authentication is still tested, against a stub.
task test:raceandtask lintpass with no lost assertions.
Activity
test(identityharness): retire the fake AS-1; identity tests use the r…