Skip to content

feat(intent): posts: stage 2 - handler template + resolver/renderer#6406

Merged
delchev merged 1 commit into
masterfrom
feat/intent-posts-handler
Jul 25, 2026
Merged

feat(intent): posts: stage 2 - handler template + resolver/renderer#6406
delchev merged 1 commit into
masterfrom
feat/intent-posts-handler

Conversation

@delchev

@delchev delchev commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What

Stage 2 of posts: (event-driven row posting; stage 1 model+glue merged as #6405). Builds the
generated handler on the proven postings: skeleton, flattened (no header document - N rows
straight into the target).

Changes

  • buildPosts resolver - the full glue descriptor: trigger (event: = create |
    numeric status seed id → the -created/-transitioned topic + a status guard), the composition-child
    coordinates for forEach (itemsEntity/Fk/perspective), target coordinates, the idempotentBy
    back-reference, and the rendered set: assignments.
  • postSetExpr renderer - each set: value → a Java expression over source/item: item copy
    (item.X), null-safe negation (-item.X), source copy (source.X), integer constant, quoted string.
  • Posts.java.template - a MessageHandler on the source's -transitioned/-created topic that,
    idempotent by the back-reference, emits one target row per forEach item (or one per source)
    through the target's generated repository.
  • Registered in the events template.js (collection: posts) + a generateUtils.js case "posts"
    (maps/sanitizes the glue → template params). glue.put("posts", ...) wires it into the .glue.

Authoring

posts:
  - name: goodsIssueLedger
    forEntity: GoodsIssue
    event: 2                 # a status seed id (fires on -transitioned into it), or `create`
    forEach: items           # the composition child; omit = one row per source
    into: StockMovement
    idempotentBy: GoodsIssue  # back-reference FK; skip if target rows already exist
    set:
      Product:  item.Product
      Quantity: "-item.Quantity"    # null-safe negate
      Direction: 2                  # constant
      Store: source.Store           # source copy

Verification

engine-intent 217/217. GluePostsTest asserts the resolved descriptor end-to-end: event: 2
status guard on the Status property; GoodsIssueItem/GoodsIssue composition child; StockMovement
target + GoodsIssue back-ref; and the rendered Java exprs (incl.
item.Quantity == null ? null : item.Quantity.negate()). The handler template mirrors the proven
Posting.java.template.

Follow-up (stage 3)

Generation/boot verification of the emitted handler (compiles + posts identical rows) and adoption in
kf-mod-inventory (retire the 6 *PostDelegates + the adjustment poster). event: numeric-id →
optional status-name resolution is a nicety.

🤖 Generated with Claude Code

… wiring

Builds the posts: handler on the proven postings skeleton (flattened - no header doc):
- buildPosts now resolves the full descriptor: trigger (event: `create` | numeric status seed id ->
  -created/-transitioned topic + status guard), the composition-child coordinates for forEach
  (itemsEntity/Fk/perspective), target coordinates, the idempotency back-reference, and the rendered
  set: assignments.
- postSetExpr renders each set: value to Java over source/item: item copy (item.X), null-safe
  negation (-item.X), source copy (source.X), integer constant, quoted string.
- Posts.java.template: a MessageHandler on the source's -transitioned/-created topic that, idempotent
  by the back-reference, emits one target row per forEach item (or one per source) through the target
  repository. Registered in the events template.js (collection: posts) + a generateUtils.js
  `case "posts"` mapping/sanitizing the glue -> template params.
- glue.put("posts", ...) wires it into the .glue output.

Verified: engine-intent 217/217; GluePostsTest asserts the resolved descriptor (status guard id 2 ->
Status property; GoodsIssueItem/GoodsIssue child; StockMovement target + GoodsIssue back-ref; and the
rendered exprs incl. `item.Quantity == null ? null : item.Quantity.negate()`). Note `event:` not `on:`
(YAML boolean keyword). Generation/boot verify of the emitted handler + inventory adoption are the
next stage.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@delchev
delchev merged commit dac9ee1 into master Jul 25, 2026
10 checks passed
@delchev
delchev deleted the feat/intent-posts-handler branch July 25, 2026 06:13
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.

1 participant