feat: const with reference digest#2084
Conversation
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded comprehensive test validation for component reference digest handling in the CLI, including success and failure scenarios. Updated Go module dependencies across multiple files, promoting Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
cli/cmd/cmd_test.go (1)
1985-1987: Remove unused variable assignment.The
_ = referencedDescassignment on line 1986 serves no purpose. The variable was used earlier to verify the referenced component exists but this final assignment is dead code.🧹 Remove unused assignment
- // Verify referenced component is still accessible - _ = referencedDesc }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cli/cmd/cmd_test.go` around lines 1985 - 1987, Remove the dead assignment "_ = referencedDesc" at the end of the test: the variable referencedDesc is already used earlier to verify the referenced component, so delete the final no-op assignment (search for referencedDesc in the test function in cmd_test.go and remove the standalone "_ = referencedDesc" line) to eliminate the unused-assignment noise and keep the test unchanged otherwise.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@bindings/go/constructor/runtime/convert_desc.go`:
- Around line 202-210: ConvertFromDescriptorReference currently always
constructs a non-nil *Digest for the returned Reference which can break callers
that treat nil Digest as "not provided"; update the code in
ConvertFromDescriptorReference to only populate the Reference.Digest pointer
when the input reference.Digest is meaningful (non-nil and/or has non-empty
HashAlgorithm/NormalisationAlgorithm/Value) to mirror
ConvertToDescriptorReference behavior — leave Reference.Digest nil when the
descriptor contains a zero-value digest. Ensure you check the input
reference.Digest and only set the Digest fields (HashAlgorithm,
NormalisationAlgorithm, Value) into the new *Digest when at least one of those
fields is non-empty.
In `@bindings/go/constructor/spec/v1/resources/schema-2020-12.json`:
- Around line 398-400: The change adds "additionalProperties": false to the
"component" object schema which makes validation breaking for any existing
component objects with extra fields; revert this strictness by removing or
setting "additionalProperties" to true on the "component" definition or, if the
strict rule is intentional, document the breaking change and bump the
schema/contract version so consumers are aware; refer to the "component" schema
entry and the "additionalProperties" flag when making the update.
---
Nitpick comments:
In `@cli/cmd/cmd_test.go`:
- Around line 1985-1987: Remove the dead assignment "_ = referencedDesc" at the
end of the test: the variable referencedDesc is already used earlier to verify
the referenced component, so delete the final no-op assignment (search for
referencedDesc in the test function in cmd_test.go and remove the standalone "_
= referencedDesc" line) to eliminate the unused-assignment noise and keep the
test unchanged otherwise.
🪄 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: d4c7b6ae-2c29-4148-a1e5-93ebf3a5daa6
📒 Files selected for processing (9)
bindings/go/constructor/construct.gobindings/go/constructor/runtime/constructor.gobindings/go/constructor/runtime/convert_desc.gobindings/go/constructor/runtime/convert_v1.gobindings/go/constructor/spec/v1/constructor.gobindings/go/constructor/spec/v1/constructor_test.gobindings/go/constructor/spec/v1/convert.gobindings/go/constructor/spec/v1/resources/schema-2020-12.jsoncli/cmd/cmd_test.go
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
|
Unit test fail due to local |
# Conflicts: # bindings/go/constructor/construct.go
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
piotrjanik
left a comment
There was a problem hiding this comment.
LGTMm, though docker.io rejects connection in actions. Rate limit?
Signed-off-by: Fabian Burth <fabian.burth@sap.com>
What this PR does / why we need it
We want to adopt the backwards compatible constructor json schema. This allows component references in the component constructor.
Which issue(s) this PR fixes
open-component-model/ocm-project#961
Testing
How to test the changes
Verification
ocm