Repository navigation
Declare response models for every route; add CI; drop httpx - #1
Conversation
- fastapi.py: OfferCreated, Claimed, OfferStatus, Collected and LinkedDeviceOut response models, plus a text/event-stream response for /events. Apps' OpenAPI specs now describe pairing responses exactly, so clients (like ScribbleScan-web) can generate their types instead of writing them by hand. The JSON is unchanged: qr_url is still left out without a scan_url, and Collected keeps whatever the app put in Grant.data. - Tests: every route has a response schema; no qr_url without a scan_url (20 tests). - CI: ruff and pytest on Python 3.12 and 3.14. - Dev dependencies no longer include httpx, which is stalled; FastAPI's TestClient already uses httpx2. - Roadmap: a Postgres store (LISTEN/NOTIFY) instead of Redis, for apps that already run Postgres. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A5s1B8CvD6MoPSJZpL8ScT
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8b7d92356a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| class Collected(BaseModel): | ||
| """The grant from the app's issue_grant hook, plus whatever it put in Grant.data.""" | ||
|
|
||
| model_config = ConfigDict(extra="allow") |
There was a problem hiding this comment.
Preserve Grant.data under Pydantic v1
Apps using the still-permitted FastAPI 0.110/Pydantic v1 stack regress here: Pydantic v1 treats model_config as a normal response field and leaves its default extra policy as ignore, so /collect silently drops fields supplied through Grant.data (such as space_id) and emits a spurious model_config field. Older permitted Pydantic v1 releases also cannot import ConfigDict at all. Use the v1-compatible Config mechanism (or explicitly require Pydantic v2) before relying on this response model.
Useful? React with 👍 / 👎.
Makes pairkit's HTTP API self-describing, adds CI, and removes a stalled dependency.
What changed
fastapi.py:OfferCreated,Claimed,OfferStatus,CollectedandLinkedDeviceOut./eventsis declared astext/event-stream, listing its event names./openapi.jsonnow describes pairing responses exactly, so clients can generate their types. ScribbleScan-web currently writes these by hand.qr_urlis still left out when there's noscan_url.Collectedallows extra fields, so whatever an app puts inGrant.data(ScribbleScan'sspace_id) still comes through.qr_urlis omitted without ascan_urlhttpxremoved from the dev dependencies. It has had no stable release since December 2024, and FastAPI'sTestClientalready useshttpx2.Compatibility
Public Python API unchanged. ScribbleScan installs pairkit from
main. Once this is merged, I'll update ScribbleScan's lock so its own OpenAPI contract test also covers/v1/pair/*, and switch ScribbleScan-web to the generated types.Generated by Claude Code