feat!: revert typed identy and move back to runtime.Identity#2469
Conversation
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
✅ Deploy Preview for ocm-website ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThis PR refactors the Go credentials package to use concrete ChangesTyped Credential Resolution Refactoring
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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. Comment |
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bindings/go/credentials/synced_dag.go`:
- Around line 41-47: The getIdentity method on syncedDag returns a mutable
runtime.Identity by reference; change it to return a defensive copy and likewise
ensure the code path that stores the identity (the place writing
attributeIdentity into vertex.Attributes, referenced around the store in the
same file) also stores a copy instead of the original map. Concretely, when
reading in syncedDag.getIdentity (and when assigning to
vertex.Attributes[attributeIdentity]) clone the runtime.Identity map into a new
map and return/store that copy so external callers cannot mutate internal DAG
state; locate getIdentity, getVertex, and the code that sets attributeIdentity
to implement the copy.
In `@bindings/go/credentials/type_registry.go`:
- Around line 67-71: The registry currently stores and returns caller-owned
slices by reference (r.acceptedCreds and acceptedCredentialTypes), allowing
external mutation; fix this by making defensive copies: when assigning into
r.acceptedCreds (the place where types[0] is used) copy the
acceptedCredentialTypes slice before storing, and when returning slices from the
registry (e.g., the getter that returns acceptedCreds entries) return a copied
slice rather than the internal slice; ensure copies use make/append semantics so
concurrent callers cannot mutate internal state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3ccd56a5-daa4-4196-b0b1-0c3d880a8a05
📒 Files selected for processing (14)
bindings/go/credentials/doc.gobindings/go/credentials/graph.gobindings/go/credentials/identity_compat.gobindings/go/credentials/identity_compat_test.gobindings/go/credentials/ingest.gobindings/go/credentials/ingest_test.gobindings/go/credentials/interface.gobindings/go/credentials/resolve_direct.gobindings/go/credentials/resolve_indirect.gobindings/go/credentials/resolve_static.gobindings/go/credentials/synced_dag.gobindings/go/credentials/synced_dag_test.gobindings/go/credentials/type_registry.gobindings/go/credentials/type_registry_test.go
💤 Files with no reviewable changes (2)
- bindings/go/credentials/identity_compat.go
- bindings/go/credentials/identity_compat_test.go
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
On-behalf-of: SAP <matthias.bruns@sap.com> Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
…bruns/open-component-model into feat/roll_back_typed_identities
…mponent-model#2469) #### What this PR does / why we need it We introduces `runtime.Typed` for both credentials and identities. While valuable for credentials, our code-base heavily relies on `runtime.Identity`. The problem is that we have to type-assign at several places just to migrate from `runtime.Identity` to `runtime.Typed`. There is no real benefit yet, nor do we have a working concept or even idea how we would provide identity comparison across plugin-boundaries for arbitrary types. We can't even imagine identities that would need such a change right now. ~I kept `CredentialTypeSchemeProvider` for now - no idea if this adds much to our system anymore.~ #### Which issue(s) this PR fixes Rolls back: open-component-model/ocm-project#800 --------- Signed-off-by: Matthias Bruns <git@matthiasbruns.com>
What this PR does / why we need it
We introduces
runtime.Typedfor both credentials and identities.While valuable for credentials, our code-base heavily relies on
runtime.Identity. The problem is that we have to type-assign at several places just to migrate fromruntime.Identitytoruntime.Typed. There is no real benefit yet, nor do we have a working concept or even idea how we would provide identity comparison across plugin-boundaries for arbitrary types. We can't even imagine identities that would need such a change right now.I keptCredentialTypeSchemeProviderfor now - no idea if this adds much to our system anymore.Which issue(s) this PR fixes
Rolls back: open-component-model/ocm-project#800