Skip to content

Align deep-learning client with the API contract - #173

Open
Alvin-Nahabwe wants to merge 16 commits into
mainfrom
fix/dl-client-contract
Open

Align deep-learning client with the API contract#173
Alvin-Nahabwe wants to merge 16 commits into
mainfrom
fix/dl-client-contract

Conversation

@Alvin-Nahabwe

Copy link
Copy Markdown
Contributor

Summary

The R deep-learning client and the FastAPI service have drifted apart — they were written against different versions of the same contract, and nothing catches the mismatch. Three of those mismatches make calls fail outright against the current API:

What the client sends What the API expects Result
(no auth header) X-API-Key on train/upload 403
data_zip=@file data_file=@file 422
weight_decay=… (obj. detection) weight_decay_hf=… silently ignored, default used

Changes

  • Added an env-configurable dl_request() helper that attaches X-API-Key to every state-changing call (train ×3, upload, inference ×3). DL_API_URL and DL_API_KEY default to the current values, so this is a no-op against an API that doesn't check the key — it only fixes things once the key is enforced.
  • Corrected the upload field to data_file and the object-detection field to weight_decay_hf.
  • Fixed an observer leak: once a job finished, the Training History poller registered a brand-new observeEvent on every 3-second tick, accumulating observers for the life of the session. It now bumps the refresh trigger directly.
  • Resolved unresolved merge-conflict markers committed in .gitignore, keeping venv/ and making the static_files rule coherent so the tracked labelling file stays exempt.

GET endpoints (/models/list, /data/list, /status, /metrics, /jobs/list, /checkpoints) are unauthenticated in the API and deliberately left without the header.

Verification

parse() passes on the changed file. The app was not run — no R server was available in the audit environment. Please exercise upload → train → infer against the API before merging.

Follow-ups (not in this PR)

  • The client still ships a complete, dead ASR task (panels, /train/asr, registry lookup, inference) targeting endpoints that no longer exist. Removal is tracked separately.
  • The root cause is the absence of an enforced contract. A follow-up will validate the client's fields against the API's OpenAPI schema in CI so this class of bug fails the build instead of production.

🤖 Generated with Claude Code

damiancodes and others added 16 commits July 3, 2026 00:29
  model training

  - Add all caret job queue label keys
Add async caret job queue with concurrent
The R client and the FastAPI service were written against different
versions of the same contract, and nothing catches the mismatch. Three
of those mismatches make calls fail outright:

- Training and upload endpoints require an X-API-Key header, which the
  client never sent. Added an env-configurable dl_request() helper that
  attaches the key to every state-changing call. DL_API_URL and
  DL_API_KEY default to the current values, so behaviour is unchanged
  against an API that does not check the key.
- Dataset upload posted the file as `data_zip`; the endpoint requires
  `data_file`, so uploads were rejected as unprocessable.
- Object detection posted `weight_decay`; the endpoint expects
  `weight_decay_hf`, so the user's weight-decay setting was silently
  discarded and the default used instead.

Also:

- The Training History poller registered a new observeEvent on every
  three-second tick once a job finished, accumulating observers for the
  life of the session. It now bumps the refresh trigger directly.
- .gitignore contained unresolved merge-conflict markers. Resolved them,
  keeping venv/ and making the static_files rule coherent so the tracked
  labelling file is still exempt.

Verified with parse() on the changed file. The app itself was not run:
no R server was available.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

3 participants