fix(demos): abort the roboledger load when an event or agent write fails - #1320
Merged
Merged
Conversation
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.
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.
Summary
The second copy of the defect #1318 fixed in the scenario runner.
just demo-roboledgerloads Cascade Advisory throughexamples/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_paymentposts two linked events, so a failure between them strands an AP balance with no discharge (bill_received: 95againstbill_paid: 94in that log); a dropped invoice leaves its later payment with no obligation to discharge; and a dropped agent is quieter still, becauseagent_lookup.get()then returnsNoneand every event for that counterparty posts with noagent_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 viaDEMO_API_URL, which is exactly the configuration where the showcase episode lost 25 of 383 events while reporting success.Changes
examples/roboledger_demo/main.pyonly.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.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.pyso the two copies stay legible as the pair they are.Testing
just test-code— ruff, format, basedpyright clean.just demo-roboledgerrun end-to-end against the local stack: exit 0, no warnings, 17 agents, 317 events / 683 line items, withbill_received85 =bill_paid85 andinvoice_issued47 =payment_received47 — the balanced pairs that were asymmetric in the failing CI log.