From 978c4189d460cdf1becd9b14606193fd76e629ba Mon Sep 17 00:00:00 2001 From: "copilot-dreamer[bot]" <310654851+Copilot Dreamer@users.noreply.github.com> Date: Fri, 20 Nov 2026 05:04:26 +0000 Subject: [PATCH 1/3] [Copilot Dreaming] Preserve test postprocessing when learning expectations Selecting a query directly can omit the normalization declared by its test reference and put external source paths into a learned snapshot. Directing expectation regeneration through the postprocessing reference avoids that invocation detour without replacing inline-failure inspection. The Rust DataFlowStep reference selects external-location postprocessing, whose shared implementation replaces external paths while retaining result relations. https://github.com/github/codeql/blob/f7a381fd5a8eee235dda7f83dd1f81e0a109e3f0/rust/ql/test/library-tests/dataflow/local/DataFlowStep.qlref#L1-L2 https://github.com/github/codeql/blob/f7a381fd5a8eee235dda7f83dd1f81e0a109e3f0/shared/util/codeql/util/test/ExternalLocationPostProcessing.qll#L18-L30 --- .github/instructions/expected-files.instructions.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/instructions/expected-files.instructions.md b/.github/instructions/expected-files.instructions.md index 17cf22f93a03..d0d19ba8f11c 100644 --- a/.github/instructions/expected-files.instructions.md +++ b/.github/instructions/expected-files.instructions.md @@ -2,3 +2,5 @@ applyTo: "**/*.expected" --- Do not edit these files directly. They are generated by running the tests. If a `.expected` file has a non-empty `testFailures `section it should not be committed - you may want to update the inline expectation comments in the corresponding test source file (e.g. marking expected results as `MISSING` / `SPURIOUS`) then re-run the test. + +To regenerate expectations for a query with a postprocessing `.qlref`, pass that `.qlref` to `codeql test run --learn`. From 4608fd1353f19dee3368b00b5084eaa3653e9d14 Mon Sep 17 00:00:00 2001 From: "copilot-dreamer[bot]" <310654851+Copilot Dreamer@users.noreply.github.com> Date: Fri, 20 Nov 2026 05:04:31 +0000 Subject: [PATCH 2/3] [Copilot Dreaming] Recover Unified tests from incompatible extractor schemas Tests-only changes can encounter a database schema incompatible with the checkout libraries, even though no extractor source was edited. Giving the local rebuild and pack-selection recovery at that decision point avoids a source-selection detour and incomplete compilation-only validation. The checkout builder generates the schema and library with its built extractor and installs that schema and binary into the local pack. Rebuilding after extractor edits remains required. https://github.com/github/codeql/blob/f7a381fd5a8eee235dda7f83dd1f81e0a109e3f0/unified/scripts/create-extractor-pack.sh#L11-L25 --- unified/AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified/AGENTS.md b/unified/AGENTS.md index 72de05d120be..6956e65f6822 100644 --- a/unified/AGENTS.md +++ b/unified/AGENTS.md @@ -38,7 +38,7 @@ by Apple's swift-syntax rather than by tree-sitter. - Check the output files for correctness but do not edit them manually. Regenerate them with `scripts/update-corpus.sh`. ## CodeQL Testing -- If you changed the extractor code, always rebuild it before running CodeQL tests. +- If you changed the extractor code or Unified QL tests report an incompatible database schema, rebuild with `scripts/create-extractor-pack.sh` and rerun the tests with `--search-path extractor-pack`. - To run all CodeQL tests, run `codeql test run --search-path extractor-pack ql/test` From 8540fffcb5283bb34c78ade4b95c95056cc5e952 Mon Sep 17 00:00:00 2001 From: "copilot-dreamer[bot]" <310654851+Copilot Dreamer@users.noreply.github.com> Date: Fri, 20 Nov 2026 05:04:31 +0000 Subject: [PATCH 3/3] [Copilot Dreaming] Remove duplicate expected-output editing guidance Maintaining two copies of the same manual-edit prohibition gives maintainers another rule to keep aligned without changing the action for Unified snapshot edits. The file-scoped instruction already covers every Unified expected file and supplies the more complete failure-section policy. https://github.com/github/codeql/blob/f7a381fd5a8eee235dda7f83dd1f81e0a109e3f0/.github/instructions/expected-files.instructions.md#L1-L4 The prohibition continues to apply through that shared instruction. The local learning recipe and the separate corpus-output restriction remain in Unified guidance. --- unified/AGENTS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unified/AGENTS.md b/unified/AGENTS.md index 6956e65f6822..20641c572268 100644 --- a/unified/AGENTS.md +++ b/unified/AGENTS.md @@ -42,6 +42,6 @@ by Apple's swift-syntax rather than by tree-sitter. - To run all CodeQL tests, run `codeql test run --search-path extractor-pack ql/test` -- Do not edit `.expected` files manually. To update the expected output, pass `--learn` to the `codeql test run` command. +- To update the expected output, pass `--learn` to the `codeql test run` command. - To run a specific test, pass the specific directory to the `codeql test run` command instead of `ql/test`.