Skip to content

feat(ledger): list_reports takes a lifecycle filter and returns filing_status - #222

Merged
jfrench9 merged 2 commits into
mainfrom
feature/report-lifecycle-filter
Sep 25, 2026
Merged

jfrench9 merged 2 commits into
mainfrom
feature/report-lifecycle-filter

Conversation

@jfrench9

@jfrench9 jfrench9 commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

The API's reports GraphQL query now takes a lifecycle filter, and by default it leaves archived reports out (RoboFinSystems/robosystems#1519). This PR gives LedgerClient.list_reports an optional lifecycle argument so callers can ask for archived or all reports, and adds filing_status to the listed reports. It matches the TypeScript client's listReports(graphId, { lifecycle }).

Changes

Hand-written facade (clients/ledger_client.py)

  • list_reports(graph_id, lifecycle=None) accepts "current" / "archived" / "all" (or the enum names) and forwards them upper-cased. With no argument it sends no variable, so the server's default (CURRENT) applies.
  • The transition_filing_status docstring now describes filed ↔ archived, including unarchiving with target_status="filed".

GraphQL operation (graphql/operations/ledger/ListLedgerReports.graphql)

  • Takes $lifecycle: ReportLifecycle and selects filingStatus. The variable is declared nullable on purpose. Declared !, ariadne-codegen made the generated Client.list_ledger_reports require the argument. Nullable is valid there because the server argument has its own default. Checked against a running API with the variable left out and with ARCHIVED.

Regenerated (graphql/schema.graphql, graphql/generated/, api/, models/)

  • Schema refresh from the API: the reports(lifecycle:) argument and the ReportLifecycle enum, plus the updated transition-filing-status and Tavi download descriptions (docstring-only changes in api/ and models/).
  • Generated: the ReportLifecycle enum, filing_status on ListLedgerReportsReportsReports, and an optional lifecycle on Client.list_ledger_reports.

There is no async variant of list_reports, so only the sync path exists.

Compatibility

ADDITIVE. The generated Client.list_ledger_reports gains an optional parameter and the list model gains a filing_status field; no existing call changes shape. One behavior change comes from the API rather than this package: once #1519 is deployed, list_reports(graph_id) with no argument no longer includes archived reports. Pass lifecycle="all" for the old result.

Release after #1519 is deployed. The list query now always sends reports(lifecycle: …), and an API without that argument would reject it.

Testing

  • just test-all: 595 passed, 17 skipped. ruff check and format are clean, basedpyright reports 0 errors.
  • New tests: calling list_reports with no argument sends no lifecycle variable and the query selects filingStatus; archived, ALL and current are forwarded as their enum names.
  • Ran just generate-graphql after the operation change, so the checked-in generated code matches the operations.
  • Against the local API running #1519: list_reports with no argument, "archived" and "all" returned the expected filing statuses.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Jaz7hXqfysytKc57zpyWY6

…g_status

The server's `reports` query now takes `lifecycle` (CURRENT by default,
which leaves archived reports out; ARCHIVED; ALL). `list_reports` forwards
it as an optional argument, and the list selects `filingStatus`. Additive.
The refreshed schema and REST models carry the updated
transition-filing-status copy (filed <-> archived).

Claude-Session: https://claude.ai/code/session_01Jaz7hXqfysytKc57zpyWY6
Declaring the operation variable `ReportLifecycle!` made ariadne-codegen
emit a required `lifecycle` parameter on the generated
`Client.list_ledger_reports`. A nullable variable is allowed there because
the server argument carries its own default, and the generated method
stays callable with no arguments.

Claude-Session: https://claude.ai/code/session_01Jaz7hXqfysytKc57zpyWY6
jfrench9 added a commit to RoboFinSystems/robosystems-typescript-client that referenced this pull request Sep 25, 2026
…Status (#236)

## Summary

The API's `reports` GraphQL query now takes a `lifecycle` filter, and by
default it leaves archived reports out
(RoboFinSystems/robosystems#1519). This PR gives
`LedgerClient.listReports` an optional `{ lifecycle }` so callers can
ask for archived or all reports, and adds `filingStatus` to the listed
reports. roboledger-app's Archived view and Filing column depend on
both. The Python client has the matching change in
RoboFinSystems/robosystems-python-client#222.

## Changes

**Hand-written facade** (`clients/LedgerClient.ts`)
- `listReports(graphId, { lifecycle? })`: with no option it sends no
variable, so the server's default (`CURRENT`) applies; `'ARCHIVED'` /
`'ALL'` / `'CURRENT'` are forwarded.
- Re-exports the `ReportLifecycle` type.
- The `transitionFilingStatus` doc comment now describes `filed ↔
archived`.

**GraphQL operation** (`clients/graphql/queries/ledger/reports.ts`)
- `ListLedgerReports` takes `$lifecycle` and selects `filingStatus`.

**Regenerated**
- `clients/graphql/generated/graphql.ts`: the `ReportLifecycle` type, an
optional `lifecycle` variable, and `filingStatus` on the list item.
- `sdk/`: updated `transition-filing-status` descriptions (doc comments
only).

## Compatibility

ADDITIVE. `listReports` gains an optional second argument and
`ReportListItem` gains `filingStatus`; existing calls are unchanged. One
behavior change comes from the API rather than this package: once #1519
is deployed, `listReports(graphId)` no longer includes archived reports.
Pass `{ lifecycle: 'ALL' }` for the old result.

**Release after #1519 is deployed.** The list query now always sends
`reports(lifecycle: …)`, and an API without that argument would reject
it.

## Testing

- `npm run test:all` (format check, lint, typecheck, tests, build): 338
tests passed.
- New tests: `listReports` sends no lifecycle by default and the query
carries `reports(lifecycle: $lifecycle)` and `filingStatus`; `{
lifecycle: 'ARCHIVED' }` is forwarded as a variable.
- The GraphQL types were generated from the local API running #1519. A
locally packed build was installed in roboledger-app, and the app's
typecheck and 608 tests pass against it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01Jaz7hXqfysytKc57zpyWY6
@jfrench9
jfrench9 merged commit 6e8fc75 into main Sep 25, 2026
4 checks passed
@jfrench9
jfrench9 deleted the feature/report-lifecycle-filter branch September 25, 2026 00:50
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