Repository navigation
fix(cypher): range() arity is enforced at the front end (LABS-1307) - #140
Conversation
|
Security review (security-review skill) Reviewed the No issues found. Security review: ✅ no issues found |
|
Rust review (rust-reviewer skill, full review) Full review of the PR diff. The only Rust changes are the executor's builtin registry — No issues found. Rust review: ✅ no issues found |
| fn range_takes_two_or_three_arguments() { | ||
| let mut conn = common::connection(); | ||
| for query in ["RETURN range(1)", "RETURN range(1, 2, 3, 4)"] { | ||
| let text = common::err_text(conn.execute(query)); |
There was a problem hiding this comment.
[Medium] structure (q-right-file): This file is named for and documented as one contract — //! Zero-argument scalar calls (LABS-667) (lines 1-6) — but the added unit is a different arity subject: range's one- and four-argument refusa
Suggested fix: Give the range contract a home whose name says what it tests: either broaden this file into a scalar-arity file (rename to match the sibling topic-named arity files such as temporal_constructor_arity.rs / integer_argument_error_classes.rs, and re-scope the module doc to all scalar-arity refusals
finding F-1-1
| relate::Value::Int(3) | ||
| ] | ||
| .into() | ||
| ) |
There was a problem hiding this comment.
[Medium] boundaries (std-6): The expectation hand-rolls relate::Value::List(vec![…].into()) even though this crate's common module — already imported and used here for connection/err_text/scalar_one — ships `common::lis
Suggested fix: Build the expectation with common::list(vec![relate::Value::Int(1), relate::Value::Int(2), relate::Value::Int(3)]) instead of the raw relate::Value::List(vec![…].into()).
finding F-1-2
| relate::Value::Int(5) | ||
| ] | ||
| .into() | ||
| ) |
There was a problem hiding this comment.
[Medium] boundaries (std-6): The sibling expectation repeats the same hand-rolled relate::Value::List(vec![…].into()) shape instead of calling the crate's canonical common::list helper that the surrounding test files use for
Suggested fix: Build the expectation with common::list(vec![relate::Value::Int(1), relate::Value::Int(3), relate::Value::Int(5)]).
finding F-1-3
|
Stellar review (stellar-review skill) Round 3 · head No open issues. Stellar review: ✅ no issues found |
`range()`'s builtin row carried ARITY_AT_LEAST_ONE with no ceiling, so `range(1)` passed the arity gate and reached `range_plan`, whose missing `end` argument surfaced as a type error instead of Neo4j's 42I13 SyntaxError. The row now states the verified contract, two to three arguments, through the one min/max arity table; the shared gate rejects both `range(1)` and `range(1, 2, 3, 4)` before evaluating any argument or calling the implementation. Verified live against Neo4j 2026.10.1 (Bolt): `range(1)` is "Neo.ClientError.Statement.SyntaxError: Insufficient parameters for function 'range'", `range(1, 2, 3, 4)` is the "Too many parameters" SyntaxError, and the two- and three-argument forms return their lists. The engine-level test file is renamed `labs667_zero_arg_arity.rs` -> `scalar_function_arity.rs` and re-scoped to all scalar-arity refusals (the zero-argument side, calls above an exact or capped contract, and range's two-to-three window); the expected lists use the shared `common::list` helper. Co-Authored-By: Claude Code <noreply@anthropic.com>
aa1e89b to
38e6854
Compare
|
Round-2 test-shape fixes at head 38e6854:
Gates @1.88 (CARGO_TARGET_DIR=target-gate): Note: |
Oplane Security ReviewOplane reviewed this PR and did not identify any security requirements that need attention. Review the generated threat model. Change comment settings · Set up Oplane in your agent · Workflow guidance |
|
Loadtest baselines comparison
Loadtest baseline comparisonFrozen baselines vs current reports; bands match the Status: ok Pairs: fraud-loadtest: compared · identity-loadtest: compared fraud-loadtest
Per-use-case p99 latency
identity-loadtest
Per-use-case p99 latency
|
Spec-harness coverage — 🟡
Rerun |
|
Memory controls and workspace memory calibration
Memory controls and workspace memory calibrationStatus: improvement sort — max_cgroup_to_logical_ratioVerdict: improvement Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create. When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders. Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive. Outcome: Expected cgroup ratio 0.999x–1.082x. A reading may sit 5% outside that range. Measured 1.24 MB, ratio 0.901x. Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow. expand — max_rss_to_logical_ratioVerdict: improvement Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create. When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders. Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive. Outcome: Expected RSS ratio 2.099x–2.147x. A reading may sit 5% outside that range. Measured 2.14 MB, ratio 1.006x. Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow. expand — max_cgroup_to_logical_ratioVerdict: improvement Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create. When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders. Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive. Outcome: Expected cgroup ratio 2.072x–2.215x. A reading may sit 5% outside that range. Measured 8.50 MB, ratio 1.000x. Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow. distinct — max_rss_to_logical_ratioVerdict: improvement Given: a fresh server per observation, admission on, a hold of 2500 ms, and 1 repeats. Families: sort, expand, aggregation, distinct, and create. When: each observation parks its sessions on RETURN 1, then holds one workspace family at the target reservation. The shapes are one holder at 1.00 MB, 4.00 MB, and 16.00 MB, then the same 16.00 MB across two and four holders. Then: each observation records VmRSS and cgroup deltas against the live held logical bytes. The child stays alive. Outcome: Expected RSS ratio 1.256x–1.322x. A reading may sit 5% outside that range. Measured 1.95 MB, ratio 1.132x. Investigate whether this improvement is a false positive. When it is real, re-freeze the envelope with the create-loadtest-baselines workflow. |
|
Memory shape
Memory shapeStatus: ok All memory shapes held. 🟢 baseGiven: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling. When: the base shape is loaded to 0 nodes and 0 relationships, then checkpointed. The child RSS is sampled. Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries. Baseline: logical 0.00 MB – 0.00 MB, disk 0.00 MB – 0.00 MB, attributed RSS 0.00 MB – 0.00 MB, ratio 0.000x–0.000x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes. Validated: logical 0.00 MB, disk 0.00 MB, attributed RSS 0.00 MB, ratio 0.000x. Report: logical, disk, attributed RSS, and the ratio held. flatGiven: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling. When: the flat shape is loaded to 120000 nodes and 0 relationships, then checkpointed. The child RSS is sampled. Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries. Baseline: logical 26.02 MB – 26.02 MB, disk 1.95 MB – 1.95 MB, attributed RSS 36.49 MB – 36.93 MB, ratio 1.402x–1.419x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes. Validated: logical 26.02 MB, disk 1.95 MB, attributed RSS 37.36 MB, ratio 1.436x. Report: logical, disk, attributed RSS, and the ratio held. fanoutGiven: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling. When: the fanout shape is loaded to 52016 nodes and 52000 relationships, then checkpointed. The child RSS is sampled. Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries. Baseline: logical 28.62 MB – 28.62 MB, disk 1.75 MB – 1.75 MB, attributed RSS 34.93 MB – 36.61 MB, ratio 1.220x–1.279x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes. Validated: logical 28.62 MB, disk 1.76 MB, attributed RSS 35.73 MB, ratio 1.248x. Report: logical, disk, attributed RSS, and the ratio held. ringGiven: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling. When: the ring shape is loaded to 46000 nodes and 46000 relationships, then checkpointed. The child RSS is sampled. Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries. Baseline: logical 29.99 MB – 29.99 MB, disk 1.77 MB – 1.77 MB, attributed RSS 35.30 MB – 35.89 MB, ratio 1.177x–1.197x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes. Validated: logical 29.99 MB, disk 1.77 MB, attributed RSS 36.08 MB, ratio 1.203x. Report: logical, disk, attributed RSS, and the ratio held. dense ringGiven: an empty relate serve, 1 integer properties on every node, text indexes 0, point indexes 0, range indexes 0, and a 32.00 MB logical ceiling. When: the dense ring shape is loaded to 5000 nodes and 100000 relationships, then checkpointed. The child RSS is sampled. Then: the database holds those counts. The load finishes under the ceiling. Logical bytes, disk, attributed RSS, and the ratio stay inside the frozen boundaries. Baseline: logical 31.41 MB – 31.41 MB, disk 1.62 MB – 1.62 MB, attributed RSS 31.27 MB – 32.46 MB, ratio 0.996x–1.034x. A reading may sit 5% outside the ratio, and 15% or 1.00 MB outside the sizes. Validated: logical 31.41 MB, disk 1.61 MB, attributed RSS 31.72 MB, ratio 1.010x. Report: logical, disk, attributed RSS, and the ratio held. |
Summary
Fix:
range()accepted a wrong argument count —range(1)passed the builtin arity gate and reached the implementation, where the missingendsurfaced as a type error, and a fourth argument was silently ignored. The builtin row now carries the live-verified two-to-three contract through the one min/max arity table, so the shared gate refuses both counts before any argument is evaluated.Changes
registry.rs: newARITY_TWO_TO_THREEcontract (min 2, max 3, "requires two to three arguments"), pinned to live Neo4j 2026.10.1; therangerow moves off theARITY_AT_LEAST_ONEfloorscalar_function_arity.rs(renamed fromlabs667_zero_arg_arity.rs, module doc re-scoped to all scalar-arity refusals):range(),range(1)andrange(1, 2, 3, 4)are arity errors; the two- and three-argument forms keep their values, asserted through the sharedcommon::listhelper; the zero-argument coverage is unchangedUser-facing impact
range(1)andrange(...)with four or more arguments now raiseNeo.ClientError.Statement.SyntaxError(InvalidNumberOfArguments), matching Neo4j, instead of a type error (one argument) or a silently truncated result (four+).Example usage
Verification
range(1)->Neo.ClientError.Statement.SyntaxError"Insufficient parameters for function 'range'";range(1,2,3,4)-> the "Too many parameters" SyntaxError;range(1,5)/range(1,10,2)return their listscargo test -p relate --test scalar_function_arity— 4/4;range_takes_two_or_three_argumentsfails on the pre-fix row and passes with itcargo test -p relate-executor --lib— 1386 passed, 2 ignoredcargo test -p relate-planner— all suites passcargo test -p relate— all suites pass except the host-calibration testcancellation::cancelling_inside_a_one_hop_pushdown_aggregation_errors_promptly, which asserts a wall-clock floor (80 ms) on this host (measured 69-79 ms, varies run to run; untouched by this diff, 2-argrangeunchanged)cargo fmt --all --checkandcargo clippy --workspace --all-targets --exclude relate-python -- -D warningsclean @1.88Fixes LABS-1307.
🤖 Generated with Claude Code