Skip to content

docs: document failed shell-script jobs and servicekit 2.0 CRUD semantics - #97

Merged
mortenoh merged 1 commit into
mainfrom
docs/servicekit-2-behavior
Sep 6, 2026
Merged

mortenoh merged 1 commit into
mainfrom
docs/servicekit-2-behavior

Conversation

@mortenoh

@mortenoh mortenoh commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Documentation-only follow-up to #96 and the servicekit 2.0.0 upgrade. No code changes.

Failed shell scripts now fail the job (docs/guides/shell-runner-contract.md, docs/guides/ml-workflows.md)

The guides described a non-zero train/predict exit code as producing a completed job whose artifact carried status: failed metadata. Since #96 the diagnostic artifact is still stored — under the artifact id the $train / $predict 202 response returned, with metadata.status, exit_code, stdout, stderr — and then the job fails, with artifact_id: null, an error of the form train script failed with exit code N; diagnostic artifact <ulid> holds the workspace, stdout and stderr; stderr tail: ..., and an error_traceback. Both guides now say so, with corrected example JSON, and the shell-runner contract gains a "Debugging a failed run" walkthrough (fetch job -> read error -> fetch diagnostic artifact -> download workspace). Also noted: a predict script that exits 0 without writing predictions.csv still raises and has no diagnostic artifact, and the predict failure artifact is an ml_prediction_workspace at level 1 under the training artifact.

servicekit 2.0.0 CRUD semantics (docs/guides/configuration-management.md, docs/guides/artifact-storage.md)

Both guides described POST without saying what happens for an existing id. Added, next to each endpoint: POST is create-only and a duplicate id returns 409 as application/problem+json (with a curl example showing the real body); PUT is the update path and applies only the fields sent, with an explicit null clearing a nullable field; list endpoints take page (>= 1) and size (1-100) together, return 422 outside those bounds, and are ordered by id. The old "default: 1 / default: 50" query-parameter text was wrong — pagination is opt-in, and supplying only one of the two returns the plain unpaginated list. The artifact guide also notes that a failed database constraint (e.g. an unknown parent_id) returns 409 with the generic detail "Entity violates a database constraint" from servicekit 2.0.1 onward.

Checked, no change needed

  • No stale {"detail": "..."} error bodies for chapkit routes anywhere in docs/ or README.md.
  • Train/predict examples across the guides already match src/chapkit/ml/schemas.py (config_id + data for train; artifact_id + historic + future for predict; DataFrame as {columns, data}). The scaffolded-README mistakes fixed in fix: fail jobs on failing shell scripts, emit problem details, correct scaffolded README #96 were not mirrored in the guides.
  • No occurrences of set_scheduler, set_database, get_scheduler(), get_database(), AIOJobScheduler, JobScheduler, _sema, or exclude_none in docs/ or README.md.

Test plan

  • make lint — ruff format + check + ty, clean
  • make test — 861 passed, 3 skipped
  • uv run mkdocs build --strict — clean; the two new cross-reference anchors (#failed-script-runs, #debugging-a-failed-run) verified present in the built HTML
  • Behavior verified against the worktree venv (servicekit 2.0.0): live 409 problem+json body for a duplicate config id, 422 for page=0 and size=200, plain list for page alone, and tests/test_ml_failed_script_jobs.py for the failed-job shape

…tics

Shell-runner contract and ML workflows now describe the post-#96 behavior:
a non-zero train or predict exit code stores the diagnostic workspace
artifact under the id from the 202 response and then fails the job, with
the artifact id carried in the job error rather than in artifact_id.
Adds a "Debugging a failed run" walkthrough.

Config and artifact guides note that POST is create-only (409 problem
details on a duplicate id), that PUT is the update path applying only the
fields sent, and that pagination is opt-in with page >= 1 and size 1-100.
@codecov

codecov Bot commented Sep 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mortenoh
mortenoh merged commit 04a20ab into main Sep 6, 2026
5 checks passed
@mortenoh
mortenoh deleted the docs/servicekit-2-behavior branch September 6, 2026 17:58
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.

1 participant