Add POST /simulations/runs listing endpoint + convergence plan#48
Merged
Conversation
Implements the runs listing endpoint (backend, full persist + query) from
docs/simulation-runs-api-plan.md:
- SimulationRunRecord persisted in a new BiosimSimulationRuns collection,
written per (submission x simulator) on POST /simulations/run and updated
to SUCCEEDED/FAILED by SimulationRunWorkflow via update_run_status_activity.
- POST /simulations/runs: owner-scope (type all|user), pagination, sorting,
filtering; returns { runs, pagination: { page, perPage, _total } }.
- SimulationRunDatabaseService (+ Mongo impl), DI wired via lazy import to
avoid the simulations->dependencies import cycle.
- Deferred fields (cpus/memory/maxTime/envVars/purpose/runtime/sizes) default
to 0/[] until sourced upstream; no real auth (owner-scope trusts email).
Also fixes a latent test-isolation bug: the shared database_service_mongo
fixture now cleans BiosimSims on teardown, preventing the real-network
test_sim_workflow from leaking a record that gave later tests a spurious
cache hit.
Adds docs/simulation-runs-convergence-plan.md describing how to converge the
duplicate run-execution paths (reuse OmexSimWorkflow as the per-run unit,
normalize SimulationRunRecord to FK into BiosimulatorWorkflowRun, re-expose
cache_buster), sequenced as independently shippable PRs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jcschaff
added a commit
that referenced
this pull request
May 29, 2026
Restores parity with /verify/omex, which exposes a cache_buster salt for the (omex, simulator, cache_buster) result cache. The run endpoint had hardcoded "0", silently forcing dedup across all submissions. - RunSimulationRequest.cache_buster (optional); the router forwards it to the workflow input and persists it on SimulationRunRecord. Default "0" preserves the current dedup behavior; a caller-supplied salt forces fresh runs. - Tests: an explicit salt is forwarded to the workflow input; omitting it defaults to "0"; cache_buster round-trips through Mongo. PR0 of docs/simulation-runs-convergence-plan.md. Stacked on feature/runs-api (depends on its SimulationRunRecord); retarget base to main after #48 merges. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Implements the simulation-runs listing endpoint (backend, full persist + query) from
docs/simulation-runs-api-plan.md, and adds a sequenced plan for converging the duplicate run-execution paths.POST /simulations/runs(new)SimulationRunRecordin a newBiosimSimulationRunscollection, written one-per-(submission × simulator) onPOST /simulations/runatstatus=CREATED, then updated toSUCCEEDED/FAILEDbySimulationRunWorkflowvia a newupdate_run_status_activity. Internalprocessing/success/failuremaps to the frontend'sCREATED/SUCCEEDED/FAILED.type: all|user+useremail), pagination, sorting, filtering. Returns{ runs: SimulationRun[], pagination: { page, perPage, _total } }. Filterids are allowlisted (also blocks arbitrary-field injection).SimulationRunDatabaseService(+ Mongo impl); DI getter wired via a lazy import to avoid thesimulations → dependenciesimport cycle; new activity registered inworker_main.pyand the test worker fixture.Test-isolation fix
The shared
database_service_mongofixture never cleanedBiosimSimson teardown, so the real-networktest_sim_workflowleaked aSUCCEEDEDrecord that gave later tests a spurious cache hit (failingintegration_localin the full suite). It now cleans up on teardown, matching its siblingomex_database_service_mongo.Convergence plan (
docs/simulation-runs-convergence-plan.md)There are currently two implementations of "run one sim on biosimulations.org" (the verify path's
OmexSimWorkflow+ monolithic activity, and this path's split submit/poll activities). The doc lays out four independently-shippable PRs to converge them: re-exposecache_buster, enrichBiosimSimulationRunparsing, reuseOmexSimWorkflowas the single per-run unit, and normalizeSimulationRunRecordto FK intoBiosimulatorWorkflowRunwith a join-backed listing.Known limitations (documented)
cpus, memory, maxTime, envVars, purpose, runtime, projectSize, resultsSize) default to0/[]— the platform doesn't capture them yet (PR1 in the convergence plan sources them).frontend/app/pages/simulations/index.vue(currently on mock data) to this endpoint.Testing
ruffclean;mypy --strictclean (biosim_server+tests).tests/simulations/test_runs_query.py(query-translation unit tests, Mongo-backed service tests, endpoint tests) + end-to-end assertions intests/integration_local/test_simulations_run.py— all pass.poetry run pytest -m "not integration": 74 passed, 1 failed. The single failure is the pre-existingtest_slurm_service(UnboundLocalError, needs SSH creds) — environmental, unrelated to this change.🤖 Generated with Claude Code