Skip to content

release(0.13.1): drift-fixes — B1 check_v3 + B3 chain_end + M3 approximate_budget + B2 track_single docstring#55

Merged
maltsev-dev merged 2 commits into
masterfrom
release/0.13.1
Jul 5, 2026
Merged

release(0.13.1): drift-fixes — B1 check_v3 + B3 chain_end + M3 approximate_budget + B2 track_single docstring#55
maltsev-dev merged 2 commits into
masterfrom
release/0.13.1

Conversation

@maltsev-dev

Copy link
Copy Markdown
Member

release(0.13.1): drift-fixes — closes 4 BLOCKERs from drift.md 2026-07-04

Drift audit docs/drift.md (2026-07-04) found four BLOCKER items still active in 0.13.0 SDK vs backend wire contract. All four are closed in this release.

What changed

ID File Fix
B1 src/nullrun/transport.py Transport.check_v3 was POSTing to /api/v1/check (removed 2026-06-27 — returns 410 Gone with replacement: /api/v1/gate). Now delegates to Transport.check which targets /api/v1/gate and forwards all v3 wire fields (chain_id, chain_op, idempotency_key, stream). check() is the canonical entry; check_v3 kept as a v3-named alias for backward compat.
B2 src/nullrun/transport.py + tests/test_v3_wire_contract.py Transport.track_single docstring + test_track_single_includes_protocol_header body described a fictitious wire shape {execution_id, actual_cost_cents, api_key_id, cost_source}. Real TrackRequestRaw is {workflow_id, tokens, cost_cents, ...} (built by runtime._build_v3_track_payload) — execution_id is replaced by reservation_id, SDK always emits cost_cents: 0 (backend recomputes from tokens), api_key_id is derived server-side. Docstring + test now match the real contract.
B3 src/nullrun/transport.py Transport.chain_end was POSTing to /api/v1/chain/end (never registered on backend — backend/src/proxy/http/routes.rs has zero matches). Now POSTs to /api/v1/gate with chain_op: "end" (matches the documented backend contract from backend/src/proxy/http/cancel.rs:39's own comment).
M3 src/nullrun/transport.py Transport.approximate_budget was appending ?organization_id=<id>. Backend's approximate_budget_handler (backend/src/proxy/http/budget.rs:130-145) resolves the org from the X-API-Key / Authorization header — does NOT accept a query parameter. Method now calls the bare URL. organization_id arg retained as accepted-but-unused for backward compat.
housekeeping .gitignore Exclude docs/postman/ — working artifacts (Postman collection + environments), not part of the SDK source surface.

Diff scope

Backwards compatibility

  • No SDK_MIN_VERSION bump — wire format unchanged from the caller's perspective; only URLs + docstrings changed
  • check_v3() retained as alias for check() — existing call sites keep working
  • organization_id arg on approximate_budget retained (silently no-ops now)
  • Recommended upgrade path: 0.13.0 -> 0.13.1

Tests

  • tests/test_v3_wire_contract.py — 53/53 pass (re-mocked against /api/v1/gate, body shape pinned to real TrackRequestRaw)
  • No regression in full lib test suite (1037 tests, last full run)

…imate_budget + B2 track_single docstring

Drift audit 2026-07-04 (docs/drift.md) found 4 BLOCKERs still active
in 0.13.0 SDK vs backend wire contract. All four closed:

  * B1: Transport.check_v3 (drift B1) — was POSTing to /api/v1/check
    (removed 2026-06-27, returns 410 Gone with replacement=/api/v1/gate).
    Now delegates to Transport.check which targets /api/v1/gate and
    forwards all v3 wire fields (chain_id, chain_op, idempotency_key,
    stream). check() is the canonical entry; check_v3 is kept as a
    v3-named alias for backward compat.

  * B2: Transport.track_single docstring + test body — described
    fictitious wire shape {execution_id, actual_cost_cents, api_key_id,
    cost_source}. Real TrackRequestRaw is {workflow_id, tokens,
    cost_cents, ...} (built by runtime._build_v3_track_payload) —
    execution_id is replaced by reservation_id, SDK always emits
    cost_cents:0 (backend recomputes from tokens), api_key_id is
    derived server-side. Docstring + test now match real contract.

  * B3: Transport.chain_end (drift B3) — was POSTing to /api/v1/chain/end
    (never registered on backend). Now POSTs to /api/v1/gate with
    chain_op: "end" (matches documented backend contract).

  * M3: Transport.approximate_budget (drift M3) — was appending
    ?organization_id=<id>. Backend resolves org from X-API-Key /
    Authorization header, does NOT accept query params. Method now
    calls bare URL. organization_id arg retained as accepted-but-
    unused for backward compat.

Tests touched (tests/test_v3_wire_contract.py):
  * test_check_v3_includes_protocol_header — re-mocked /api/v1/gate
  * test_check_v3_accepts_chain_context — re-mocked /api/v1/gate
  * test_chain_end_includes_protocol_header — re-mocked /api/v1/gate
    + added chain_op=end check
  * test_chain_end_sends_chain_id_in_body — re-mocked /api/v1/gate
    + added chain_op=end check
  * test_track_single_includes_protocol_header — body matches real
    wire shape

1037 lib tests pass (no regression). No SDK_MIN_VERSION bump —
wire format unchanged from caller's perspective; only URLs +
docstrings changed. Recommended upgrade path: 0.13.0 -> 0.13.1.
The Postman collection + environments were exported under docs/postman/
for ad-hoc local API exploration. They are working artifacts, not part
of the SDK source surface — keeping them on disk but out of VCS.
@codecov

codecov Bot commented Jul 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@maltsev-dev maltsev-dev merged commit 393d7a8 into master Jul 5, 2026
5 checks passed
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