Skip to content

bpm: a process variable started as a whole number stays whole (#7373) - #7422

Merged
delchev merged 1 commit into
masterfrom
issue-7373-process-variable-integral-numbers
Sep 17, 2026
Merged

delchev merged 1 commit into
masterfrom
issue-7373-process-variable-integral-numbers

Conversation

@delchev

@delchev delchev commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Cause

Process.start(key, businessKey, json) reached BpmProviderFlowable.startProcess(String), which read the variables with the platform's default Gson (GsonHelper.fromJson(parameters, HashMap.class)). Gson types every untyped JSON number as a Double, so a record's primary key handed over by the generated trigger as 33 landed in Flowable's variable store as 33.0.

Every reader that renders such a variable as text then says so. TaskSubject is one: an Inbox row's subject locator read "33.0", and the generated controller is bound on an integer path parameter, so the subject card's own fetch came back as Invalid value for path parameter [id]: 33.0 - the card could not load the very record the task is about.

Generated delegates were never affected: they read the key as ((Number) key).longValue(). That is why the symptom was confined to the one path that renders the key as text, and why it was silent in every layer that does not click the card.

Change

  • ProcessVariables.fromJson reads a variables document with Gson's LONG_OR_DOUBLE number strategy: a JSON number with no fractional part is an integer, a genuine decimal stays a Double. Both sites that take variables as JSON use it - starting a process and completing a task (TaskServiceImpl.completeTask(String, String), which had the same widening for a form's integer field).
  • TaskSubject reads the key as the whole number it is. An instance started before this fix still carries the widened key, and leaving those tasks broken until their process ends is not a fix.

Verification

  • mvn -pl components/engine/engine-bpm-flowable test - 45 tests green, including the three new ones. Each was checked to FAIL with the fix backed out (number strategy restored to DOUBLE, the subject reading the raw value): ProcessVariablesTest (the parse), ProcessVariablesEngineTest (a real Flowable engine - the store types the variable from the value it is handed, so the round trip is the claim), TaskSubjectTest (an already-running instance's widened key).
  • mvn -P integration-tests -pl tests/tests-integrations verify -Dit.test=IntentEmissionCoverageIT - green (195 s). Its ui: Inbox rows carry no business identity (only 'Ref <id>') and the Personal shell Inbox lists every back-office group task #7077 subject block now also asserts the served subject.id is a whole number, which is the end-to-end statement: the trigger starts the process, the task listing serves the locator, and the id is what the generated controller's path parameter accepts.
  • mvn formatter:validate with the cache wiped, and the release profile javadoc build on the changed module.

Not verified: the full IT suite, and no behaviour was checked on PostgreSQL (nothing here is SQL).

Fixes #7373

🤖 Generated with Claude Code

A process started through `Process.start(key, businessKey, json)` had its
variables read with the platform's default Gson, which types every untyped
JSON number as a `Double`. So a record's primary key handed over as `33`
landed in Flowable's variable store as `33.0`, and every reader that renders
such a variable as text said so: an Inbox row's subject locator read "33.0",
which the generated controller's integer path parameter then refused - the
card could not load the very record the task is about.

The variables of a start and of a task completion are now read with the
LONG_OR_DOUBLE number strategy: a JSON number with no fractional part is an
integer, a genuine decimal stays a decimal. Generated delegates were never
affected (they read the key as `((Number) key).longValue()`), which is why the
symptom was confined to the one path that renders the key as text.

An instance started before this fix still carries the widened key, so the
subject reads it as the whole number it is rather than leaving those tasks
broken until their process ends.

Fixes #7373

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@delchev
delchev merged commit 355233a into master Sep 17, 2026
10 checks passed
@delchev
delchev deleted the issue-7373-process-variable-integral-numbers branch September 17, 2026 12:51
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.

inbox: a task's subject id renders as "33.0", and the generated controller then refuses to load the record

1 participant