Skip to content

Rust: Add manual regression test for dbscheme upgrade#21895

Open
redsun82 wants to merge 2 commits into
tausbn/rust-upgrade-to-rust-analyzer-0.0.328from
tausbn/rust-upgrade-test
Open

Rust: Add manual regression test for dbscheme upgrade#21895
redsun82 wants to merge 2 commits into
tausbn/rust-upgrade-to-rust-analyzer-0.0.328from
tausbn/rust-upgrade-test

Conversation

@redsun82
Copy link
Copy Markdown
Contributor

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.

@redsun82 redsun82 requested a review from a team as a code owner May 26, 2026 15:52
Copilot AI review requested due to automatic review settings May 26, 2026 15:52
@github-actions github-actions Bot added documentation Rust Pull requests that update Rust code labels May 26, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh script 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
redsun82 and others added 2 commits May 26, 2026 18:17
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>
@redsun82 redsun82 force-pushed the tausbn/rust-upgrade-test branch from d967dc9 to 2665931 Compare May 26, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants