Skip to content

fix: annotations for draft entities#51

Open
Kronprinz03 wants to merge 3 commits intomainfrom
fix-annotations-for-draft-entities
Open

fix: annotations for draft entities#51
Kronprinz03 wants to merge 3 commits intomainfrom
fix-annotations-for-draft-entities

Conversation

@Kronprinz03
Copy link
Contributor

Have you...

  • Added relevant entry to the change log?

@Kronprinz03 Kronprinz03 requested a review from a team as a code owner March 23, 2026 08:06
@hyperspace-insights
Copy link
Contributor

Summary

The following content is AI-generated and provides a summary of the pull request:


Fix: Annotations for Draft-Enabled Entities

Bug Fix

🐛 Fixed an issue where process annotations (@bpm.process.start, @bpm.process.cancel, @bpm.process.suspend, @bpm.process.resume) were not working correctly for draft-enabled CDS entities. The root cause was that virtual key fields (e.g., IsActiveEntity, HasDraftEntity) generated by draft enablement were being included when extracting entity key fields, causing incorrect query construction.

Changes

  • lib/handlers/utils.ts: Added a guard in getKeyFieldsForEntity to skip virtual key fields when building the list of entity keys. This prevents draft-generated virtual fields from being included in WHERE clauses.

  • tests/bookshop/srv/draft-annotation-service.cds: Added a new CDS service definition (DraftAnnotationService) exposing draft-enabled entities to test all process annotation types (start, cancel, suspend, resume) across various lifecycle events (CREATE, UPDATE, DELETE), including a full lifecycle combination scenario.

  • tests/integration/annotations/draftAnnotation.test.ts: Added comprehensive integration tests covering:

    • @bpm.process.start on draft entity CREATE and DELETE
    • @bpm.process.cancel on draft entity CREATE (with condition), UPDATE, and DELETE
    • @bpm.process.suspend and @bpm.process.resume on draft entity CREATE
    • Full draft lifecycle scenario: CREATE → SUSPEND → RESUME → DELETE
    • Verification that editing a draft without activating does not trigger process events

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Event Trigger: pull_request.opened
  • Output Template: Default Template
  • Correlation ID: 28a88e70-268f-11f1-83cb-83040f217997
  • LLM: anthropic--claude-4.6-sonnet
  • Summary Prompt: Default Prompt

💌 Have ideas or want to contribute? Create an issue and share your thoughts with us!
📑 Check out the documentation for more information.
📬 Subscribe to the Hyperspace PR Bot DL to get the latest announcements and pilot features!

Made with ❤️ by Hyperspace.

Copy link
Contributor

@hyperspace-insights hyperspace-insights bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR introduces a focused fix in lib/handlers/utils.ts to skip virtual key fields (e.g. IsActiveEntity injected by CAP for draft-enabled entities) when building WHERE clauses — this is correct and necessary. The accompanying test service and integration tests provide good coverage of draft lifecycle scenarios. The one issue flagged above concerns the createViaDraft helper's slightly fragile ID-handling logic; aside from that, the core logic change is sound.

PR Bot Information

Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback

  • Event Trigger: pull_request.opened
  • Correlation ID: 28a88e70-268f-11f1-83cb-83040f217997
  • LLM: anthropic--claude-4.6-sonnet

@Kronprinz03 Kronprinz03 force-pushed the fix-annotations-for-draft-entities branch from c1dece4 to 7581c67 Compare March 23, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant