Summary
The samplestore currently reads experiment references back from a denormalised SQL column that stores a plain string representation of the ExperimentReference type. This string was never intended to be parsed — it is a by-product of serialisation, not a designed interchange format. It would be worth migrating all read paths to use the structured JSON already stored in the measurement results table, which is the canonical and safely-deserializable source of truth for this data.
Motivation
Parsing the legacy string representation is fragile and has caused subtle bugs: the string encodes a fully-qualified semantic version, so two releases of the same experiment that should be considered equivalent end up treated as distinct. The ExperimentReference type itself defines equality at the major-version level, but string parsing bypasses that model entirely. The structured JSON in the results table deserialises cleanly through the type's own Pydantic model, respects the intended equality semantics, and is already used correctly in at least one read path in the codebase. Consolidating all reads onto this source would eliminate the class of bugs caused by string parsing and remove dead filtering parameters that currently have no callers.
Scope
The following areas would likely need attention:
- Measurement count methods — dead filtering parameters that reference the legacy column could be removed.
- Samplestore statistics — experiment counting could be moved to read from the results JSON, with deduplication consistent with the type's equality model.
- Experiment listing for an operation — could be rewritten to join through the results table and deserialise structured JSON rather than parsing column strings.
- Measurement request reads — methods that reconstruct measurement request objects could be updated to source the experiment reference from the results JSON.
- ORM filter mappings — any mapping that routes a filter key to the legacy string column could be removed to avoid silently querying stale data.
Summary
The samplestore currently reads experiment references back from a denormalised SQL column that stores a plain string representation of the
ExperimentReferencetype. This string was never intended to be parsed — it is a by-product of serialisation, not a designed interchange format. It would be worth migrating all read paths to use the structured JSON already stored in the measurement results table, which is the canonical and safely-deserializable source of truth for this data.Motivation
Parsing the legacy string representation is fragile and has caused subtle bugs: the string encodes a fully-qualified semantic version, so two releases of the same experiment that should be considered equivalent end up treated as distinct. The
ExperimentReferencetype itself defines equality at the major-version level, but string parsing bypasses that model entirely. The structured JSON in the results table deserialises cleanly through the type's own Pydantic model, respects the intended equality semantics, and is already used correctly in at least one read path in the codebase. Consolidating all reads onto this source would eliminate the class of bugs caused by string parsing and remove dead filtering parameters that currently have no callers.Scope
The following areas would likely need attention: