feat(intent): postings - declarative source-document-to-ledger posting#6224
Merged
Conversation
`postings:` (top-level): when a (usually cross-model) source document reaches a status, create ONE local document with computed multi-line content - the accounting "source document -> balanced journal entry" capability, generalized. Derived from a concrete spike (shape-first, per the Wave-0 plan); rides the -transitioned channel (#6220). The generated MessageHandler re-loads the source by id (the transition payload lacks later-step data such as the stamped number), guards on the status, enforces at-most-once via the backReference, resolves the account-determination rule row (a missing row or null referenced column SKIPS the posting - the unposted worklist - never throws), and writes the target + items through the generated repositories, so numbering/status init/checks fire on the created document. Header map supports copy, literal and {sourceProperty} templates; item amounts run through the SDK Calc evaluator with the local field's scale; row `when` guards are null-safe. Everything is pre-rendered by GlueIntentGenerator.buildPostings (the expansions convention - the Velocity template stays shape-only); the rule entity's Settings perspective is resolved correctly; map/item/rule column references match case-insensitively against authored names. Verified live: a hand-written posting listener replaced by the declarative block produced the identical balanced entry (411 D 1200 / 702 C 1000 / 4532 C 200) off a real invoice flow - 6/6 checks incl. re-loaded-number interpolation and the at-most-once guard. Co-Authored-By: Claude Fable 5 <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
Fifth accounting-vertical platform PR —
postings:, the declarative "documents → ledger" capability the Wave-0 spike was run to shape:Semantics (each verified):
-transitionedtopic (feat(intent): -transitioned event channel - workflow transitions become observable #6220) — reactions never see it, so no loops — and re-loads the source by id: the payload is as-of the transition, so the number stamped by a latergenerateNumberstep is correctly picked up by the{number}interpolation.init:, andchecks:(feat(intent): checks - declarative cross-field and cross-line validations #6223 — the balance invariant) fire on the created document.Calcevaluator with the local item field's scale; rowwhenguards are null-safe; the glue pre-renders every expression Java-side (the expansions convention — the template stays shape-only).Verification
Unit:
GluePostingsTest(full pre-rendering: topic coordinates, guard,ruleRow.*refs,Calc.evalexprs with scale,{placeholder}concat, used-column set) + parser negative tests. Live: the Wave-0 spike's ~100-line hand-written posting listener replaced by the block above — a real invoice flow (approve → issue via the Inbox) produced the identical balanced entry (411 D 1200 / 702 C 1000 / 4532 C 200, customer mapped, VAT row'swhenpassed, re-loaded number in the header) — 6/6 checks. Two shape bugs found and fixed by the live run: the rule entity's Settings perspective package and case-insensitive authored-name matching for map/item/rule references.Deliberate follow-up (documented): the storno/negation mode + explicit Reverse action — needs the void-document event from the source side first.
🤖 Generated with Claude Code