Lines
100 %
Functions
Branches
//! The reader is reachable from a report query parameter and from the SSH eval
//! channel, and `parse_expr`/`parse_list` are mutually recursive. Without a
//! ceiling, a few kilobytes of `(((…` aborts the process — not an error, a
//! SIGABRT that takes every tenant on the pod with it. CLAUDE.md requires every
//! recursive parse path to carry a depth guard.
#[test]
fn deeply_nested_input_is_refused_not_fatal() {
for depth in [1_000usize, 100_000] {
let src = format!("{}x{}", "(not ".repeat(depth), ")".repeat(depth));
assert!(
nomiscript::Reader::parse(&src).is_err(),
"{depth} levels must be refused, not abort the process"
);
}
/// The ceiling must stay far above anything a person writes.
fn ordinary_nesting_still_parses() {
let src = format!("{}x{}", "(not ".repeat(32), ")".repeat(32));
nomiscript::Reader::parse(&src).is_ok(),
"32 levels is normal"