Rust: Add manual regression test for dbscheme upgrade#21895
Open
redsun82 wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a manual, one-off regression test harness for validating that a Rust database schema upgrade (rust-analyzer 0.0.301 → 0.0.328) preserves key properties across the upgrade, by extracting an “old schema” DB, upgrading it, then querying the upgraded dataset.
Changes:
- Adds a
run-test.shscript to automate checkout/build of an old extractor, DB creation, dataset upgrade, and verification runs. - Adds old/new QL query pairs plus expected outputs to validate pre/post-upgrade shape preservation.
- Adds a minimal Rust source fixture + qlpack metadata and ignores generated test artifacts.
Show a summary per file
| File | Description |
|---|---|
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/run-test.sh | Automates end-to-end manual upgrade regression flow (old DB create → upgrade → verify). |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/README.md | Documents purpose, layout, and how to run the manual test. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/old/OldShapes.ql | Old-schema query selecting fields that should be preserved through upgrade. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/old/OldShapes.expected | Expected results for the old-schema query. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/new/UpgradeShapes.ql | New-schema query verifying upgraded representations preserve key properties. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/new/UpgradeShapes.expected | Expected results for the new-schema preservation query. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/new/upgrade_shapes.rs | Rust fixture source designed to exercise upgraded schema elements. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/new/qlpack.yml | Test pack metadata for running the new-schema verification query. |
| rust/ql/lib/upgrades/66a489863649185f4a9770f894505803059a1312/test/.gitignore | Ignores generated test project/db artifacts and outputs. |
Copilot's findings
- Files reviewed: 9/9 changed files
- Comments generated: 2
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| REPO_ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)" |
Comment on lines
+22
to
+27
| git stash --quiet || true | ||
|
|
||
| restore_branch() { | ||
| echo "==> Restoring original branch..." | ||
| git checkout --quiet - | ||
| git stash pop --quiet 2>/dev/null || true |
Adds a test directory with queries that verify properties are preserved when upgrading databases from rust-analyzer 0.0.301 to 0.0.328. This is a one-off manual test (not yet in CI), but could serve as the foundation for a general upgrade testing strategy. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use `git rev-parse --show-toplevel` instead of fragile relative path. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d967dc9 to
2665931
Compare
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.
Adds a test directory with queries that verify properties are preserved when upgrading databases from rust-analyzer 0.0.301 to 0.0.328.
What this does
old/OldShapes.ql: Queries the old schema fields (Meta, BlockExpr.isTry(), StructField.getDefault(), etc.)new/UpgradeShapes.ql: Queries the new schema after upgrade (PathMeta, KeyValueMeta, TryBlockModifier, etc.)run-test.sh: Script that automates the full test flow (checkout old commit, build old extractor, create old-schema DB, upgrade, verify)Status
This is a one-off manual test for this specific upgrade. It is not yet checked by CI.
However, this could serve as the foundation for a general upgrade testing strategy: the pattern of "query old schema, upgrade, query new schema, compare" could be generalized and automated for future dbscheme changes.