Language: English | Español
Golden fixtures are JSON files in src/libs/sdk/contracts/fixtures/ that capture representative AuthorizationGraph payloads covering the full spectrum of behaviors. They are the executable contract: every SDK and the UMS server must agree on how to interpret them.
Each fixture is round-tripped through every artifact that touches the schema:
- JSON Schema validation — the fixture conforms to
auth-graph.schema.json. - Server builder regression — UMS's
AuthorizationGraphBuilderServicecan produce this exact shape given the equivalent input. - SDK deserialization —
Ums.Sdk.Contracts,@ums/sdk-contractsparse it without loss. - SDK validator behavior — given this fixture and a probe (e.g., "check
RequiresScope('STOCK_VIEW.VIEW')"), every runtime returns the sameAuthorizationDecision. - Re-serialization — every SDK can serialize the deserialized graph back into JSON that still validates against the schema.
CI runs all five steps on every PR. A failure in any step blocks the PR.
| File | Scenario | Used to verify |
|---|---|---|
local-auth-success.json |
Happy path Local (BCrypt) auth, OrgWide profile, mix of Allow / NotGranted / Deny | Baseline shape, scope generation |
idp-auth-success.json |
Happy path IDP (Azure AD) auth, BranchScoped profile, MFA required | IDP authentication block, branch not null |
deny-wins.json |
Same action has Allow in one place and Deny in another | Deny-precedence rule (Axiom A3) |
override-allow.json |
Profile override flips a Template Deny to Allow | Override-takes-precedence rule |
empty-permissions.json |
User has Profile but no permissions granted | Empty scopes[], domainPermissions[] |
expired-graph.json |
validUntil < generatedAt + 1ms (deliberately expired) |
AUTH_201 rejection by SDKs |
feature-flag-matched.json |
Flag matches via BranchId criteria |
isEnabled = true, matchedCriteriaType set |
feature-flag-missed-context.json |
Flag exists, but context doesn't provide required field | isEnabled = false, matchedCriteriaType = null |
multi-tenant-rejection.json |
Graph is for tenant A, used to probe a tenant-B-expected client | AUTH_109 tenant mismatch |
schema-unsupported-major.json |
schemaVersion: "2.0.0" (future MAJOR) |
SDK with <2.0.0 compat rejects with AUTH_205 |
schema-minor-ahead.json |
schemaVersion: "1.99.0", contains unknown optional field |
Accept-with-warning, preserve in extensions |
schema-missing.json |
Payload without schemaVersion |
AUTH_204 rejection |
- Use the placeholder UUID pattern introduced in
auth-graph.md§8 (11111111-1111-...for tenants,22222222-...for system suites, etc.). Predictable IDs make diffs readable. - Use fictional but realistic tenant codes:
LOGISTICS_CORE,ACME_RETAIL,EXAMPLE_BANK. Never real customer names. - No PII: emails follow
firstname.lastname@<fictional-domain>.example. Use.exampleper RFC 2606. - No secrets, no tokens, no hashes of real values. JWT values in fixtures are literal
"PLACEHOLDER". - One fixture, one scenario: don't pile multiple semantic concerns into one fixture. If you need to test two things, write two fixtures.
- Fixtures are immutable once shipped: changing an existing fixture is a coordinated change across all SDK test suites. Adding a new fixture is the default.
- Create
src/libs/sdk/contracts/fixtures/<scenario-name>.json. - Add a row to this file's table above.
- Add corresponding test cases in each SDK's test suite, referencing the fixture by relative path.
- Run the CI contract-validation job locally to confirm round-trip passes.
- PR includes: new fixture + 3 SDK test updates + docs row.
A fixture can only be removed if the scenario it represents is no longer reachable in any supported schema version. Removal requires:
- Confirmation in the PR description that no supported schema produces a payload matching this fixture.
- Removal of corresponding SDK test cases.
- Row deleted from this file.
If a fixture becomes outdated due to a MAJOR schema change, prefer to migrate it (update to match the new schema) rather than delete. Historic fixtures are useful for regression analysis.
- Schema Overview
- Versioning Policy
- Authorization Graph (domain doc)
- Fixtures source directory:
src/libs/sdk/contracts/fixtures/