feat(import): posted journal entries vs the re-run contract (#358) #367
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.45) × (1 − Review Confidence (0.59)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 425 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 92% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.362
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #367"
general
weight: 0.35
bosd
Closes #358. Stacked on #364 (headless core contract); retarget to
masteronce that merges.Decision
1. Posting lives in a separate subcommand,
fluvo workflow post-moves. It is not an import flag.--post-actionis a single all-or-nothing RPC with no per-record accounting. A flow step is deferred.2.
posted_immutableis a named sub-reason ofunaccounted, not a fourth stat. The identity andassert_reconciledstay unchanged.ReconStats.reasonsandstats["unaccounted_reasons"]make the bucket legible, and the "dropped records" warning only fires for the unexplained remainder.3. A draft that was posted in Odoo between runs takes the same path. Detection reads live
state, the move is left untouched and counted, and import never callsbutton_draft.4. Corrections and reversals are deferred.
What changed
lib/immutable.py: a pre-load guard foraccount.move(state) andaccount.move.line(parent_state).- Rows targeting a posted record are taken out of the load.
totalis not shrunk.- Those rows are written to a
_skipped.csvsidecar with a_SKIP_REASONcolumn, never to the fail file, so--failwon't retry them forever.- With
--o2m, the continuation rows follow their parent.- If the guard can't read
state, it fails closed and aborts the run. Streaming is disabled for guarded models.statecolumn on a guarded model is refused. The fix is to drop it or pass--ignore state.workflow post-moves:- Posts with batch
action_post, falling back to per-record on error.- The outcome is judged by re-reading
state.- Returns a reconciled
RunResult: created = posted now, failed = not found / not draft / refused (written to_post_fail.csv), unaccounted =already_postedorcancelled. Re-running it is safe.assert_reconciled(expect_reasons=...): added for #359.advanced_usage.mdandodoo_workflows.md.Deferred
account.payment,stock.picking).Test plan
tests/test_immutable.pyagainst a fake Odoo that upserts on external id. They cover the re-run identity, o2m partitioning, fail-closed abort, streaming fallback, every post-moves bucket, cancellation, and the preflight check.tests/e2e/test_posted_moves_e2e.py: 2 passed, 1 xfailed on each version.- Re-run contract: load as draft, post one move in Odoo, then re-run moves and lines. Drafts converge, the posted move and its lines are counted as
posted_immutable, and there are no duplicates.post-movesposts the rest and is a no-op on re-run.-
parent_stateis readable on all four versions.- Finding: with
check_move_validity: False, Odoo accepts a new line on a posted move, which unbalances posted books. Without the context it refuses. Theaccount.move.linerule now also guards rows whosemove_id/idormove_id/.idpoints at a posted move.- Pre-existing bug, pinned with a strict xfail: with
--o2m, continuation rows are counted asfailedand written to the fail file, although Odoo created the lines. A--failre-run would then replay them as standalone records.