fix: make status in getInstanceByBusinessKey optional for imported process services#54
Conversation
tilwbr
commented
Mar 23, 2026
- on process import, the function getInstanceByBusinessKey made the parameter status not optional, although it should
- this fix changes the behavior on process import so that the status is optional
8de110d to
79d90c8
Compare
There was a problem hiding this comment.
The PR correctly removes the intermediate ProcessInstanceStatus type alias and makes status directly an optional many String parameter on getInstancesByBusinessKey. However, two categories of issues were found:
-
Non-null assertions in
validation-utils.ts: MakingCsnElement.typeoptional in the interface was the right modelling change, but the six resulting!assertions throughoutconvertTreeToElementTypesandgetAllElementTypesonly silence TypeScript — they don't protect againstundefinedat runtime. Any element backed solely byitems(an inline array with notypefield) will produceundefinedinElementType.type, breaking thestringcontract silently. Each site needs a real guard or fallback. -
Spurious
length: 256on an array parameter inprocessImport.ts:lengthis a scalar constraint and has no effect on anitems-typed parameter; it belongs inside theitemsspec if a length constraint on individual strings is intended, or should simply be removed.
PR Bot Information
Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- LLM:
anthropic--claude-4.6-sonnet - Event Trigger:
pull_request.opened - Correlation ID:
0a19d010-26a1-11f1-9245-0d9a27830d9f
There was a problem hiding this comment.
The PR makes two focused changes: (1) removes the intermediate ProcessInstanceStatus type alias and replaces the status parameter with an inline many String in the generated CDS, and (2) makes CsnElement.type optional in the type definition, adding ?? '' fallbacks throughout validation-utils.ts. The core logic for the status parameter fix is correct, but the ?? '' fallback for an undefined type is a minor concern — it silently converts a missing type to an empty string rather than surfacing it clearly. All other changes (test fixtures, checksums, and the new getAllInstancesByBusinessKey test helper) look correct and consistent.
PR Bot Information
Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
issue_comment.created - Correlation ID:
ac9920b0-26a2-11f1-821e-7c0ffdda71a7 - LLM:
anthropic--claude-4.6-sonnet
SummaryThe following content is AI-generated and provides a summary of the pull request: Fix: Make
|
There was a problem hiding this comment.
The suggestion I posted was incorrect (using a non-existent isArray property). Let me reconsider and wrap up.
The core change in this PR is straightforward: replace the named ProcessInstanceStatus type alias (many String) with an inline items: { type: csn.CdsBuiltinType.String } directly on the status parameter. Looking at the generated .cds files, the output status : many String is valid CDS syntax, and the CDS compiler does support inline many on function parameters. The type? changes in CsnElement and ElementType are necessary to support elements that use items without a type property (array parameters). These are correct and consistent with how CDS models arrays.
The PR is clean and focused. The existing reviewer comments flag test changes in tests/bookshop/srv/programmatic-service.ts and tests/hybrid/programmaticApproach.test.ts — the author should address those concerns about whether the test changes are necessary and whether hybrid tests are the right place for them. No additional substantive issues were found beyond what's already been raised.
PR Bot Information
Version: 1.19.1 | 📖 Documentation | 🚨 Create Incident | 💬 Feedback
- Event Trigger:
pull_request.ready_for_review - LLM:
anthropic--claude-4.6-sonnet - Correlation ID:
a8ab2730-26ae-11f1-9d16-280815978ddc