PPT-2536: shared legacy-credential fixtures + refresh-chain test coverage - #11
Merged
Conversation
Adds spec/spec_helpers/legacy_fixtures.cr: builders for the credential
shapes auth.cr did NOT mint — Ruby/Doorkeeper opaque rows (SHA256-hashed,
per `hash_token_secrets`), pre-scope-fix auth.cr refresh tokens, current
-format tokens, and ownerless client-grant tokens. Every refresh failure
in PPT-2536 was a credential predating the running code, so specs that
only exercise freshly-minted tokens structurally cannot see them.
refresh_hardening_spec.cr now builds its rows from the factory rather than
inline lambdas, so the cutover/session specs share one definition.
Three new cases from tasks/PPT-2536/test-matrix.md:
* RF-04 the literal ts-client request — no client_secret, no scope, via
the /auth/oauth/* alias SPAs actually call. Existing specs posted a
secret, which real public clients never send.
* RF-02 the heal survives a 5-hop chain, not just one refresh. The dev
revert happened because each hop re-embedded the empty scope.
* RF-05 a double-submitted refresh token (the ts-client boot race) must
not destroy the chain — strict reuse-detection would log out every SPA
on startup.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
First slice of the PPT-2536 test-suite campaign (
tasks/PPT-2536/test-matrix.md).Why
Every auth.cr refresh failure in PPT-2536 was a credential that predated the running code — tokens issued by the Ruby service, or by an earlier auth.cr build. Specs that only exercise freshly-minted tokens structurally cannot see those, which is how the 2026-07-25 dev revert happened with a green suite.
What
spec/spec_helpers/legacy_fixtures.cr— builders for the credential shapes auth.cr did not mint:hash_token_secrets), shaped to the dev forensics: 7,401 real rows, 100%scopes = 'public'clear_doorkeeper_rows—clear_tablesnever touched the Ruby-era table, so seeded rows were outliving spec runsrefresh_hardening_spec.crnow builds from the factory rather than inline lambdas, so the upcoming cutover/session specs share one definition.New cases
client_secret, noscope, via the/auth/oauth/*alias SPAs actually call. Existing specs posted a secret, which real public clients never sendRF-05 passing is a positive finding: auth.cr already tolerates the double-submit, so the SPA boot race is safe.
Verification
154 examples, 0 failures(151 + 3 new), no regressions from the refactor.🤖 Generated with Claude Code