Repository navigation
Commit 9a14079
authored
feat(ledger): download a report as a DataBook (#312)
## Summary
The API gains a DataBook download format for a published report: the
report's holon as a Markdown document a person reads, each value linked
to its fact. `download_report_bundle` now takes it.
**Waits on the server.** The format is served by the backend change in
RoboFinSystems/robosystems#2130, which is in the release after v1.24.3.
Against an API without it, `format="databook"` is rejected by the
schema; every other format is unaffected. Twin PR in
robosystems-typescript-client: `feature/databook-download-format`.
## Changes
**Hand-written facade (`robosystems_client/clients/ledger_client.py`)**
- `download_report_bundle(format="databook")` (or `"DATABOOK"`) maps to
the `DATABOOK` enum value, and a download with no server-suggested
filename is named `.databook.md` rather than falling through to
`.tavi.json`. The docstring describes the format. This method is
synchronous only; there is no async counterpart to cover.
**Regenerated**
- Against a local API build that adds the format: the checked-in
`schema.graphql` and `graphql/generated/enums.py` gain
`ReportDownloadFormat.DATABOOK`, and two descriptions change. The
OpenAPI regeneration produced no change to `api/` or `models/`.
**Tests**
- `test_databook_download_takes_the_short_alias`: the enum sent, the
format and content type returned, the fallback filename, and the bytes
written to disk.
## Compatibility
ADDITIVE. One enum value added to the generated tier
(`ReportDownloadFormat`), and one more accepted value for an existing
facade argument. No signature, model field or default changes. I
compared the emitted models: the only generated diff is the added enum
member and the two descriptions. A client minor.
## Testing
`just test-all`: 758 passed, 17 skipped; format, lint and typecheck
clean.
Regeneration ran in-session against a local API on the branch that adds
the format (`just generate-sdk`, then `just generate-graphql`).
Run by hand against that local API: `download_report_bundle(graph_id,
report_id, format="databook", to=...)` returned a 37 KB `text/markdown;
charset=utf-8` document named `<report>-g2.databook.md`, and the SHA-256
it states for its holon equals the hash of the holon downloaded for the
same report through the same facade.
Not run: `just build-package` (no packaging change).
🤖 Generated with [Claude Code](https://claude.com/claude-code)4 files changed
Lines changed: 44 additions & 10 deletions
File tree
- robosystems_client
- clients
- graphql
- generated
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
796 | 796 | | |
797 | 797 | | |
798 | 798 | | |
| 799 | + | |
799 | 800 | | |
800 | 801 | | |
801 | 802 | | |
| |||
3833 | 3834 | | |
3834 | 3835 | | |
3835 | 3836 | | |
3836 | | - | |
3837 | | - | |
3838 | | - | |
| 3837 | + | |
| 3838 | + | |
| 3839 | + | |
3839 | 3840 | | |
3840 | 3841 | | |
3841 | 3842 | | |
| |||
3846 | 3847 | | |
3847 | 3848 | | |
3848 | 3849 | | |
3849 | | - | |
3850 | | - | |
3851 | | - | |
| 3850 | + | |
| 3851 | + | |
| 3852 | + | |
| 3853 | + | |
| 3854 | + | |
| 3855 | + | |
3852 | 3856 | | |
3853 | 3857 | | |
3854 | 3858 | | |
| |||
3896 | 3900 | | |
3897 | 3901 | | |
3898 | 3902 | | |
| 3903 | + | |
3899 | 3904 | | |
3900 | 3905 | | |
3901 | 3906 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
780 | 780 | | |
781 | 781 | | |
782 | 782 | | |
783 | | - | |
784 | | - | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
| |||
4580 | 4581 | | |
4581 | 4582 | | |
4582 | 4583 | | |
4583 | | - | |
4584 | | - | |
| 4584 | + | |
| 4585 | + | |
4585 | 4586 | | |
4586 | 4587 | | |
4587 | 4588 | | |
| |||
4614 | 4615 | | |
4615 | 4616 | | |
4616 | 4617 | | |
| 4618 | + | |
4617 | 4619 | | |
4618 | 4620 | | |
4619 | 4621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3286 | 3286 | | |
3287 | 3287 | | |
3288 | 3288 | | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
3289 | 3315 | | |
3290 | 3316 | | |
3291 | 3317 | | |
| |||
0 commit comments