Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: sync to panel server v0.2.0 - #2

Merged
UltraInstinct0x merged 5 commits into
mainfrom
sync/server-2026-05
May 27, 2026
Merged

UltraInstinct0x merged 5 commits into
mainfrom
sync/server-2026-05

Conversation

@UltraInstinct0x

Copy link
Copy Markdown
Owner

Summary

Sync Python SDK to panel server API v0.2.0 with exact-byte HMAC signing and scrubber attestation support.

New/updated methods

  • PanelClient.ingest_unit(type, payload, *, pool="public", scrubber_text=None) -> dict
  • PanelClient.ingest_trace(source_agent, blob, *, trace_id=None) -> dict
  • PanelClient.get_trace(trace_id) -> dict
  • PanelClient.submit_judgment(unit_id, rater_id, choice, latency_ms, ...) -> dict
  • PanelClient._sign_hmac(raw_body: bytes) -> str
  • PanelClient._scrubber_attestation(output_hash_hex: str) -> str | None
  • Async parity in AsyncPanelClient for each method above.

Server route alignment

  • Units ingest: ~/panel/app/api/units/ingest/route.ts
  • Trace ingest: ~/panel/app/api/v1/traces/route.ts
  • Verify: ~/panel/app/api/verify/route.ts
  • Judgments: ~/panel/app/api/judgments/route.ts
  • HMAC verify path: ~/panel/lib/operator-mint.ts
  • Scrubber attestation verify path: ~/panel/lib/scrubber-attestation.ts

Scrubber attestation handling

  • Uses POST /v1/scrub when scrubber_text is provided and scrubber_secret is configured.
  • Builds panel request body with compact JSON and signs the exact bytes sent.
  • Self-signs HS256 JWT with payload {output_hash, iat, exp, jti} where exp = iat + 60.
  • Sends JWT in X-Scrubber-Attestation.

Types and docs

  • Added typed models: IngestUnitInput, IngestTraceInput, TraceStatus.
  • Updated README with sync+async examples for every new method.

Tests

  • Added/updated pytest+respx coverage for:
    • exact-byte HMAC verification on ingest requests,
    • scrubber proxy + attestation header behavior,
    • ingest trace + get trace,
    • judgments payload shape,
    • async client method parity,
    • attestation JWT claim shape.

Copilot AI review requested due to automatic review settings May 27, 2026 03:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Synchronizes the Python SDK with panel server API v0.2.0: the monolithic panel_sdk/__init__.py is broken into modules (client, rater, errors, types, _signing, _scrubber, _retry), the operator client surface is reshaped (new submit_judgment, get_trace, scrubber_url constructor arg, reworked ingest_unit/ingest_trace, removed engine_version/fetch_unit/fetch_trace), and a new RaterClient/AsyncRaterClient is exposed. HMAC signing now runs against the exact JSON bytes that are sent, and scrubber attestation is emitted as a short-lived HS256 JWT.

Changes:

  • Restructure package into modular files and bump to 0.2.0; replace verify_token path with /api/verify.
  • Rework PanelClient/AsyncPanelClient: add submit_judgment, get_trace, scrubber proxy in ingest_unit, exact-byte HMAC signing, new attestation JWT shape.
  • Replace existing tests with a new respx-based suite and rewrite the README/CHANGELOG.

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
panel_sdk/init.py Now a thin re-export façade for the new modules.
panel_sdk/client.py New sync+async client with rebuilt ingest/scrub/attestation/judgment flow.
panel_sdk/_scrubber.py New off/self-sign/proxy helpers — currently unused dead code.
panel_sdk/_signing.py Canonical JSON, HMAC, and HS256 JWT helpers.
panel_sdk/_retry.py Typed error parsing and (unused) retry/backoff helpers.
panel_sdk/errors.py PanelError, PanelRateLimitError, PanelScrubberError.
panel_sdk/rater.py New site-key-only rater client (sync + async).
panel_sdk/types.py IngestUnitInput, IngestTraceInput, TraceStatus, VerifyResult, TraceResult.
tests/test_client.py Removed (replaced by tests/test_sdk_sync.py).
tests/test_sdk_sync.py New respx tests for ingest HMAC, scrubber attestation, trace, judgment, async parity.
README.md Expanded with sync+async examples for the new method surface.
CHANGELOG.md New v0.2.0 entry (does not accurately describe shipped code).
pyproject.toml Version bump to 0.2.0.
.pr_body.md Mirror of the PR description committed to the repo.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread panel_sdk/_scrubber.py Outdated
Comment thread CHANGELOG.md Outdated
Comment thread panel_sdk/client.py Outdated
Comment thread panel_sdk/client.py
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.

2 participants