feat(intent): posts: declarative event-driven row posting (stage 1 - model + glue)#6405
Merged
Conversation
…lue (stage 1) First vertical slice of `posts:` (retires the hand-written ledger-posting glue; see kf-catalog PROPOSAL_EVENT_POSTING.md): PostIntent model (name/forEntity/event/forEach/into/idempotentBy/guard/set) + IntentModel.posts + GlueIntentGenerator.buildPosts emitting the structural glue descriptor (source entity, trigger event, per-item collection, target, idempotency back-reference, pascal-cased field map with pass-through Calc values incl. sign-flip). GluePostsTest verifies the emission; engine-intent 217/217 green. The trigger key is `event:` NOT `on:` - `on` is a YAML 1.1 boolean keyword (SnakeYAML mangles the key so the field never binds). The handler template (idempotent status-delegate / create-listener) + BPMN/listener wiring + the emission oracle + inventory adoption are the next stages. Co-Authored-By: Claude Opus 4.8 <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.
What
First stage of
posts:- a declarative construct that, on a document event, emits mapped rowsinto a target entity (per line item), idempotently by a back-reference. It replaces the recurring
hand-written ledger/journal-posting glue (e.g. goods documents →
StockMovementlines; document →GL journal line) - ~8 hand-written delegates/listeners in one KeyFolders module alone.
This PR lands the model + structural glue + test only; the handler template and BPMN/listener
wiring are the next stages (kept small for review).
Changes
PostIntentmodel:name,forEntity,event,forEach,into,idempotentBy,guard,set(field → value).IntentModel.posts+ accessors.GlueIntentGenerator.buildPosts- emits the glue descriptor per rule: source entity, triggerevent, per-item collection, target, idempotency back-reference, and the pascal-cased field map
(Calc values - constants,
Master.field,item.field, sign-flip expressions - pass throughverbatim).
GluePostsTest- asserts the emission for a goods-issue-ledger example.Authoring shape
Note the trigger key is
event:, noton:-onis a YAML 1.1 boolean keyword (SnakeYAMLresolves the key to a boolean, so an
on:field never binds).Verification
engine-intent217/217 green (incl. the newGluePostsTest).Follow-ups (separate PRs)
(event =
create) that rendersset:through the Calc engine and does theidempotentBypre-check; wire it to the trigger (BPMN
applystep /-transitionedtopic / create topic).the ledger posts identically.
🤖 Generated with Claude Code