feat(sdk): P0-02 v0.1.0 — Python client MVP for Docs Feedback Protocol v0#1
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
fixyourdocs/protocol. Pydantic v2 models round-trip the three canonical example fixtures byte-for-byte;Report.create(...)is the ergonomic flat constructor, the nestedReport(agent=AgentInfo(...), report=ReportBody(...))form is also exported.Clientand asyncAsyncClientonhttpx, both context-manager aware. POST to{api_url}/v1/reportswithX-Docs-Feedback-Protocol-Version, optionalAuthorization: BearerandIdempotency-Key; retries once on 502/503/504, no auto-retry on 429.ValidationError,AuthError,OptedOutError(.since),PayloadTooLargeError(.max_bytes),PolicyRejectedError(.reason),RateLimitedError(.retry_after),ServerError, …) carrying the structured fields the spec defines for each status.pyproject0.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 venvruff check .cleanmypy src/fixyourdocsclean (strict mode, py 3.9 floor)pytest -q— expect 39 passing (models round-trip, sync client, async client, header/retry matrix)python -m buildproducesfixyourdocs-0.1.0-py3-none-any.whl+ sdistClient.send(Report.create(...))against a local mock server and confirm the POSTed JSON validates againstschema/v0/report.schema.jsonfixyourdocs==0.1.0) is a maintainer action; not in this PRImplements P0-02. Spec source: https://github.com/fixyourdocs/protocol.