Skip to content

fix(demos): abort the roboledger load when an event or agent write fails - #1320

Merged
jfrench9 merged 1 commit into
mainfrom
bugfix/roboledger-demo-abort-on-dropped-writes
Sep 1, 2026
Merged

fix(demos): abort the roboledger load when an event or agent write fails#1320
jfrench9 merged 1 commit into
mainfrom
bugfix/roboledger-demo-abort-on-dropped-writes

Conversation

@jfrench9

Copy link
Copy Markdown
Member

Summary

The second copy of the defect #1318 fixed in the scenario runner. just demo-roboledger loads Cascade Advisory through examples/roboledger_demo/main.py, which carries its own duplicate of the event and agent loops — and both swallowed a failed write into a counter and carried on.

The consequences are the ones #1318 spelled out, and the CI run that started all this demonstrated them: bill_payment posts two linked events, so a failure between them strands an AP balance with no discharge (bill_received: 95 against bill_paid: 94 in that log); a dropped invoice leaves its later payment with no obligation to discharge; and a dropped agent is quieter still, because agent_lookup.get() then returns None and every event for that counterparty posts with no agent_id — the REA linkage the demo exists to show, silently absent. The run would then close periods and materialize over the gap and still exit 0.

Locally this can never fire: RATE_LIMIT_ENABLED=false, so nothing is rejected. But this demo also runs against a deployed API via DEMO_API_URL, which is exactly the configuration where the showcase episode lost 25 of 383 events while reporting success.

Changes

examples/roboledger_demo/main.py only.

  • create_agents — raises instead of counting, naming how many agents were created first.
  • create_business_events — raises instead of counting, naming how many events were loaded first.
  • The genuine data skip (a transaction whose lines resolve to no CoA element) stays non-fatal and is now counted as unmapped, reported separately. Folding it together with API failures under "Skipped N events (missing elements or errors)" is what made the original invisible.

Both comments point at _scenario/runner.py so the two copies stay legible as the pair they are.

Testing

  • just test-code — ruff, format, basedpyright clean.
  • just demo-roboledger run end-to-end against the local stack: exit 0, no warnings, 17 agents, 317 events / 683 line items, with bill_received 85 = bill_paid 85 and invoice_issued 47 = payment_received 47 — the balanced pairs that were asymmetric in the failing CI log.
  • The abort path itself is not exercised: nothing is rejected locally with rate limiting off. It is the same code shape already reviewed in fix(demos): abort the scenario load on a failed write, and pull through client 1.13.1 #1318.

The second copy of the defect #1318 fixed in the scenario runner. This
is the `just demo-roboledger` path, which loads Cascade Advisory through
its own duplicate of the event and agent loops — both of which swallowed
a failed write into a counter and carried on.

The consequences are the ones #1318 spelled out. `bill_payment` posts
two linked events, so a failure between them strands an AP balance with
no discharge; a dropped invoice leaves its later payment with no
obligation to discharge; a dropped agent is quieter still, because
`agent_lookup.get()` then returns None and every event for that
counterparty posts with no `agent_id`. The run would then close periods
and materialize over the gap and still exit 0.

Locally this never fires — `RATE_LIMIT_ENABLED=false`, so nothing is
rejected — but the demo also runs against a deployed API via
DEMO_API_URL, which is exactly where the showcase episode lost 25 of 383
events while reporting success.

The genuine data skip (a transaction whose lines have no CoA element)
stays non-fatal and is now counted separately; folding it together with
API failures under "missing elements or errors" is what made the
original invisible.
@jfrench9
jfrench9 merged commit 7a60968 into main Sep 1, 2026
7 checks passed
@jfrench9
jfrench9 deleted the bugfix/roboledger-demo-abort-on-dropped-writes branch September 1, 2026 00:11
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