Skip to content

feat: add reconciliations to the ledger facade - #228

Merged
jfrench9 merged 2 commits into
mainfrom
feature/reconciliation-facade
Oct 2, 2026
Merged

jfrench9 merged 2 commits into
mainfrom
feature/reconciliation-facade

Conversation

@jfrench9

@jfrench9 jfrench9 commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds reconciliations to the ledger facade, so a script or an agent can list them, run them, record a statement balance, change a block's policy and sign a period off. Regenerated against robosystems main (ed9f4cf2), which carries the reconciliation surface from robosystems #1646, #1649, #1652, #1653 and booked_on from #1655. The TypeScript twin is robosystems-typescript-client #243.

Release order: cut the client release only after the robosystems release that contains #1652 and #1653 is deployed. list_reconciliations selects GraphQL fields that only exist from that release (ledgerBalance, independentBalance, balanceAsOf, components, notes), so the query fails validation against an older server. Merging is safe at any time, and no existing method is affected: the two fields added to the fiscal calendar query are already served.

Changes

Facade (clients/ledger_client.py), stable tier, additive

  • list_reconciliations(graph_id, period): every reconciliation block's standing for a period.
  • preview_reconciliations(graph_id, period, *, method, include_tied): one comparison, nothing recorded.
  • refresh_reconciliations(graph_id, period): run every check that applies and record the results. notes names a check that could not run.
  • record_statement_balance(graph_id, *, element_id, as_of, balance, document_id, note).
  • set_reconciliation_policy(graph_id, structure_id, *, required_for_close, materiality, review_required, separate_reviewer): an omitted field keeps its value.
  • sign_off_reconciliation(graph_id, structure_id, period, note).
  • close_period takes allow_unreconciled_accounts; create_schedule takes booked_on.
  • get_fiscal_calendar carries unreconciled_account_count and unreconciled_account_sample.
  • download_report_bundle now defaults to the holon (format="holon-jsonld"), which carries the whole report. Pass format="tavi" for the compiled model.

GraphQL

  • operations/ledger/ListLedgerReconciliations.graphql (new); GetLedgerFiscalCalendar.graphql selects the two unreconciled-account fields. schema.graphql refreshed and generated/ regenerated from it.

Generated tier (api/, models/)

  • Five new operations: preview_reconciliations, refresh_reconciliations, record_statement_balance, set_reconciliation_policy, sign_off_reconciliation, with their request and response models.
  • allow_unreconciled_accounts on the close and backfill requests; reconciliation as a block type; ReconciliationMechanics; booked_on on the schedule metadata request.
  • The sync path is what the facade uses; the generated async functions come with the regeneration and were not exercised.

Compatibility

ADDITIVE, plus one facade default that moved: download_report_bundle returns the holon unless a format is named. A caller that relied on the default now gets a different file and passes format="tavi" to keep the old one. That rides this minor and belongs in the release notes.

Otherwise: new facade methods, two new optional keyword arguments, and new generated operations and models. I compared the emitted models: no file was deleted, and no field was removed or became required. The only removed lines are docstrings. A minor.

Testing

  • just test-all: 609 passed, 17 skipped; format, lint and typecheck clean.
  • Twelve new facade tests: the read and its variables, a graph with no ledger, the request body of each write (including that unset options are left off), an unknown check being refused, a refusal carrying the server's response, and the two new options on close_period and create_schedule.
  • Regenerated against a local stack serving robosystems main; booked_on and the reconciliation operations were confirmed present in its /openapi.json first. An earlier regeneration in this checkout had run against a stale stack and lacked booked_on; it was redone.
  • Not run against a deployed server.

🤖 Generated with Claude Code

https://claude.ai/code/session_01N4VGnvrpE2cwbBZykz4yGd

Regenerated against the current API, then on `LedgerClient`:

- `list_reconciliations` reads every reconciliation's standing for a
  period.
- `preview_reconciliations`, `refresh_reconciliations`,
  `record_statement_balance`, `set_reconciliation_policy` and
  `sign_off_reconciliation` call the matching operations.
- `close_period` takes `allow_unreconciled_accounts`, and
  `create_schedule` takes `booked_on`.
- `get_fiscal_calendar` carries the unreconciled-account count and
  sample.

Claude-Session: https://claude.ai/code/session_01N4VGnvrpE2cwbBZykz4yGd
The holon carries the whole report; the Tavi has no home for the
Information Block payloads, definition arcs, framework pins or filing
lifecycle. Pass format="tavi" for the compiled model.
@jfrench9
jfrench9 marked this pull request as ready for review October 2, 2026 04:57
@jfrench9
jfrench9 merged commit 1100376 into main Oct 2, 2026
4 checks passed
@jfrench9
jfrench9 deleted the feature/reconciliation-facade branch October 2, 2026 05:01
jfrench9 added a commit that referenced this pull request Oct 2, 2026
## Summary

Regenerate against the current API so the checked-in GraphQL schema and
models carry its descriptions. Two API changes reach the text: report
downloads now describe the holon as the stamped anchor and the default
format (robosystems#1658), and a reconciliation's `status` gains `stale`
and drops `explained` (robosystems#1657).

## Changes

- `robosystems_client/graphql/schema.graphql` (generated): the
`reportDownloadUrl` field, its `format` argument and
`ReportBundleDownload` describe the holon as stamped at publish and the
default, with the Tavi and XBRL built on first download.
`ReconciliationSummary.status` lists `not_started`, `stale`,
`unreconciled`, `reconciled`, `reviewed`.
- `robosystems_client/models/reconciliation_summary.py` (generated): the
same `status` docstring.

No hand-written facade code changes; the facade's download default
already moved to `holon-jsonld` in #228.

## Compatibility

INTERNAL. Descriptions only: no export, signature or model field
changes. `status` stays a plain string. The values the API returns
change server-side (`stale` added, `explained` removed), so code that
branches on `explained` should handle `stale` once the server release
with robosystems#1657 is deployed. Prod does not have it yet, so this
should ship in the next client minor after that deploy.

## Testing

Regenerated by hand against a local API running robosystems#1658 on top
of `main`. The pre-commit hook ran the test suite: 609 passed, 17
skipped.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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