chore(sdk): alias experimental/tdf manifest and assertion types - #3943
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Warning Review limit reachedNext included review available in 26 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe experimental TDF package now aliases assertion and manifest types to the stable SDK. Local assertion implementations were removed. Policy types remain local because they lack compatible SDK equivalents. Documentation and one SDK comment now describe these relationships. ChangesTDF SDK Alias Consolidation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to The aliases preserve the inspected SDK behavior, and no merge-blocking regression was established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit checked the SDK gate Comment |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
0c00bb2 to
a3447fc
Compare
7f0cb1b to
fd974c3
Compare
a3447fc to
db38449
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
c08ed03 to
c068a0c
Compare
8127c71 to
1abae3e
Compare
X-Test Failure Report |
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
1abae3e to
42867d8
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
42867d8 to
1d24f7a
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
`sdk/experimental/tdf` carried its own copies of the manifest and assertion types -- `Manifest`, `Segment`, `KeyAccess`, `Assertion`, `Statement`, `AssertionKey` and the rest -- structurally identical to the ones in `sdk` but distinct to the type system, so anything crossing the boundary needed conversion. Two copies of the JWT signing and verification logic also had to be kept in step by hand. Replaces both files' definitions with type aliases. `sdk` owns the definitions; this package re-exports them. Every exported name and every method survives: `Assertion.Sign` / `Verify` / `GetHash`, `Statement.UnmarshalJSON`, `AssertionKey.IsEmpty` / `Algorithm`, `AssertionVerificationKeys.Get` / `IsEmpty` and the five `String()` methods all come along with the aliased types, so importers compile unchanged. A manifest produced here can now be handed to the stable SDK without conversion, which is what the follow-up delegation needs. Two deliberate non-aliases: `Policy`, `PolicyBody` and `PolicyAttribute` stay local. `sdk.PolicyObject` is itself exported and could be aliased, but it declares `Body` as an anonymous struct over the unexported `attributeObject`, so `PolicyBody` and `PolicyAttribute` have no sdk names to alias to, and the local ones are not assignable to `Body`. Aliasing `Policy` alone would break every caller that names the other two. For the alias to become possible `sdk` would have to both export the attribute type and give `Body` a named one; that is a separate change. `IntegrityAlgorithm` stays a distinct `int` type. `sdk.IntegrityAlgorithm` is itself `= int`, so no method can be attached to it, and aliasing would silently drop `String()` from this package's public API. The underlying values match, so the two convert freely. `kSplitKeyType`, `kPolicyBindingAlg` and `kGMACPayloadLength` are retained verbatim: this package still builds its own manifests and they have callers in `writer.go` and `key_access.go`. The change that removes those callers must delete these constants too, or they are left unused. (`calculateSignature` was part of this set until #4030 removed it; the integrity helpers here are now `hmacIntegrity`, `segmentIntegrity` and `rootIntegrity`.) No behavior change. The package's existing tests pass unmodified. Signed-off-by: Dave Mihalcik <dmihalcik@virtru.com>
1d24f7a to
d9df0fd
Compare
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
Benchmark results, click to expandBenchmark authorization.GetDecisions Results:
Benchmark authorization.v2.GetMultiResourceDecision Results:
Benchmark Statistics
Bulk Benchmark Results
TDF3 Benchmark Results:
|
|
Proposed Changes
sdk/experimental/tdfcarried its own copies of the manifest and assertiontypes --
Manifest,Segment,KeyAccess,Assertion,Statement,AssertionKeyand the rest -- structurally identical to the ones insdkbut distinct to the type system, so anything crossing the boundary needed
conversion. Two copies of the JWT signing and verification logic also had
to be kept in step by hand.
Replaces both files' definitions with type aliases.
sdkowns thedefinitions; this package re-exports them. Every exported name and every
method survives:
Assertion.Sign/Verify/GetHash,Statement.UnmarshalJSON,AssertionKey.IsEmpty/Algorithm,AssertionVerificationKeys.Get/IsEmptyand the fiveString()methodsall come along with the aliased types, so importers compile unchanged. A
manifest produced here can now be handed to the stable SDK without
conversion, which is what the follow-up delegation needs.
Two deliberate non-aliases:
Policy,PolicyBodyandPolicyAttributestay local.sdk.PolicyObjectdeclares
Bodyas an anonymous struct over an unexported element type, sothere is no nameable sdk equivalent to alias to. Exporting those in
sdkfirst would make the alias possible; that is a separate change.
IntegrityAlgorithmstays a distinctinttype.sdk.IntegrityAlgorithmis itself
= int, so no method can be attached to it, and aliasing wouldsilently drop
String()from this package's public API. The underlyingvalues match, so the two convert freely.
kSplitKeyType,kPolicyBindingAlg,kGMACPayloadLengthandcalculateSignatureare retained verbatim: this package still builds itsown manifests and they have callers in
writer.goandkey_access.go.The change that removes those callers removes these too.
No behavior change. The package's existing tests pass unmodified.
Checklist
Testing Instructions
No behavior change — the point is that the package's existing tests pass
unmodified against aliased types.
The full DSPX-2604 stack — 20 PRs
mainmainmainmainmainmainmaindspx-2604-base-11= #3932 + #3934 + #3935dspx-2604-base-17= #3944 + #3945dspx-2604-base-19= #3947 + #3939Reviewable in parallel right now, since they sit directly on
mainand depend onnothing else: 01, 02, 04, 05, 06, 07, 08.
Why three PRs have a
dspx-2604-base-*base. A GitHub PR takes one base branch,but 11, 17 and 19 each build on more than one parent. The
base-*branches are emptymerge commits that exist only to join those parents so the PR diff shows exactly its
own change and nothing else. They contain no code, have no PR of their own, and go
away once their parents land — retarget the child onto
mainat that point.Wants a cross-SDK xtest run before merge: 15, 17 (and therefore 20). They touch
the KAS wire format.
Red checks you may see are network flakes, not this stack. Four distinct ones hit
this batch and all clear on re-run:
golangci-lint config verifytiming out onhttps://golangci-lint.run/.../golangci.v2.8.jsonschema.json(fails the wholego (<module>)job and fail-fast cancels its siblings), the bats installer getting a 403,Docker Hub timing out on
keycloak/keycloak:26.4, andbufreporting "the serverhosted at that remote is unavailable" while the Java SDK generates sources. The
govulncheckstep also emits##[error]annotations against the go1.25.11 stdlib, butit is
continue-on-error: trueand never fails a job — 01 bumps the toolchain andclears those annotations.
Summary by CodeRabbit
Compatibility
Documentation