Commit 188a074
authored
feat(decisions): add list_decisions method [skip-runtime-e2e] (#186)
* feat(decisions): add list_decisions client method (#1982)
Python SDK piece of the 5-SDK γ fanout for axonflow-enterprise#1982.
Companion to explain_decision; both implement the ADR-043 decision
record contract with the same parity discipline.
## Added
- AxonFlow.list_decisions(opts: ListDecisionsOptions | None) ->
list[DecisionSummary] hitting GET /api/v1/decisions.
- DecisionSummary (pydantic, extra='ignore') — slim 5-field row.
policy_id + tool_signature are Optional because pre-α1 audit rows
+ dynamic-only blocks may not populate them.
- ListDecisionsOptions — every filter Optional[X]=None; None values
omitted from the URL so the platform applies tier defaults.
- Extended exceptions.RateLimitError with new optional kwargs
(limit_type, tier, upgrade) plus a new UpgradeInfo type. Backwards
compatible — existing daily-quota callers keep their signature.
- _build_list_decisions_query helper at module scope (testable in
isolation; used by list_decisions).
- examples/list_decisions.py — operator example mirroring
examples/quickstart.py shape; surfaces RateLimitError.upgrade.
## Tests
10 new contract tests in tests/test_decisions.py:
- DecisionSummaryShape (minimum + full + extra-fields-ignored)
- happy path (3-row payload)
- filter serialization (every filter lands in URL)
- empty/partial options omit None fields
- 429 → RateLimitError with parsed envelope
- 429 with malformed body → RateLimitError without upgrade context
(never silently succeed)
- 401 surfaces as AxonFlowError
- forward-compat — additive unknown fields on summaries + envelope
- _build_list_decisions_query unit (None / empty / partial)
pytest tests/test_decisions.py: 23 passed (including the 13 pre-existing).
## Runtime-e2e proof
Against setup-e2e-testing.sh enterprise stack on
axonflow-enterprise@feat/decisions-list-endpoint:
$ source /tmp/axonflow-e2e-env.sh
$ AXONFLOW_LIST_LIMIT=5 python examples/list_decisions.py
=== Recent decisions (2) ===
2026-05-07T14:13:38.464545+00:00 deny f6029a9b-... policy=- tool=-
2026-05-07T14:13:38.453107+00:00 deny 2575a3fe-... policy=- tool=-
⛔ Do not merge — V1.1 release window.
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
* fix(lint): drop Greek session labels + fix line-length + var name (#1982)
Ruff trips:
- RUF002/RUF003 on Greek-letter session labels (α1, γ) in docstrings
and comments. Replace with plain "list_decisions" / "pre-V1.1".
- E741 ambiguous variable `l` in examples/list_decisions.py — rename
to `lim`.
- E501 long lines on the 429 envelope wording in tests + example.
Wrap into parenthesized string concatenation.
23 unit tests still green.
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
* fix(lint): refresh falsey-clobber baseline + harden 429 envelope parse (#1982)
CI's falsey-clobber lint compares findings against a baseline keyed by
absolute line numbers. Inserting list_decisions (~106 lines) shifted
every pre-existing pattern below it down by the same amount; the
linter therefore reported 18 NEW findings + 18 stale baseline entries
(same set, different lines).
This commit:
- Refreshes .lint_baselines/falsey_clobber.json so the existing
patterns are recognised at their new line numbers (no behaviour
change — same 18 patterns, same files; only positions updated).
- Rewrites the new list_decisions 429 path to use `is None` /
isinstance() guards instead of `or` fallbacks, so the new code
contributes ZERO falsey-clobber findings to the baseline. Behaviour
is identical: missing/non-string error -> "rate limit exceeded";
missing/non-numeric limit/remaining -> 0; non-list decisions -> [].
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
* fix(lint): apply ruff format to list_decisions 429 path (#1982)
Ruff formatter wanted the conditional remaining=... expression on a
single line; my hand-formatted multi-line version triggered
`ruff format --check` failure in CI. Behaviour is unchanged — only
whitespace normalised.
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
* fix(lint): re-refresh falsey-clobber baseline after ruff reformat (#1982)
Ruff formatter collapsed a 3-line conditional in
list_decisions onto a single line, shifting line 6208's
`executions or []` pattern up to line 6206. The previous
baseline refresh keyed it to :6208; refresh again so the
post-format positions match.
No behaviour change. Same 65 pre-existing findings, same files;
only positions adjusted.
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>
---------
Signed-off-by: Saurabh Jain <saurabhjain1592@gmail.com>1 parent f8efb15 commit 188a074
6 files changed
Lines changed: 580 additions & 22 deletions
File tree
- .lint_baselines
- axonflow
- examples
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
88 | 92 | | |
89 | 93 | | |
90 | 94 | | |
| 95 | + | |
91 | 96 | | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
385 | 391 | | |
386 | 392 | | |
387 | 393 | | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
388 | 423 | | |
389 | 424 | | |
390 | 425 | | |
| |||
2737 | 2772 | | |
2738 | 2773 | | |
2739 | 2774 | | |
| 2775 | + | |
| 2776 | + | |
| 2777 | + | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
| 2833 | + | |
| 2834 | + | |
| 2835 | + | |
| 2836 | + | |
| 2837 | + | |
| 2838 | + | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
| 2848 | + | |
| 2849 | + | |
| 2850 | + | |
| 2851 | + | |
| 2852 | + | |
| 2853 | + | |
| 2854 | + | |
| 2855 | + | |
| 2856 | + | |
| 2857 | + | |
| 2858 | + | |
| 2859 | + | |
| 2860 | + | |
| 2861 | + | |
| 2862 | + | |
| 2863 | + | |
| 2864 | + | |
| 2865 | + | |
| 2866 | + | |
| 2867 | + | |
| 2868 | + | |
| 2869 | + | |
| 2870 | + | |
| 2871 | + | |
2740 | 2872 | | |
2741 | 2873 | | |
2742 | 2874 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
12 | | - | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
45 | 73 | | |
46 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
47 | 81 | | |
48 | 82 | | |
49 | 83 | | |
50 | 84 | | |
51 | 85 | | |
52 | 86 | | |
53 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
54 | 92 | | |
55 | 93 | | |
56 | 94 | | |
57 | | - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
58 | 102 | | |
59 | 103 | | |
60 | 104 | | |
61 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
62 | 109 | | |
63 | 110 | | |
64 | 111 | | |
| |||
0 commit comments