Skip to content

feat(sdk): P0-02 v0.1.0 — Python client MVP for Docs Feedback Protocol v0#1

Merged
mstopa merged 1 commit into
mainfrom
feat/p0-02-sdk-mvp
May 24, 2026
Merged

feat(sdk): P0-02 v0.1.0 — Python client MVP for Docs Feedback Protocol v0#1
mstopa merged 1 commit into
mainfrom
feat/p0-02-sdk-mvp

Conversation

@mstopa
Copy link
Copy Markdown
Contributor

@mstopa mstopa commented May 23, 2026

Summary

  • Reference Python SDK implementing the locked v0 wire format from fixyourdocs/protocol. Pydantic v2 models round-trip the three canonical example fixtures byte-for-byte; Report.create(...) is the ergonomic flat constructor, the nested Report(agent=AgentInfo(...), report=ReportBody(...)) form is also exported.
  • Sync Client and async AsyncClient on httpx, both context-manager aware. POST to {api_url}/v1/reports with X-Docs-Feedback-Protocol-Version, optional Authorization: Bearer and Idempotency-Key; retries once on 502/503/504, no auto-retry on 429.
  • Non-2xx responses raise typed exceptions (ValidationError, AuthError, OptedOutError(.since), PayloadTooLargeError(.max_bytes), PolicyRejectedError(.reason), RateLimitedError(.retry_after), ServerError, …) carrying the structured fields the spec defines for each status.
  • Tooling: pyproject 0.1.0 with httpx + pydantic v2 runtime deps and pytest / respx / mypy / ruff dev extras; CI matrix py 3.9–3.13 with ruff + mypy strict + pytest + wheel build on py 3.12.

Test plan

  • pip install -e ".[dev]" in a clean venv
  • ruff check . clean
  • mypy src/fixyourdocs clean (strict mode, py 3.9 floor)
  • pytest -q — expect 39 passing (models round-trip, sync client, async client, header/retry matrix)
  • python -m build produces fixyourdocs-0.1.0-py3-none-any.whl + sdist
  • Smoke a real Client.send(Report.create(...)) against a local mock server and confirm the POSTed JSON validates against schema/v0/report.schema.json
  • PyPI publish (fixyourdocs==0.1.0) is a maintainer action; not in this PR

Implements P0-02. Spec source: https://github.com/fixyourdocs/protocol.

Implements the P0-02 MVP for the reference Python SDK.

Wire format
- Pydantic v2 models mirroring schema/v0/report.schema.json (Report,
  ReportBody, AgentInfo, Evidence, TaskContext) with length/pattern/
  enum constraints and extra="forbid" matching additionalProperties:
  false. Round-trips the three canonical example fixtures
  byte-for-byte.
- Report.create(...) is the ergonomic flat constructor; the typed
  nested form (Report(agent=AgentInfo(...), report=ReportBody(...)))
  is also exported.

Transport
- Client (sync) and AsyncClient (async) built on httpx; both are
  context-manager aware and accept an httpx transport override for
  testing.
- POSTs to {api_url}/v1/reports with X-Docs-Feedback-Protocol-Version,
  optional Authorization: Bearer and Idempotency-Key, retry once on
  502/503/504, no auto-retry on 429.
- Non-2xx responses raise typed exceptions (ValidationError,
  AuthError, OptedOutError, PayloadTooLargeError, PolicyRejectedError,
  RateLimitedError, ServerError, …) carrying the structured fields
  the spec defines for each status.

Tooling
- pyproject: 0.1.0, deps httpx + pydantic v2, dev extras pytest /
  respx / mypy / ruff. Ruff configured, mypy strict, asyncio mode
  auto.
- 39 tests covering models, sync client, and async client (incl.
  fixture round-trip, header presence, retry behaviour).
- GitHub Actions CI: matrix py 3.9–3.13 on ubuntu, ruff + mypy +
  pytest, wheel build on py 3.12.

py.typed marker shipped so the package exposes its type information.

Signed-off-by: mstopa <m.stopa94@gmail.com>
@mstopa mstopa merged commit 20788fd into main May 24, 2026
6 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 24, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant