You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: address copilot review + windows webhook-receiver test (PR #25)
CI fix
- `tests/test_webhooks_receiver.py::test_receiver_404s_on_unknown_path`
was failing on windows-latest with `httpx.ReadError WinError 10053`.
The receiver's do_POST returned a 404 before draining the request body
on unknown paths. On Linux/macOS that's absorbed silently; on Windows
the abrupt socket close abort the still-pending request. do_POST now
drains the body first, then branches on path.
Behavior changes
- `_post` / `_patch` now raise `TangoValidationError` when both
`json_data=` and `json=` are passed instead of silently preferring
one. Single-kwarg usage is unchanged.
- `create_webhook_endpoint(name=...)` is now **required** (was a
`DeprecationWarning` in 0.7.0 — never publicly released). The server
enforces unique(user, name), so omitting `name` returned a 400
anyway. Raising client-side gives a clear error and avoids the
wasted round-trip. Updated `test_create_endpoint_without_name_warns`
→ `..._raises`.
Docs/example fixes
- `get_psc_metrics` / `get_naics_metrics` / `get_entity_metrics`
docstrings — `period_grouping` values are "month"/"quarter"/"year"
(path-segment values), not "monthly"/"quarterly".
- `docs/API_REFERENCE.md#get_agency` — consistent `get_agency("GSA")`
example + note that the parameter accepts CGAC / FPDS / short code /
abbreviation / canonical name.
- `README.md` Quick Start — `agency.name` instead of `agency['name']`;
`get_agency()` returns an `Agency` dataclass.
- `scripts/smoke_api_parity.py` — `list_business_types(limit=1)` is
now wrapped in the `run(...)` helper so a failure there records FAIL
instead of crashing the whole script.
CHANGELOG updated to reflect the behavior changes.
Closes the open Copilot comments on PR #25.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
23
23
24
24
### Added
25
25
-`ordering` parameter on `list_forecasts`, `list_grants`, `list_subawards`, `list_gsa_elibrary_contracts`, and `list_opportunities`. Prefix with `-` for descending. Closes a parity gap with the API surface (these endpoints all accept `?ordering=` server-side).
26
-
-`create_webhook_endpoint` accepts `name=` (keyword-only). Required by the Tango API since multi-endpoint support landed; omitting it now emits a `DeprecationWarning` and will become an error in a future major version.
26
+
-`create_webhook_endpoint` accepts `name=` (keyword-only) and now **requires** it. The Tango API enforces unique `(user, name)` on endpoints; omitting `name` returns a 400 server-side, so the SDK raises `TangoValidationError` client-side instead of round-tripping. (0.7.0 — never publicly released — emitted a `DeprecationWarning` instead.)
27
27
-`update_webhook_endpoint` accepts `name=` for renaming an endpoint.
28
28
- Webhook alerts (filter subscriptions): `list_webhook_alerts`, `get_webhook_alert`, `create_webhook_alert`, `update_webhook_alert`, `delete_webhook_alert` — the canonical write surface over `/api/webhooks/alerts/`. New `WebhookAlert` dataclass exported from the top-level package.
29
29
-`resolve(name, target_type, ...)` — POST `/api/resolve/` to rank entity / organization candidates from a free-text name. Returns `ResolveResult` with `ResolveCandidate` entries (both exported).
@@ -48,7 +48,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
48
48
-`ordering` kwarg from `list_notices` and `list_protests`. The notices and protests viewsets reject every `?ordering=` value at runtime (tango#2254); the kwarg silently sent unsupported values. Other five list methods retain `ordering`.
49
49
50
50
### Fixed
51
-
-`TangoClient._post()` and `_patch()` now accept both `json_data=` (positional) and `json=` (keyword) for backward compatibility. Internal callers and docs examples that use `json=` no longer fail with `TypeError`.
51
+
-`TangoClient._post()` and `_patch()` accept both `json_data=` (positional) and `json=` (keyword) for backward compatibility. Internal callers and docs examples that use `json=` no longer fail with `TypeError`. Passing **both** now raises `TangoValidationError` rather than silently preferring one — that ambiguity would hide caller bugs.
52
+
-`get_psc_metrics` / `get_naics_metrics` / `get_entity_metrics` docstrings — `period_grouping` values are `"month"` / `"quarter"` / `"year"` (the path-segment values the API accepts), not `"monthly"` / `"quarterly"`.
53
+
-`docs/API_REFERENCE.md#get_agency` — example uses `client.get_agency("GSA")` consistently and notes the parameter accepts CGAC / FPDS / short code / abbreviation / canonical name.
54
+
-`README.md` Quick Start — `get_agency()` returns an `Agency` dataclass, so the example uses attribute access (`agency.name`) instead of `agency['name']` which would `TypeError`.
55
+
-`scripts/smoke_api_parity.py` — `list_business_types(limit=1)` is now wrapped in the `run(...)` helper so a failure on that call records FAIL instead of aborting the smoke run.
52
56
-`tango webhooks endpoints create` CLI now accepts and requires `--name` (passed through to `create_webhook_endpoint(name=...)`). Previously the option was absent, meaning the CLI could never set a custom endpoint name and every call would 400 server-side (the server enforces `unique(user, name)`).
53
57
-`WebhookAlert.query_type` and `WebhookAlert.filters` tightened from `Optional` to non-optional (`str` and `dict[str, Any]` respectively). Legacy nullable rows were purged by the tango#2275 migration; the server model and serializer guarantee non-null values for all current data. `WebhookAlert.status` narrowed from `str` to `Literal["active", "paused"]` — the server serializer produces exactly those two values.
54
58
-**Shape validator agrees with server on `naics(...)` / `psc(...)` expansions.** The client-side `ShapeParser.validate()` previously rejected the canonical `shape=naics(code,description)` form (which the server has always accepted) and also rejected the alias `shape=naics_code(code,description)`. The parser now mirrors the server's `_EXPAND_ALIASES` (introduced in Tango PR makegov/tango#2259) and rewrites `naics_code(...)` / `psc_code(...)` to their canonical `naics(...)` / `psc(...)` form at parse time. Bare scalar leaves (`shape=naics_code` / `shape=psc_code`) are left untouched and still return the raw column value, matching the server. Schemas for `Contract`, `Forecast`, `Opportunity`, `Notice`, and `Vehicle` gained explicit `naics` / `psc` expand entries backed by the existing `CodeDescription` nested model. Fixes makegov/tango#2266.
0 commit comments