Skip to content

Cover database upload and the remaining engine endpoints in pyvolca - #199

Merged
ccomb merged 6 commits into
mainfrom
feat/pyvolca-endpoint-coverage
Jul 13, 2026
Merged

Cover database upload and the remaining engine endpoints in pyvolca#199
ccomb merged 6 commits into
mainfrom
feat/pyvolca-endpoint-coverage

Conversation

@ccomb

@ccomb ccomb commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Why

pyvolca could query a running engine but could not feed one: there was no way to upload a database (POST /api/v1/db/upload), and a wider audit found the Python client covered 25 of the engine's ~60 HTTP endpoints. This closes the gap so a notebook can upload an archive, wire its dependencies, finalize it, and then score against it — end to end, without leaving Python.

What this adds

  • Database upload + staged lifecycleupload_database (streams an octet-stream body with the name/description query params), then get_setup, set_data_path, finalize_database, delete_database. A shared _upload helper backs every upload endpoint.
  • Analysis parity with MCPcompute_sensitivity and score_activities, both dispatched through the OpenAPI table (which gained a body= channel for spec-declared POST operations), returning the new SensitivityResult / BatchScores typed results.
  • Method collections — list / load / unload / delete / upload.
  • Reference data — the three families (flow synonyms, compartment mappings, units) behind a validated kind argument, plus the flow-synonym groups and CSV download extras.
  • Detail lookupsget_flow, get_flow_activities, get_method, get_method_factors, get_mapping_status, get_stats.

Final state

Every management endpoint keeps the existing dict-return convention and surfaces the engine's in-band {"success": false} through _require_success; analysis reads return typed dataclasses. Wire shapes were verified against src/API/Types.hs. Offline tests mock the session and assert URL / query params / streamed body / typed parsing; pyright is clean and the API-reference README block is regenerated.

Notes

  • No version bump and no manual CHANGELOG edit: the next-release section is drafted by git-cliff from these feat: commits at release time, per the CHANGELOG's own workflow note.
  • The drift test (WRAPPER_OPERATIONS vs the live OpenAPI spec) gains compute_sensitivity and score_activities; it runs where the engine binary is built.

ccomb added 6 commits July 14, 2026 00:08
Adds upload_database plus the staged-database lifecycle (get_setup,
set_data_path, finalize_database, delete_database) and a shared _upload
helper streaming an octet-stream body with the name/description query
params. Upload and finalize failures are reported in-band by the engine
(HTTP 200 with success=false), so both surface through _require_success.
Wires compute_sensitivity and score_activities through the OpenAPI
dispatcher, which gains a body= channel so spec-declared POST operations
can carry a JSON payload (until now only substitution bodies could).

Also introduces the typed result classes the newly covered endpoints
return: SensitivityResult (flattening the engine's success/error entries
per perturbation), BatchScores, and the flow/method/mapping detail types
consumed by the detail lookups added next.
…il lookups

Adds method-collection management (list/load/unload/delete/upload) and the
three reference-data families (flow synonyms, compartment mappings, units)
behind a validated kind argument, plus the flow-synonym groups and CSV
download extras, and the flow/method/mapping-status/stats detail lookups.
Uploads reuse the shared _upload helper; management failures surface
through _require_success.
Runs gen_api_md.py --write for the newly added client methods and exports
the new result dataclasses (BatchScores, FlowDetail, MappingStatus,
MethodDetail, MethodFactor, PerturbedResult, ScoredActivity,
SensitivityResult, UnmappedFlow) from the package root.
A mistyped kind was only caught at runtime by _ref_kind. Declaring
RefDataKind as a Literal lets pyright reject the typo at check time,
with the frozenset derived from the same Literal so the two cannot
drift. Runtime validation stays for untyped callers, and the alias is
exported for user annotations.
_call silently dropped an explicit body when the spec declared the
operation as GET or DELETE, so a caller of the public call() escape
hatch could believe a payload was sent when it never left the client.
Raise VoLCAError before the request instead.
@ccomb
ccomb merged commit 1cdebf2 into main Jul 13, 2026
11 checks passed
@ccomb
ccomb deleted the feat/pyvolca-endpoint-coverage branch July 13, 2026 22:43
@ccomb ccomb mentioned this pull request Jul 13, 2026
ccomb added a commit that referenced this pull request Jul 13, 2026
## Why

Cut the pyvolca release for the endpoint-coverage work in #199, which
merged with the version bump and CHANGELOG entry deliberately deferred
to release time.

## What

- `pyproject.toml`: `0.7.2` → `0.8.0`
- `CHANGELOG.md`: new `[0.8.0]` section — database upload + staged
setup, batch scoring, sensitivity, method collections, reference data,
and detail lookups. pyvolca now covers the engine's full HTTP surface.
- `README.md`: regenerated compatibility sentinel (now *pyvolca 0.8.0,
wire 2, engine ≥ v0.9.1*).

Wire format is unchanged (still 2); `REQUIRED_WIRE` and
`MIN_ENGINE_HINT` untouched. Tag `pyvolca-v0.8.0` after merge.
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