Skip to content

fix(core): derive experiment reference from result data instead of dedicated column - #1287

Open
AlessandroPomponio wants to merge 1 commit into
mainfrom
ap_1286_do_not_use_experiment_reference_column
Open

fix(core): derive experiment reference from result data instead of dedicated column#1287
AlessandroPomponio wants to merge 1 commit into
mainfrom
ap_1286_do_not_use_experiment_reference_column

Conversation

@AlessandroPomponio

@AlessandroPomponio AlessandroPomponio commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Removes the dependency on the experiment_reference denormalised column in the measurement-requests table for deriving experiment context. The experiment reference is now read directly from the JSON payload stored in the measurement-results table, using SQLAlchemy ORM expressions instead of raw SQL strings where applicable.

High-level Changes

  • Experiment reference sourced from result data: Queries that previously read experiment_reference from the requests table now extract it via JSON_EXTRACT on the results table, with a fallback path for the legacy nested format. Python-side deduplication (ExperimentReference.__hash__) replaces the previous COUNT(DISTINCT experiment_reference) SQL aggregation.
  • experiment_filter parameter removed: The experiment_reference column is no longer used as a filter in measurement_requests_count_for_operation and measurement_results_count_for_operation, so the experiment_filter argument has been dropped from both methods.
  • experimentReference column mapping removed: The experimentReferenceexperiment_reference entry has been removed from MEASUREMENT_REQUEST_COLUMN_MAPPINGS in the filtering layer.
  • Raw SQL replaced with ORM in measurement_request_by_id: The hand-written SQL string for fetching a single request by ID has been replaced with an equivalent SQLAlchemy select() statement.
  • samplestore_statistics updated: Now issues two queries instead of one; the second fetches distinct experiment-reference JSON blobs from the results table, and Python deduplicates them by major version.
  • Test updated: The stats test now reflects that a simulation using an already-present experiment leaves number_of_experiments unchanged rather than incrementing it by one.

Impact

Read paths that surface experiment information — statistics, request lookups, and the experiments-in-operation query — will derive that information from result payloads rather than the requests table. No schema migration is required for existing data as long as results contain the expected JSON fields. The experiment_filter parameter is a breaking change for any callers of the two count methods.


The code and this PR description were generated using IBM Bob and reviewed manually.

…dicated column

Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Enables CI integration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(core): migrate experiment reference reads from SQL column to results JSON

1 participant