Skip to content

Commit 5886092

Browse files
committed
test(stack-encrypt): keep the accepted block-ORE index assertion
The shared query-refusal corpus records that the longest text, text with an interior NUL and empty text are accepted by a block ORE field, but not which index answers them. Restore the native assertion that the term's index is IndexSpec::OreBlock, for a single bound and for either bound of a range, and record it as retained in the coverage map.
1 parent e4ea497 commit 5886092

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎conformance/stack-encrypt/coverage.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ in `v1/declarations.json`; `ore-block-between-long-low` and
200200
| `given_a_field_that_stores_a_null::a_stored_record_may_leave_out_only_a_sql_field` (`record.rs`), removed | `sql-absent-as-required`, `sql-absent-as-sealed` | `read_conformance::shared_record_read_profile` | a missing field tolerated by every null mode: `sql-absent-as-required`, `sql-absent-as-sealed` |
201201
| `a_query_the_field_does_not_answer_is_refused_naming_the_field` (`src/dynamic/query.rs`), 10 rows, removed | `eq-on-match-only`, `matches-on-equality-only`, `eq-on-order-only`, `lt-text-for-integer`, `lt-fraction-for-integer`, `between-scalar`, `between-one-bound`, `between-mixed-bounds`, `no-such-field` | `query_refusal_conformance::shared_query_refusal_profile` (`check_query` and `query_term` alike) | `operator_not_answered` reported as `unknown_operator`: `eq-on-match-only`; `not_a_range` reported as `field_type`: `between-scalar`; `no_such_field` reported as `unknown_field`: `no-such-field` |
202202
| `the_typed_paths_query_refusals_are_made_before_any_term` (`query.rs`), 6-row table removed; renamed `folded_equivalents_derive_one_term` for the one-term assertions that stay | `lt-unassigned`, `between-unassigned-high`, `between-unassigned-low`, `matches-too-short`, `matches-unassigned`, `eq-unassigned` | `query_refusal_conformance::shared_query_refusal_profile` | the upper bound of a range not folded before a term: `between-unassigned-high` |
203-
| `block_ore_refuses_text_it_has_no_term_for_before_any_term` (`query.rs`), removed | `ore-block-too-long`, `ore-block-trailing-nul`, `ore-block-between-long-high`, `ore-block-between-long-low`, `ore-block-between-nul-low`, `ore-block-between-nul-high`; accepted: `ore-block-longest`, `ore-block-interior-nul`, `ore-block-empty` | `query_refusal_conformance::shared_query_refusal_profile` | the length refusal reported as the NUL refusal: `ore-block-too-long` |
203+
| `block_ore_refuses_text_it_has_no_term_for_before_any_term` (`query.rs`), refusal rows removed; the accepted texts' index assertion stays as `accepted_block_ore_text_derives_a_block_ore_term`, since the corpus records that a case is accepted, not which index answers it | `ore-block-too-long`, `ore-block-trailing-nul`, `ore-block-between-long-high`, `ore-block-between-long-low`, `ore-block-between-nul-low`, `ore-block-between-nul-high` | `query_refusal_conformance::shared_query_refusal_profile` | the length refusal reported as the NUL refusal: `ore-block-too-long` |
204204
| `TestAQueryTheFieldDoesNotAnswerIsRefused` (`languages/golang/encrypt/query_test.go`), 5-row table, the inverted range and the short match text removed; renamed `TestVerifyAndTargetLimitRefuseWhatIsNotAMatchQuery` for the `Verify`/`TargetLimit` refusals that stay | `matches-on-integer`, `lte-on-match-only`, `unknown-operator`, `between-scalar`, `lt-text-for-integer`, `inverted-range`, `matches-too-short` | `TestQueryRefusalConformance` | the host dropping the diagnostic's `reason`: every refusal case; the engine faults above, through the same engine the guest embeds |
205205
| `TestAPlanRefusalNamesItsReason` (`languages/golang/encrypt/guest_test.go`), removed | `output-duplicate` as a frame, on both guests (its host plan in `v1/go-declarations.json` is refused by `Validate` before the engine, so the frame is what observes the engine's reason; `TestCheckerRefusesAnIndexedUntypedField` still reaches the engine through `engineCheck`) | `TestDeclarationConformance` | the host dropping the diagnostic's `reason`: `output-duplicate` and every other refusal case |
206206

‎packages/stack-encrypt/src/dynamic/query.rs‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,6 +1887,40 @@ mod tests {
18871887
assert_eq!(negative_zero.operand, zero.operand);
18881888
}
18891889

1890+
/// Block ORE's refusals and the text it accepts are shared query-refusal
1891+
/// cases; a refusal table records only that a case is accepted. What
1892+
/// stays here is which index answers: the longest text, text with an
1893+
/// interior NUL and empty text derive a block ORE term, either bound of
1894+
/// a range included.
1895+
#[tokio::test]
1896+
async fn accepted_block_ore_text_derives_a_block_ore_term() {
1897+
let cipher = cipher().await;
1898+
let keyset = cipher.default_keyset();
1899+
let plan = record::plan(&frame_of(&Tree::Object(vec![field(
1900+
"title",
1901+
"string",
1902+
vec![text("c"), text("ore_block")],
1903+
)])))
1904+
.expect("the plan parses");
1905+
let one = |text: &str| ValueFrame::of(text).expect("a value");
1906+
let two = |lo: &str, hi: &str| ValueFrame::of(vec![lo, hi]).expect("a value");
1907+
let longest = "a".repeat(1023);
1908+
let accepted = [
1909+
(OpSpec::Lt, one(&longest)),
1910+
(OpSpec::Lt, one("a\0b")),
1911+
(OpSpec::Lt, one("")),
1912+
(OpSpec::Between, two("", &longest)),
1913+
(OpSpec::Between, two("a\0b", "b")),
1914+
];
1915+
for (op, input) in accepted {
1916+
let term = query_term(&keyset, &plan, "title", op, &input, &NoTargets)
1917+
.expect("a query")
1918+
.await
1919+
.expect("a term");
1920+
assert_eq!(term.index, IndexSpec::OreBlock, "{op:?}");
1921+
}
1922+
}
1923+
18901924
/// A plan whose context is a field of each record has no context a
18911925
/// query could derive under; the binding sends the plan under the
18921926
/// context it names.

0 commit comments

Comments
 (0)