Fixing invisible document numbers - #6844
Open
TIVMOF wants to merge 15 commits into
Open
Conversation
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Both delegates now re-load the row after their targeted write so the published
payload carries what was actually committed, and the assertions still described
the shape from before that.
The writer no longer inlines the coerced key into updateProperties - it hoists it
into a local, because the reload needs the same id - so match the local and the
call rather than the old single expression. The stamp reads the row twice: once
up front to skip an already-stamped document, once after the write to build the
payload; indexOf("repository.findById(id)") found the guard read and reported the
reload as happening before the write. Anchor it on the assignment instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR:
Task-form edits and stamped document numbers are invisible downstream
Two generated writers persist data that is meaningful to the rest of the system through the silent
targeted primitives, so
notifications:,integrations:,outbound:and every other-updatedconsumer cannot observe them:
events/Writer.java.template:59number: { stampOn: issue }events/Numbering.java.template:43The Writer's javadoc even asserted the silence was correct — "A workflow-driven system write that
must not re-fire onUpdate reactions". That is the actual defect: these are a person's edits.
onUpdatereactions exist precisely to react to what a reviewer changed, and nothing could see it.The masking effect is what made it survive
BpmnIntentGeneratororders after-task delegates[writer, setter, stepEvent](:688-700). If thetask also carries a
setRelationField, the setter's post-write reload sweeps the form edits into its-transitionedpayload by coincidence — so the same authoring model is observable or notdepending on whether an unrelated status setter happens to exist on that task. A task with no setter
loses the edits entirely.
The same accident covers numbering: the stamped number only reached consumers via a preceding
setter's reload. That is also the bug the
SetFielddeferral comment already records — "anauto-posted entry used to catch the create-time UUID placeholder".
The fix
Both writers now follow the
SetField.java.templatepattern exactly: guard on the update count,re-load so the payload is the committed row, then publish
-updatedthroughProcess.executeAfterCommit.The deferral is load-bearing, not decoration. A consumer re-loads the record on receive, so
publishing inside the Flowable command would race the remaining steps of the same synchronous chain —
which is the precise failure the numbering placeholder bug was.
GlueGenerator.bindNumberinggained one key: it copied only the sanitizedperspectiveinto theVelocity context, and an event topic is built from the raw one.
On the systemic option
The issue suggested switching these to
updateDerived(targeted write +-updated, DAO:485-497).That would be wrong here.
updateDerivedpublishes eagerly, which is right for its callers —rollup and aggregate
MessageHandlers, outside any BPMN command — and wrong for aJavaDelegaterunning inside one, for the reason above. Following
SetFieldis the correct shape.Documentation
The third ask — "an author cannot tell by reading the guide which constructs are observable" — is now
a table in
intent-assistant-guide.mdunder the event-axis section: what each write publishes andwhat can bind to it, plus the deliberately-silent cases and why (the trigger's
ProcessIdwrite-back,an
expansions:child count, and aresolves:lookup would each re-trigger their own handler).One silent write I found and did not change: a document's header totals, recomputed by
Repository.recalculate(Object)via the basesuper.updateProperties(:769). It is defensible —the line item's own create/
-updated/-deletedalready fires — so the guide now says to bind thereaction to the line, not the header. Worth its own issue if that is not the intended contract.
Verification
IntentEngineIT.editable_task_form_fields_are_coerced_to_their_java_type_on_write_back— extendedwith the topic, the deferral, and write-before-reload ordering.
IntentEngineIT.numbering_stamp_publishes_the_stamped_document_number— new; thestampOn: issuedelegate had no emission coverage at all.
formatter:validateclean on all three modules.per/ no-pershapes) — brace- and paren-balanced,
findById(Object)signature confirmed againstJavaRepository:123.