test(api): 7.1 golden contract fixtures — sanitized JSON snapshots for the file/folder wire contract (#223) #229

Merged
amiryahaya merged 2 commits from feat/contract-goldens into main 2026-11-18 16:15:59 +01:00
Owner

Dev-plan 7.1 deliverable: golden request/response contract fixtures in CI — the pinned target the iOS migration (next slices) moves onto. Complements ContractPinningTests (property-NAME sets) with exact VALUE snapshots: an alias flip (mime_type/content_type), a date-format change, or a nullability drift now breaks a test FIRST, before any client.

13 sanitized snapshots in tests/fixtures/golden/: folders create/get/rename/list/children/root/root_contents (POPULATED — subfolder + both upload paths feed the listings), chunked upload-url → blob → complete, multipart 201 raw-DTO shape, file rename, download headers, delete 204s.

Sanitizer: GUIDs (whole-string or embedded in storage_path/upload_url, lookaround-guarded) → stable <owner-N>/<tenant-N>/<root-1>/<folder-N>/<guid-N> placeholders; ISO-8601 → <ts>; base64-shaped >48 chars → <b64>; name fields exempt (a long name is contract, not noise); keys sorted recursively; LF-pinned indented JSON.

Mechanics: UPDATE_GOLDEN=1 regenerates locally (skips the presence gate; refuses under CI=true — regeneration is local-only, a diff fails the PR); fixture-set drift (deleted endpoints) also fails.

Review: dual-pass — ponytail checklist inline + full correctness pass. Reviewer empirically verified determinism (byte-identical regeneration with fresh GUIDs, working skip, working drift failure, no cross-test interference path). Findings all fixed: populated-children/root_contents coverage gap (the Important one — these are exactly the surfaces iOS migrates onto), CRLF-on-Windows regen pin, base64url-mangling lookarounds, name-collapse blind spot, exact fixture-set gate, CI regen hard-guard, doc/type residue, restored collateral getSettings test.

Known blind spots (documented): shares/classification/GetFolderKey/rotate pinned elsewhere or later slices; server pre-query breadth + cache warming at unlock recorded in #222.

Gates: full suite 1099 green (incl. 2 new tests), fixture set gate, regen determinism ×2.

Dev-plan 7.1 deliverable: **golden request/response contract fixtures in CI** — the pinned target the iOS migration (next slices) moves onto. Complements ContractPinningTests (property-NAME sets) with exact VALUE snapshots: an alias flip (mime_type/content_type), a date-format change, or a nullability drift now breaks a test FIRST, before any client. **13 sanitized snapshots** in tests/fixtures/golden/: folders create/get/rename/list/children/root/root_contents (POPULATED — subfolder + both upload paths feed the listings), chunked upload-url → blob → complete, multipart 201 raw-DTO shape, file rename, download headers, delete 204s. **Sanitizer**: GUIDs (whole-string or embedded in storage_path/upload_url, lookaround-guarded) → stable `<owner-N>/<tenant-N>/<root-1>/<folder-N>/<guid-N>` placeholders; ISO-8601 → `<ts>`; base64-shaped >48 chars → `<b64>`; `name` fields exempt (a long name is contract, not noise); keys sorted recursively; LF-pinned indented JSON. **Mechanics**: UPDATE_GOLDEN=1 regenerates locally (skips the presence gate; refuses under CI=true — regeneration is local-only, a diff fails the PR); fixture-set drift (deleted endpoints) also fails. **Review**: dual-pass — ponytail checklist inline + full correctness pass. Reviewer empirically verified determinism (byte-identical regeneration with fresh GUIDs, working skip, working drift failure, no cross-test interference path). Findings all fixed: populated-children/root_contents coverage gap (the Important one — these are exactly the surfaces iOS migrates onto), CRLF-on-Windows regen pin, base64url-mangling lookarounds, `name`-collapse blind spot, exact fixture-set gate, CI regen hard-guard, doc/type residue, restored collateral getSettings test. **Known blind spots (documented)**: shares/classification/GetFolderKey/rotate pinned elsewhere or later slices; server pre-query breadth + cache warming at unlock recorded in #222. Gates: full suite 1099 green (incl. 2 new tests), fixture set gate, regen determinism ×2.
test(api): 7.1 golden contract fixtures — sanitized JSON snapshots for the file/folder wire contract (#223)
Some checks failed
API CI / build-and-test (pull_request) Failing after 6m6s
API CI / migrations (pull_request) Successful in 4m44s
Security CI / security-scan (pull_request) Has been cancelled
caa8bfcaaa
GoldenContractTests: full sanitized JSON snapshots of every file/folder
surface (folders CRUD + children + root + root/contents + list, chunked
upload-url/blob/complete, multipart 201, rename, download headers, delete
204), checked into tests/fixtures/golden/. Unlike ContractPinningTests
(property-NAME sets), these pin exact VALUES — an alias flip
(mime_type/content_type), a date-format change, or nullability drift
breaks the golden FIRST, before any client migrates onto the contract.

- Sanitizer: GUIDs (whole-string or embedded in storage_path/upload_url)
→ stable <owner-N>/<tenant-N>/<folder-N>/<guid-N> placeholders, ISO-8601
timestamps → <ts>, long base64 → <b64>; keys sorted recursively;
WriteIndented rendering via System.Text.Json.Nodes (valid JSON, readable).
- UPDATE_GOLDEN=1 regenerates locally; a regeneration gate skips in CI and
CI diffs fail the PR (never silently rewrites).
- Establishes the pinned target for the 7.1 iOS migration slices.

Full suite: 1099 green incl. 2 new tests.
ci: retrigger — pre-existing intermittent linux flake in RegistryIntegrationTests.ApiVerify_WrongSignature_Returns401 (1 failure across 5 local linux full-suite runs of this exact tree; failure did not reproduce in 3 consecutive reruns)
All checks were successful
API CI / migrations (pull_request) Successful in 2m30s
API CI / build-and-test (pull_request) Successful in 3m51s
Security CI / security-scan (pull_request) Successful in 2m41s
fe630d4ccd
Sign in to join this conversation.
No description provided.