Skip to content

test(frontend-metricsql): restore the external MetricsQL corpus test as a lowering corpus - #1501

Merged
milindsrivastava1997 merged 1 commit into
mainfrom
1497-testfrontend-metricsql-restore-the-external-metricsql-corpus-test-as-a-lowering-corpus
Nov 25, 2026
Merged

milindsrivastava1997 merged 1 commit into
mainfrom
1497-testfrontend-metricsql-restore-the-external-metricsql-corpus-test-as-a-lowering-corpus

Conversation

@milindsrivastava1997

Copy link
Copy Markdown
Collaborator

Closes #1497.

Summary

#1226 and #1229 deleted crates/frontend-metricsql/tests/external_corpus.rs, so a nightly that runs an out-of-tree MetricsQL corpus through it now matches zero tests. This restores it as its own external_corpus target under tests/lowering_corpora/, following #1482. It checks lowering only; binding through Pass 1 crossed stage crates and is left out (planning an external corpus end to end is #1498).

Review guide

  1. crates/frontend-metricsql/tests/lowering_corpora/external_corpus/external_corpus.rs: queries, floor, normalize and floor_line are restored unchanged from 6bcf398^. check_dir lowers every query of every *.txt in a directory with lower_metricsql_query(q, 15s), enforces each file's # floor: N and prints failure causes by count. corpus_lowers runs it on $ASAP_EXTERNAL_CORPUS_DIR (skipped when unset); floor_is_enforced_per_file runs it on a sample directory, so PR CI exercises the logic.
  2. crates/frontend-metricsql/Cargo.toml: the new [[test]] target.

Behavior: before → after

# before (main): no such test; the old filter matches nothing
cargo test -p asap-frontend-metricsql --test metricsql external_corpus
  running 0 tests ... 19 filtered out

# after
ASAP_EXTERNAL_CORPUS_DIR=<dir> cargo test -p asap-frontend-metricsql --test external_corpus -- --nocapture
  <file>  Tally { lowered: .., unparseable: .., rejected: .. }
  Failures by cause: ...
  test corpus_lowers ... ok

Interfaces

 # asap-frontend-metricsql test targets
+external_corpus   tests/lowering_corpora/external_corpus/external_corpus.rs

Algorithm changes

None.

Decisions and open questions

  • One target per corpus, like the PromQL lowering_corpora targets, rather than a module of the metricsql binary.
  • No binding check: the crate graph forbids a frontend's tests from depending on Pass 1. test(planner-cli): plan an external corpus end to end and count what plans #1498 covers the whole planner through the asap_planner binary.
  • The env var is read only under tests/, which planning_crates_read_no_environment_variables does not cover.

Verification

  • cargo test -p asap-frontend-metricsql --test external_corpus, variable unset: 3 passed.
  • Against a private corpus via ASAP_EXTERNAL_CORPUS_DIR: passes; every file at or above its floor.
  • cargo fmt --check, cargo clippy -D warnings clean; pre-commit cargo test passed.
  • cargo test -p asap-integration-tests --test integration crate_graph::: 8 passed.

Follow-ups

🤖 Generated with Claude Code

…as a lowering corpus

#1226 and #1229 deleted external_corpus.rs, so a nightly that runs an
out-of-tree corpus through it now matches zero tests. Restore it as its
own `external_corpus` target under tests/lowering_corpora/, per #1482:
lowering only (no panics, per-file `# floor: N`, failure causes by
count). Binding through Pass 1 is left out; planning an external corpus
end to end is #1498.

Closes #1497.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milindsrivastava1997
milindsrivastava1997 merged commit c37a4cd into main Nov 25, 2026
3 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 1497-testfrontend-metricsql-restore-the-external-metricsql-corpus-test-as-a-lowering-corpus branch November 25, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(frontend-metricsql): restore the external MetricsQL corpus test as a lowering corpus

1 participant