Skip to content

feat: support multiple businessKey annotations#74

Merged
SirSimon04 merged 11 commits intomainfrom
newMultipleBusinessKey
Apr 2, 2026
Merged

feat: support multiple businessKey annotations#74
SirSimon04 merged 11 commits intomainfrom
newMultipleBusinessKey

Conversation

@tilwbr
Copy link
Copy Markdown
Contributor

@tilwbr tilwbr commented Apr 1, 2026

Have you...

  • Added relevant entry to the change log?

Copy link
Copy Markdown
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 review has been concluded!

PR Bot Information

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

  • Correlation ID: 9bf84470-2ddc-11f1-8195-f82f4392d55b
  • Event Trigger: pull_request.opened
  • LLM: anthropic--claude-4.6-sonnet
  • File Content Strategy: Full file content

@tilwbr tilwbr marked this pull request as ready for review April 2, 2026 07:42
@tilwbr tilwbr requested a review from a team as a code owner April 2, 2026 07:42
@hyperspace-insights
Copy link
Copy Markdown
Contributor

Summary

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


Support Multiple @bpm.process.businessKey Annotations with Qualifier

New Feature

✨ Introduced support for multiple @bpm.process.businessKey annotations on the same entity using CDS qualifiers (e.g., @bpm.process.businessKey #one). Each qualified process annotation (start, cancel, suspend, resume) now first resolves a matching qualified business key, then falls back to the unqualified @bpm.process.businessKey if none is found.

Changes

  • CHANGELOG.md: Added entry for the new feature in version 0.1.2.
  • README.md: Added new Multiple Business Key Annotations section with CDS examples demonstrating qualified and mixed qualified/unqualified business keys. Updated validation docs to describe qualifier-aware business key resolution for cancel/suspend/resume and start annotations.
  • lib/build/constants.ts: Added two new warning message constants — WARNING_BUSINESS_KEY_MUST_BE_EXPRESSION and WARNING_BUSINESS_KEY_NOT_FOUND — used when business key validation is skipped for process start.
  • lib/build/plugin.ts: Updated build plugin to extract qualifiers and resolve the correct business key annotation per prefix for both start and lifecycle (cancel/resume/suspend) annotations. Added call to the new validateBusinessKeyForProcessStart function.
  • lib/build/validations.ts: Added validateBusinessKeyForProcessStart function that emits warnings (not errors) when the business key is missing or invalid for a process start. Updated validateBusinessKeyAnnotation to accept the resolved annotation key dynamically instead of using the hardcoded BUSINESS_KEY constant.
  • lib/shared/annotations-helper.ts: Exported extractQualifier function and added new resolveBusinessKeyAnnotation helper that resolves the appropriate business key annotation key for a given qualifier with fallback logic. Updated both getStartAnnotationDescriptors and getLifecycleAnnotationDescriptors to use qualifier-aware business key resolution.
  • tests/bookshop/srv/annotation-hybrid-service.cds: Refactored the TwoProcessStarts entity into QualifiedAnnotations with separate qualified business keys (#one uses ID, unqualified uses model). Added cancel/suspend/resume lifecycle annotations per qualifier and updated the hybrid test service accordingly.
  • tests/bookshop/srv/annotation-service.cds: Added MultiStartDiffBusinessKeys and MultiCancelDiffBusinessKeys test entities with different qualified business key expressions.
  • tests/hybrid/annotationApproach.test.ts: Expanded hybrid test for qualified annotations to verify start, suspend, resume, and cancel operations each use their respective business keys.
  • tests/integration/annotations/multipleLifecycleAnnotations.test.ts: Added integration test asserting that two cancel operations on DELETE use their respective business keys.
  • tests/integration/annotations/multipleStartAnnotations.test.ts: Added integration test asserting that two start operations on CREATE use their respective business keys.
  • tests/integration/build-validation/processStart.test.ts: Added build validation tests for missing and invalid @bpm.process.businessKey on process start entities (expect warnings, not errors).
  • tests/integration/build-validation/qualifiedAnnotations.test.ts: Added tests to verify that qualified annotations pass validation when using a matching qualified business key or falling back to the unqualified one.

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

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

  • File Content Strategy: Full file content
  • Event Trigger: pull_request.ready_for_review
  • Output Template: Default Template
  • Correlation ID: 8bce2c50-2e67-11f1-9849-aaa4ae504a77
  • Summary Prompt: Default Prompt
  • LLM: anthropic--claude-4.6-sonnet

💌 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
Copy Markdown
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 support for multiple @bpm.process.businessKey annotations with qualifier-based resolution and fallback logic. The implementation is generally sound and well-tested. The main concerns are: (1) near-duplicate validation logic between validateBusinessKeyForProcessStart and validateBusinessKeyAnnotation that could drift out of sync, (2) the implicit contract of resolveBusinessKeyAnnotation returning the unqualified fallback regardless of whether it exists — which is handled differently across start vs. lifecycle validation paths, and (3) the lifecycle integration test using cascade as a discriminator for cancel messages, which is fragile compared to using a stable unique identifier.

PR Bot Information

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

  • File Content Strategy: Full file content
  • Event Trigger: pull_request.ready_for_review
  • Correlation ID: 8bce2c50-2e67-11f1-9849-aaa4ae504a77
  • LLM: anthropic--claude-4.6-sonnet

Comment thread lib/build/validations.ts
Comment thread lib/shared/annotations-helper.ts
Comment thread tests/integration/annotations/multipleLifecycleAnnotations.test.ts
Copy link
Copy Markdown
Contributor

@Kronprinz03 Kronprinz03 left a comment

Choose a reason for hiding this comment

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

LGTM, after that can you create a hybrid test with different 2 processes which get handelt ?

@tilwbr
Copy link
Copy Markdown
Contributor Author

tilwbr commented Apr 2, 2026

LGTM, after that can you create a hybrid test with different 2 processes which get handelt ?

The hybrid test is already expanded in this PR

@SirSimon04 SirSimon04 merged commit 7069605 into main Apr 2, 2026
12 checks passed
@SirSimon04 SirSimon04 deleted the newMultipleBusinessKey branch April 2, 2026 12:21
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.

3 participants