fix: assign distinct semver labels to legacy benchmark versions #40#46
Open
doubledare704 wants to merge 1 commit intopinchbench:mainfrom
Open
fix: assign distinct semver labels to legacy benchmark versions #40#46doubledare704 wants to merge 1 commit intopinchbench:mainfrom
doubledare704 wants to merge 1 commit intopinchbench:mainfrom
Conversation
…bench#40 The legacy benchmark version IDs (git hashes and two-component names like "1.0") all shared the same displayed semver/label (0.0.1 or 0.9.0), making them indistinguishable in the API and UI. This change: - Adds a forward-only corrective migration that assigns deterministic `1.0.0-beta.N` labels to every legacy/non-strict semver ID, ordered by `created_at ASC, id ASC` so chronological order is preserved and ties are broken. - Restores strict three-component semver IDs (e.g. `1.2.1`, `2.0.0-rc1`, `1.2.3-rc.1+build.5`) so that `semver` and `label` equal the ID. - Updates submission handling so new non-semver benchmark versions receive the next available `1.0.0-beta.N` label instead of the shared `0.0.1` default. - Adds unit tests covering beta label ordering and strict/legacy classification. The public API shape is unchanged. Existing filtering by benchmark version ID continues to work. Deployment order: deploy code first, then apply the D1 migration to production.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge This is a well-considered fix. The migration carefully handles the strict-semver classification using SQLite-compatible logic (no temp tables, no CTEs), the beta label assignment is deterministic and ordered, and the runtime Files Reviewed (4 files)
Reviewed by claude-4.6-sonnet-20260217 · 118,041 tokens |
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 legacy benchmark version IDs (git hashes and two-component names like "1.0") all shared the same displayed semver/label (0.0.1 or 0.9.0), making them indistinguishable in the API and UI.
This change:
1.0.0-beta.Nlabels to every legacy/non-strict semver ID, ordered bycreated_at ASC, id ASCso chronological order is preserved and ties are broken.1.2.1,2.0.0-rc1,1.2.3-rc.1+build.5) so thatsemverandlabelequal the ID.1.0.0-beta.Nlabel instead of the shared0.0.1default.The public API shape is unchanged. Existing filtering by benchmark version ID continues to work.
Deployment order: deploy code first, then apply the D1 migration to production. Closes #40
Local validation on a D1 instance
You can validate the full change against a representative dataset without accessing production by seeding a local D1 database from the public API.
Step 1: Prerequisites
From the repo root, ensure Wrangler is set up:
npx wrangler --versionStep 2: Create and migrate the local database
Step 3: Seed from the public API response
curl -s https://api.pinchbench.com/api/benchmark_versions > /tmp/benchmark_versions.jsonGenerate an INSERT script:
Load the seed data:
npx wrangler d1 execute prod-pinchbench --local --file /tmp/seed_benchmark_versions.sqlStep 4: Verify duplicates exist before migration
You should see repeated labels such as 0.0.1 and 0.9.0.
Step 5: Apply the corrective migration
npx wrangler d1 execute prod-pinchbench --local --file migrations/20260425_correct_benchmark_version_labels.sqlStep 6: Verify duplicates are resolved
Expected: no rows.
Also check the ordering and labels:
Legacy (non-semver) IDs should appear as 1.0.0-beta.1, 1.0.0-beta.2, … while strict IDs like 1.0.0, 1.2.1, 2.0.0-rc1 should show their own ID as semver/label.
Step 7: Verify strict IDs were restored
Expected: each row’s semver and label equal the id.
Step 8: Run the test suite
npm testOr run only the affected tests:
npx vitest run src/routes/benchmarkVersions.test.ts src/routes/results.test.tsAll tests should pass.
Notes