add RFC 8417 golden conformance fixtures and round-trip tests#10
Merged
Conversation
RFC 8417 ships prose example figures rather than machine-readable test vectors and defines no external conformance suite, so the library's conformance story is internal golden fixtures driven through the full consumer/producer cycle. This lands that suite: four claims-set fixtures under testdata/ and a table-driven test that exercises each one. The canonical fixture, scim_create.json, is transcribed verbatim from the RFC 8417 §2.1 SCIM provisioning example: iss, iat, jti, a two-member aud array, and a single SCIM create event. The remaining three are labelled synthetic in testdata/README.md and use RFC 2606 example domains: minimal.json is the smallest SET satisfying the §2.2 MUSTs (one event with the empty-object payload); txn_toe_subid.json exercises txn, a toe distinct from iat, an RFC 9493 iss_sub sub_id, and an aud array; single_aud.json carries a bare-string aud and an event a registered decoder turns into a typed value. No non-spec event vocabulary is presented as if it came from the RFC. For each fixture the test parses the bytes, asserts the decoded SET fields, confirms Validate accepts it, decodes events through the registry (one registered URI to a typed value, the rest left raw), and Encodes it back. It then pins byte-stability two ways: every event payload appears in the Encode output in its canonical compact form with member order preserved — the property json.RawMessage buys over map[string]any — and Parse → Encode → Parse is a fixed point. The registry decoder is wired once in init rather than a test body so it survives -shuffle and -count without a duplicate-registration panic. No library code changes; fixtures and tests only. These run under the existing test CI job. Co-Authored-By: Claude <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.
Summary
Adds the RFC 8417 golden conformance suite: spec-derived claims-set fixtures under
testdata/and a table-driven round-trip test (conformance_test.go) that drives each one through the full consumer/producer cycle.RFC 8417 ships prose example figures rather than machine-readable vectors and defines no external conformance suite, so the library's conformance story is internal golden fixtures.
Fixtures
scim_create.jsoniss,iat,jti, two-memberaudarray, one SCIMcreateeventminimal.json{}payloadtxn_toe_subid.jsontxn,toedistinct fromiat, an RFC 9493iss_subsub_id,audarraysingle_aud.jsonaud, one event decoded to a typed value via the registrySynthetic fixtures use RFC 2606 example domains and illustrative (non-IANA) event-type URIs; provenance is documented in
testdata/README.md. No non-spec vocabulary is presented as if it came from the RFC.What the test asserts
For each fixture:
Parse→ assert decodedSETfields (iss/iat/jti/aud/sub_id/txn/toe/events) →Validatereturns nil → typed decode through the registry (one registered URI to a typed value, the rest left raw) →Encode. It then pins byte-stability two ways:Encodeoutput in its canonical compact form with member order preserved — the propertyjson.RawMessagebuys overmap[string]any;Parse → Encode → Parseis a fixed point.The registry decoder is registered once in
initso it survives-shuffle/-countwithout a duplicate-registration panic.Scope
No library code changes — fixtures and tests only. Runs under the existing
testCI job; no workflow changes.Local checks
gofmt -lclean,go vet ./...,go mod tidy -diffclean,go test -race -shuffle=on ./...green,golangci-lint0 issues.🤖 Generated with Claude Code