Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions crates/frontend-promql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ edition = "2021"
[dependencies]
asap-types = { path = "../types" }

# ProjectASAP's pinned parser is the shared parser contract used by the backend
# and control plane. It carries the evaluated PromQL extensions documented in
# `promql.rs`; syntax outside that contract must fail closed at adapters.
promql-parser = { git = "https://github.com/ProjectASAP/promql-parser", rev = "c51beafb361af4cc95ed62ae377862c660ceb757" }
# Shared ProjectASAP parser contract. Keep this immutable revision aligned
# with backend parsing and treat newly parsed functions as unsupported until
# the frontend lowerer gives them an explicit semantic mapping.
promql-parser = { git = "https://github.com/ProjectASAP/promql-parser", rev = "d7606436bde05efe19c5398fe2122faa49062f7d" }

[dev-dependencies]
asap-aware-mapping = { path = "../asap-aware-mapping" }
Expand Down
18 changes: 18 additions & 0 deletions crates/frontend-promql/tests/promql_lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,24 @@ fn lower(q: &str) -> QueryExpr {
lower_promql(q, AccuracyTarget::Exact).unwrap_or_else(|e| panic!("lower failed for {q:?}: {e}"))
}

#[test]
fn newly_parsed_metricsql_reducers_fail_closed_without_lowering_semantics() {
for query in [
"distinct_over_time(cpu_usage[5m])",
"entropy_over_time(cpu_usage[5m])",
] {
promql_parser::parser::parse(query)
.unwrap_or_else(|error| panic!("pinned parser must accept {query:?}: {error}"));
assert!(
matches!(
lower_promql(query, AccuracyTarget::Exact),
Err(LoweringError::UnsupportedFunction(_))
),
"{query:?} must remain exact-only until the lowerer defines its semantics"
);
}
}

// ── Bare selectors & label matchers (folded onto Scan.predicates) ───────────────

#[test]
Expand Down
Loading