feat(ledger): list_reports takes a lifecycle filter and returns filing_status - #222
Merged
Merged
Conversation
…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
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 API's
reportsGraphQL query now takes alifecyclefilter, and by default it leaves archived reports out (RoboFinSystems/robosystems#1519). This PR givesLedgerClient.list_reportsan optionallifecycleargument so callers can ask for archived or all reports, and addsfiling_statusto the listed reports. It matches the TypeScript client'slistReports(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.transition_filing_statusdocstring now describesfiled ↔ archived, including unarchiving withtarget_status="filed".GraphQL operation (
graphql/operations/ledger/ListLedgerReports.graphql)$lifecycle: ReportLifecycleand selectsfilingStatus. The variable is declared nullable on purpose. Declared!, ariadne-codegen made the generatedClient.list_ledger_reportsrequire 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 withARCHIVED.Regenerated (
graphql/schema.graphql,graphql/generated/,api/,models/)reports(lifecycle:)argument and theReportLifecycleenum, plus the updatedtransition-filing-statusand Tavi download descriptions (docstring-only changes inapi/andmodels/).ReportLifecycleenum,filing_statusonListLedgerReportsReportsReports, and an optionallifecycleonClient.list_ledger_reports.There is no async variant of
list_reports, so only the sync path exists.Compatibility
ADDITIVE. The generated
Client.list_ledger_reportsgains an optional parameter and the list model gains afiling_statusfield; 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. Passlifecycle="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.list_reportswith no argument sends no lifecycle variable and the query selectsfilingStatus;archived,ALLandcurrentare forwarded as their enum names.just generate-graphqlafter the operation change, so the checked-in generated code matches the operations.list_reportswith no argument,"archived"and"all"returned the expected filing statuses.🤖 Generated with Claude Code
https://claude.ai/code/session_01Jaz7hXqfysytKc57zpyWY6