Fix: Correct legacy version semver assignment (api#40)#41
Open
ScuttleBot wants to merge 1 commit intomainfrom
Open
Fix: Correct legacy version semver assignment (api#40)#41ScuttleBot wants to merge 1 commit intomainfrom
ScuttleBot wants to merge 1 commit intomainfrom
Conversation
The previous backfill migration (20260406_backfill_legacy_versions.sql) had a bug where it used a correlated subquery that evaluated incorrectly during UPDATE, causing all legacy versions to get assigned '1.0.0-beta.1'. The problematic pattern was: SELECT COUNT(*) + 1 FROM benchmark_versions bv2 WHERE bv2.semver IS NULL AND bv2.created_at < benchmark_versions.created_at This subquery had two issues: 1. The bv2.semver IS NULL condition meant it could only see unprocessed rows 2. The correlated reference to the same table during UPDATE caused evaluation order issues in D1 This new migration: 1. Resets any rows with incorrect semver (LIKE '1.0.0-beta.%') 2. Uses ROW_NUMBER() window function with a proper subquery pattern 3. Assigns sequential numbers based on created_at order Fixes api#40
Contributor
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
pinchbench-api | bf3abc8 | Commit Preview URL Branch Preview URL |
Apr 06 2026, 11:35 PM |
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.
Problem
All legacy benchmark versions were incorrectly assigned the same semver label
1.0.0-beta.1instead of sequential beta numbers.Root Cause
The previous backfill migration (
20260406_backfill_legacy_versions.sql) used a correlated subquery that evaluated incorrectly during UPDATE:This subquery had two issues:
bv2.semver IS NULLcondition meant it could only see unprocessed rowsSolution
This new migration:
LIKE '1.0.0-beta.%') back to NULLROW_NUMBER()window function with a proper subquery patternbeta.1, beta.2, beta.3...based oncreated_atorderChanges
migrations/20260406_fix_legacy_version_semver.sqlFixes api#40