Replace AssayState with durable PipelineRun - #179
Merged
Conversation
…icit artifact refs. ds.pipeline.run() now persists a strict run/stage ledger with frozen cell and feature views, and granular methods require exact ArtifactRefs instead of mutating live metadata or selecting a current result.
Integrate the incoming workflows with ArtifactRef and PipelineRun contracts, then refresh tests and executable documentation.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Bring in the condition-level statistical testing tutorial. Cache conflicts are resolved in favor of this branch and will be rebuilt next.
Port the new agent orchestration, QC, and multimodal workflows to exact immutable artifact contracts.
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.
The central change is not merely replacing
AssayState. It separates three concepts that were previously mixed together: immutable results, workflow execution history, and live metadata.Summary
This branch removes the assumption that a datastore has one mutable “current analysis.”
Previously, analysis artifacts existed, but
AssayState, encoded paths, liveIcolumns, and published result columns determined which graph, embedding, or clustering was current. Running another analysis could replace that state. Later operations could silently resolve a different upstream result, or interpret an existing result against changed cell or feature selections.The new model makes analysis identity explicit:
ArtifactRefidentifies one exact persisted result.PipelineRunrecords one complete workflow invocation.Reopening
baselinereconstructs the same analysis even if liveI, metadata, or later analysis branches have changed.Explicit artifact contracts
Granular APIs across feature selection, graph construction, embeddings, clustering, quality control, mapping, trajectory, metrics, statistical testing, and marker search now require exact upstream
ArtifactRefvalues.This removes:
AssayStateandget_assay_statelatest_*pointers"hvgs"update_statebehaviorlabel=argumentsProducers now return artifacts. Separate loaders reconstruct richer results where needed, including mapping, trajectory, PARIS, enrichment, LISI, and marker outputs.
This allows several parameter branches to coexist without one becoming globally current, and prevents downstream operations from accidentally combining incompatible cells, features, coordinates, or graphs.
Durable pipeline runs
DataStore.pipeline.run()now returns a durablePipelineRuninstead of a dictionary of results accompanied by metadata mutations.Each run persists:
Configuration is validated before a run record is created. A completed run exposes its artifact mapping and frozen views. Failed or interrupted runs remain inspectable through
report(), but do not expose partial outputs as if they were a successful analysis.Artifact reuse remains provenance-based. Artifact IDs are not content hashes. Scarf searches complete artifacts with matching operation, parameters, and inputs, validates their payload, and records whether each stage created or reused its output.
Frozen cells and features
A run captures its input selection, analysis selection, feature universe, identities, and requested metadata at the start of the workflow.
run.cellsandrun.featurestherefore represent the axes used by that invocation:Ido not alter the runIPlotting and AnnData/H5AD export can consume these frozen views directly, so they do not reconstruct an analysis from whichever columns happen to be live at export time.
Pipeline recipe and clustering decision
The default RNA recipe now records filtering, cell-cycle scoring, feature selection, normalization, PCA, optional Harmony, graph construction, UMAP, Leiden candidates, PARIS, doublet scoring, and marker search as explicit sequential stages.
Automatic clustering selection is itself persisted:
run["clusters"]points to the exact winning Leiden artifactWhen Harmony is enabled, clustering is evaluated in the corrected coordinates. Doublet scoring deliberately retains its separate uncorrected PCA graph branch.
Failure, interruption, and labels
Run and stage documents use strict persisted shapes and set their completion marker last. Unknown, incomplete, or inconsistent records fail closed.
Cooperative interruption records terminal state before propagating the signal. A hard process termination can leave an incomplete record, which is retained rather than guessed at or repaired.
There is intentionally no on-disk resume or same-run retry protocol. A new invocation receives a new run ID and may reuse any complete artifacts produced before the interruption.
Optional run labels are immutable names for successful runs:
Downstream integration
The artifact contract is applied consistently across the repository:
IThe merged agent and statistical-testing work is not a separate feature introduced here. Those workflows were ported onto the same explicit artifact and durable-run contracts.
Compatibility policy
This is an intentional breaking change with no silent compatibility layer.
Stores containing
{assay}/stateare rejected on open. Scarf does not inspect or migrate that document. Repacking can preserve counts and the current physical layout, but it does not translate legacy encoded analysis results into artifacts.Repacking a current store preserves pipeline records because its axes are unchanged. Subsetting and merging do not copy source runs, and an overwriting merge clears destination run records whose row identity is no longer valid.