Conversation
SummaryThe following content is AI-generated and provides a summary of the pull request: Feat: Filter Process Start Context by Process Definition InputsNew Feature✨ Changed the behavior when no Changes
PR Bot InformationVersion:
💌 Have ideas or want to contribute? Create an issue and share your thoughts with us! Made with ❤️ by Hyperspace. |
There was a problem hiding this comment.
The PR introduces a meaningful improvement by resolving process context fields from the process definition's ProcessInputs type when no inputs annotation is present, but has several correctness issues that need attention before merging: the @bpm.process.start.if condition is silently bypassed when the zero-match path is hit (the most critical bug), the startSpecs.id! non-null assertions could pass undefined through without any diagnostic, and the test fixture for Test 16 shares a definition id with Test 1 making it structurally fragile.
PR Bot Information
Version: 1.18.10 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
pull_request.opened - LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
d98033a0-2203-11f1-9a70-ffd21ca5a08a
| let serviceName: string | undefined; | ||
| for (const name in definitions) { | ||
| if (Object.hasOwn(definitions, name)) { | ||
| const def = definitions[name] as unknown as Record<string, unknown>; | ||
| if (def[PROCESS_PREFIX] === definitionId) { | ||
| serviceName = name; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (!serviceName) return undefined; |
There was a problem hiding this comment.
Logic Error: Non-unique definitionId lookup may return the wrong service's ProcessInputs
getProcessInputFieldNames iterates cds.model.definitions and stops at the first entry where def[PROCESS_PREFIX] === definitionId. The same definitionId string can be shared across multiple entities with different @bpm.process.start.id values (e.g. annotation-service.cds has both StartNoInput and StartNoInputZeroMatch annotated with id: 'startNoInputProcess'). More critically, the loop is looking for the service-level @bpm.process annotation, but two independent services could theoretically carry the same process id, or the iteration order of definitions could pick the wrong one first.
Additionally, the lookup associates the service name with the definition id, then constructs ${serviceName}.ProcessInputs. If two services share a definition id, the resolution is non-deterministic and the wrong ProcessInputs type may be used, leading to silently wrong column filtering.
Should either enforce that definition-id uniqueness is assumed at a higher level (and add a warning when duplicates are found), or re-think the lookup so it doesn't silently use the first match when duplicates exist.
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
Co-authored-by: hyperspace-insights[bot] <209611008+hyperspace-insights[bot]@users.noreply.github.com>
Have you...