Consume octi-web's published wire-format fixtures#46
Merged
Conversation
Migrates fixture-lock.json from v1 single-source to v2 multi-source and adds octi-web as a second pinned producer. Per-module consumer tests (Web{Meta,Clipboard,Files}InteropTest) parse each octi-web payloadJson through the production decoder using Serialization.json and assert field-by-field against octi-web's canonical inputs.
InteropFixtureSync was rewritten to be multi-source aware (ensureSynced returns Map<source, Path>; ensureSynced(source) returns one). Cache layout migrated to .cache/interop-fixtures/<owner>/<repo>/<sha>/. The lockfile parser accepts both v1 flat and v2 nested shapes so a hand-edit revert during the migration window still parses.
Pairs with octi-web#26 (producer) and octi#318 (the other consumer).
3 tasks
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.
What changed
No user-facing behavior change. Internal: octi-desktop now consumes octi-web's published wire-format fixtures alongside the existing app-main crypto fixtures. A future octi-web change that drops a required field, retypes a value, or renames an enum entry will fail the matching consumer assertion here — same gate the always-on Tink fixture verify provides for the encryption layer, applied to each module's JSON payloads.
This is B3 of Phase B of the cross-repo wire-format gate. The symmetric upstream-gating workflow on octi-web (which fans out to app-main + octi-desktop tests against an octi-web PR's HEAD) lands in B4 once both consumers are on
main.Technical Context
fixture-lock.jsonwas the v1 flat shape pinning onlyd4rken-org/octi; it now has aschemaVersion: 2+sources: { "<owner>/<repo>": { ref, manifest_sha256 } }map with bothd4rken-org/octiandd4rken-org/octi-webentries. The parser still accepts the v1 flat shape and normalizes to v2 internally — keeps the migration window robust against a future revert that only touches the lockfile.InteropFixtureSyncis multi-source aware.ensureSynced(): Map<source, Path>populates the cache for every locked source;ensureSynced(source: String): Pathis a convenience overload for one. Same double-checked-locking singleton so multiple test classes hitting different sources still sync each source once per JVM. Cache layout migrated from.cache/interop-fixtures/<sha>/to.cache/interop-fixtures/<owner>/<repo>/<sha>/— old caches get bulldozed on the first new-schema run (gitignored, rebuildable, no concern).HttpClient.sendoriginally buffered the whole response viaBodyHandlers.ofByteArray()before checking the cap — a bad pin or hostile upstream could still consume arbitrary memory before failing. Now usesBodyHandlers.ofInputStream()and aborts during the read loop the momenttotal > maxBytes. Cap is 2 MiB per fixture file (app-main'sstreaming-vectors.jsonis ~1.4 MiB — the two-segment streaming AEAD vector). 64 KiB manifest, 32 files max, 16 KiB lockfile.{"d4rken-org/some-future-repo": "<sha>"}for a source not present infixture-lock.jsonis a config bug; silent fallback to the locked refs would let a cross-repo gate pass green against a lock that doesn't yet know about it.sha256+byteLengthre-verified on read. The producer's self-check pins these at generate time; the consumer re-checks against the actualpayloadJsonbytes viaInteropFixtures.verifyVectorIntegrity(v). A hand-edit to a cached fixture file would fail here, not silently as a green decode.Serialization.json(the production wireJsoninstance), not a locally-constructed one — so consumer-side serializer/contextual-config drift is caught at the same interop gate, not just on smoke tests.Review guidance
InteropFixtures.kt/SyncRefResolver.kt/InteropFixtureSync.ktis the cross-repo trust boundary; cross-reference with the sister files atapp-common-test/.../testhelpers/interop/(app-main, B2) andocti-web/src/__interop__/sync-ref-resolver.ts(octi-web, A1) —SOURCE_PATHSentries for shared sources must agree byte-for-byte across every consumer.SyncRefResolverTest.ktexpanded from ~17 to 31 tests covering both v1 + v2 lockfile parsing, multi-sourceresolveAll, every validation path, and the "override targets a source not in the lock" guard.interop/published/mirror the structure on app-main's modules-{meta,clipboard,files}/src/test; same canonical-input mirror declared in octi-web'stools/generate-fixtures.ts.Test plan
./gradlew testgreen on cold cache (fetched fixtures fromd4rken-org/octi@f7e1089+d4rken-org/octi-web@84b9e57) — 250 tests./gradlew testgreen on warm cache (logs "interop fixtures cache hit" for both sources)InteropFixtureVerifyTest,PayloadEncryptionTest,StreamingPayloadCipherTeststill greenSyncRefResolverTestcovers v1 input shape acceptance + v2 multi-source resolve + the override-targets-unknown-source guardSister PRs: