API form-field contract + CI freshness check#5
Open
Alvin-Nahabwe wants to merge 1 commit into
Open
Conversation
scripts/dump_contract.py introspects the FastAPI OpenAPI schema and emits dl_api_contract.json: for every form/multipart endpoint, the exact set of accepted field names. This is the source of truth for the R client, whose drift from this contract is what took the platform down (missing key, data_zip vs data_file, weight_decay vs weight_decay_hf). A CI job regenerates the contract and fails if the committed dl_api_contract.json is stale, so it can never silently fall behind the code. The no-code-app repo vendors this file and checks its requests against it (companion PR there). Verified: generator resolves the OpenAPI $ref bodies and emits correct field sets (object-detection train = 33 fields incl. weight_decay_hf / weight_decay_yolo; upload = data_file / data_name). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
The API's half of contract enforcement between this service and the R client:
scripts/dump_contract.py— introspects the FastAPI OpenAPI schema (resolving$refbodies) and emitsdl_api_contract.json: for every form/multipart endpoint, the exact accepted field names.dl_api_contract.json— committed contract (8 endpoints; e.g./train/object-detection= 33 fields incl.weight_decay_hf/weight_decay_yolo; upload =data_file/data_name).Why
The R client drifting from this API is what broke the platform (wrong/renamed/dropped fields failing silently). The client repo vendors this file and validates its requests against it in CI (companion PR on no-code-app) — that check already caught and removed 23 dead fields the client was sending.
Flow when the API changes
python scripts/dump_contract.py > dl_api_contract.json, commit.scripts/; its CI then reports exactly which client fields need updating.🤖 Generated with Claude Code