Conversation
…overwrite behavior
There was a problem hiding this comment.
The PR introduces a clean mechanism to allow content overwriting via annotation override, with consistent implementation across all storage backends (DB, S3, Azure, GCP). Three issues were identified: a subtle null-guard imprecision in _isContentUpdateRestricted, a SELECT.one bug that can miss existing content when multiple attachment IDs are checked in bulk, and a test that asserts the overwrite HTTP status but never validates that the stored content actually changed.
PR Bot Information
Version: 1.19.15 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- File Content Strategy: Full file content
- Correlation ID:
8a5602e0-2e75-11f1-8f5a-b621bca23555 - Event Trigger:
pull_request.ready_for_review - LLM:
anthropic--claude-4.6-sonnet
Co-authored-by: Marten Schiwek <marten.schiwek@sap.com>
…p-js/attachments into add-content-overwrite-support
Co-authored-by: Marten Schiwek <marten.schiwek@sap.com>
There was a problem hiding this comment.
The PR introduces content overwrite support via @Capabilities.UpdateRestrictions.NonUpdateableProperties, which is well-structured across all storage backends (DB, S3, Azure, GCP). The core logic in _isContentUpdateRestricted is sound and the test coverage for both the restricted and permissive cases is thorough. The three issues flagged are: an empty ### Fixed changelog section, a misleading inline comment about the default restriction behavior, and a potential mid-stream failure scenario on object stores when overwriting (no explicit cleanup of the old blob before the new upload begins). Please address these before merging.
PR Bot Information
Version: 1.19.15 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
pull_request.opened - LLM:
anthropic--claude-4.6-sonnet - File Content Strategy: Full file content
- Correlation ID:
5ade5400-2e74-11f1-9f6b-5a4534e5aad0
|
|
||
| - Support for controlling content overwrite behavior via `@Capabilities.UpdateRestrictions.NonUpdateableProperties`. By default, `content` is listed as non-updateable, preventing overwrites with a `409` error. Setting the annotation to an empty array (`[]`) on a specific attachment composition allows content to be overwritten. | ||
|
|
||
| ### Fixed |
There was a problem hiding this comment.
Bug: Empty ### Fixed section in CHANGELOG entry
The ### Fixed section for v3.11.0 has no content, leaving an empty heading. Either add a relevant fix entry or remove the section entirely.
| ### Fixed | |
| ## Version 3.11.0 | |
| ### Added | |
| - Support for controlling content overwrite behavior via `@Capabilities.UpdateRestrictions.NonUpdateableProperties`. By default, `content` is listed as non-updateable, preventing overwrites with a `409` error. Setting the annotation to an empty array (`[]`) on a specific attachment composition allows content to be overwritten. | |
Double-check suggestion before committing. Edit this comment for amendments.
Please provide feedback on the review comment by checking the appropriate box:
- 🌟 Awesome comment, a human might have missed that.
- ✅ Helpful comment
- 🤷 Neutral
- ❌ This comment is not helpful
Add Content Overwrite Support for Attachments
New Feature
✨ Introduces configurable content overwrite behavior for the
@cap-js/attachmentsplugin. By default, attachment content is protected from being overwritten (returning a409 Conflicterror). Users can now opt-in to allow content overwrites on a per-composition basis using the@Capabilities.UpdateRestrictions.NonUpdateablePropertiesannotation.Changes
db/index.cds: Added default annotation@Capabilities.UpdateRestrictions.NonUpdateableProperties: [content]to theAttachmentsaspect, preventing content overwrites out of the box.srv/basic.js: Introduced the_isContentUpdateRestricted()helper method that inspects the@Capabilities.UpdateRestrictions.NonUpdateablePropertiesannotation on an attachment entity. The existing 409-conflict check input()is now gated behind this helper, so the restriction is only enforced when the annotation includescontent.srv/aws-s3.js,srv/azure-blob-storage.js,srv/gcp.js: Updated theput()upload guard in all three storage backends to call_isContentUpdateRestricted()before checking for an existing file, enabling overwrite behavior when the annotation allows it.tests/incidents-app/db/attachments.cds: Added a newoverwritableAttachmentscomposition annotated with@Capabilities.UpdateRestrictions.NonUpdateableProperties: []for testing the opt-in overwrite scenario.tests/integration/attachments-non-draft.test.js: Added an integration test that verifies content can be successfully overwritten when the annotation is set to an empty array.README.md: Added a new Allow Overwriting Attachment Content section documenting the feature, including a CDS example and a note about runtime evaluation across storage backends. Also updated the Table of Contents.CHANGELOG.md: Documented the new feature under version3.11.0.package.json: Bumped version from3.10.0to3.11.0.📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!
PR Bot Information
Version:
1.19.15| 📖 Documentation | 🚨 Create Incident | 💬 Feedbackanthropic--claude-4.6-sonnet5ade5400-2e74-11f1-9f6b-5a4534e5aad0pull_request.opened