Skip to content

Commit 5bd00b1

Browse files
authored
Merge pull request #1507 from cipherstash/feat/stack-encrypt-test-consolidation
test(stack-encrypt): consolidate duplicate expectations into the shared corpora
2 parents 08884c5 + a3da2b2 commit 5bd00b1

10 files changed

Lines changed: 256 additions & 888 deletions

File tree

‎conformance/stack-encrypt/coverage.md‎

Lines changed: 70 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,13 @@ value kinds remain open.
7171
Shared semantic expectations should be maintained once and executed by each
7272
language runner. Conformance can replace duplicate case tables and fixture
7373
maintenance. It does not eliminate the need to execute the Rust and Go paths.
74-
No existing test has been deleted by conformance enrollment.
74+
Enrollment alone deleted no test; the [consolidations](#consolidations) below
75+
record each duplicate table that was later removed, with the shared cases
76+
and the fault evidence that replaced it.
7577

7678
| Existing evidence | Relationship to conformance | Consolidation action |
7779
|---|---|---|
78-
| Rust `dynamic/record.rs` tests `a_malformed_plan`, `a_null_is_refused_as_its_key`, `a_missing_or_null_index_payload_is_the_default` | Many inputs and diagnostic outcomes are now shared declaration cases | Move the remaining cases and retain any unique display/low-level assertions before removing duplicate rows |
80+
| Rust `dynamic/record.rs` plan-refusal tests | Their inputs and diagnostic outcomes are shared declaration cases | Removed; the message naming its field stays in `a_plan_refusal_names_its_field_in_the_message` (see [consolidations](#consolidations)) |
7981
| Rust kind/index admission tests | The corpus has the complete 21-kind/five-index acceptance matrix | Share case data; retain direct tests that compare declaration admission with actual term execution |
8082
| Rust `value_kinds.rs`, Go `value_kinds_test.go` | Enrolled as `record-value-kinds-v1`, retaining the shared fixture and generated SDK calls | Extend the existing fixture/requirements for missing boundaries; retain typed and generated-code assertions |
8183
| Rust `query_operators.rs`, Go `query_test.go` | Enrolled as `record-query-operators-v1`, including verification and target limits | Add shared refusal cases separately; retain host/generated query mapping tests |
@@ -136,7 +138,7 @@ Each runs in native Rust and Go WASI under `test:conformance`.
136138
| Existing evidence | Shared case IDs | Retained assertions |
137139
|---|---|---|
138140
| `value_kinds.json` and its runners | `i8-*`, `u8-*`, `i16-*`, `u16-*`, `u32-*`, `i128-*`, `u128-*`, `f32-*`, `f64-*`, `bytes-*`, `decimal-*`, `date-*`, `timestamp-*`, `sealed-*`, `sql-*`, `*-given-*` | Typed Rust term comparisons and generated Go methods |
139-
| Native `dynamic/query.rs` refusal tests, Go `TestAQueryTheFieldDoesNotAnswerIsRefused` | Every `record-query-refusals-v1` case | Tree-notation inputs, the hand-built match options, generated query methods |
141+
| Native `dynamic/query.rs` refusal tests, Go `TestVerifyAndTargetLimitRefuseWhatIsNotAMatchQuery` | Every `record-query-refusals-v1` case | Tree-notation inputs, the hand-built match options, generated query methods |
140142
| Native typed refusal tests in `tests/op.rs` | The `typed` entries | Case-sensitivity mismatch, batch and `via` forms, which the API plan removes (its step 3) |
141143
| Native `a_stored_record_that_does_not_fit`, the read profile | `shape-*`, `authenticated-*`, `success-*` | Mutation vocabulary over real ciphertext |
142144
| Guest `test_frame` and `last_error` tests | `transport-*`, `leaf-*` | Plan-frame boundary cases, ABI status mapping |
@@ -201,3 +203,68 @@ Open: fresh JSON document exchange, the remaining EQL types, a SQL lane
201203
that stores one language's fresh rows through the other, and the
202204
a lane that runs the required Go rc.3 combination, and the other
203205
released-version rows once the compatibility policy is defined.
206+
207+
## Consolidations
208+
209+
Each row is one old assertion table whose literal expectations are now held
210+
by a shared corpus and executed by both language runners. A row was removed
211+
only after a fault was introduced by hand into the engine and the named
212+
replacement runner failed on it under `STACK_CONFORMANCE_REQUIRED=1`; the
213+
fault was then reverted. "Fails on" names the fault and the case the runner
214+
reported. Where an old table mixed shared rows with shapes the corpus cannot
215+
spell, only the shared rows were removed and the test's doc comment says what
216+
stays. Every shared case in these rows runs natively through the Rust binary
217+
named and through the Go guest (`TestDeclarationConformance` on both guests,
218+
`TestRuntimeConformance`, `TestReadConformance`, `TestQueryRefusalConformance`).
219+
220+
Five cases were enrolled so the old rows had a one-to-one home rather than a
221+
neighbour: `output-not-string`, `passthrough-with-index` and `target-number`
222+
in `v1/declarations.json`; `ore-block-between-long-low` and
223+
`ore-block-between-nul-high` in `v1/query-refusals.json`.
224+
225+
| Old test (file) | Shared case IDs | Replacement runner | Fails on |
226+
|---|---|---|---|
227+
| `every_refusal_names_its_field_and_reason::a_malformed_plan` (`src/dynamic/record.rs`), 24 rows, removed; its check that the message names the field stays in `a_plan_refusal_names_its_field_in_the_message`, since the corpus compares payloads, not messages | `root-null`, `root-list`, `empty-plan`, `field-not-object`, `unknown-key`, `frame-duplicate-key` (a field given twice; the frame refuses a repeated key before the plan is read, and a key repeated inside a spec stays in the kept `a type given twice` and `a context_field key given twice` rows), `missing-context`, `missing-outputs`, `outputs-with-target`, `outputs-string`, `output-unknown`, `outputs-empty`, `output-duplicate`, `passthrough-with-ciphertext`, `target-number`, `type-unknown`, `type-uint32-match`, `type-bool-ore`, `context-bare-label`, `context-bool`, `mixed-prefix`, `shared-identity`, `context-empty` | `declarations::shared_declaration_grammar` | `missing_context` reported as `unknown_key`: `missing-context`; a label refusal reported as another reason: `context-bare-label`, `context-one-segment`, `context-segment-*`, `context-nested-extension`, `context-field-static-label` |
228+
| `every_refusal_names_its_field_and_reason::a_null_is_refused_as_its_key` (`record.rs`), 6 rows, removed; the message check stays as above | `context-null`, `outputs-null`, `target-null`, `type-null`, `context-field-null`, `field-null` | `declarations::shared_declaration_grammar` | `present` reading a null as an absent key: `outputs-null`, `target-null`, `target-options-null`, `type-null`, `null-mode-null` |
229+
| `every_refusal_names_its_field_and_reason::a_missing_or_null_index_payload_is_the_default` (`record.rs`), removed | `match-default-bare`, `match-default-null`, `match-default-empty`, `unit-output-null-eq` | `declarations::shared_declaration_grammar` (normalization) | a non-default option substituted for a missing match payload: `match-default-bare`, `match-default-null` |
230+
| `given_a_plan_value::refuses_a_malformed_plan_before_any_field_is_built` (`record.rs`), 17 rows, removed | `root-null`, `empty-plan`, `field-not-object`, `unknown-key`, `missing-context`, `missing-outputs`, `outputs-empty`, `output-not-string`, `output-unknown`, `output-duplicate`, `passthrough-with-ciphertext`, `passthrough-with-index`, `frame-duplicate-key`, `context-bool`, `context-empty` | `declarations::shared_declaration_grammar` | as the first row; the old rows asserted the error variant alone, the corpus asserts code, reason and field |
231+
| `given_a_plan_value::refuses_a_field_context_that_is_not_a_label` (`record.rs`), 6 of 9 rows removed; the integer, bytes and extended one-segment shapes stay | `context-bare-label`, `context-one-segment`, `context-segment-slash`, `context-segment-digit`, `context-nested-extension` | `declarations::shared_declaration_grammar` | a label refusal reported as another reason: every `context_not_label` case |
232+
| `every_refusal_names_its_field_and_reason::a_source_that_does_not_fit` (`record.rs`), 3 of 9 rows removed; the passthrough, repeated-key and non-object shapes stay | `required-missing`, `late-missing`, `unknown-field`, `sql-missing-with-unknown-field`, `required-wrong-width`, `late-wrong-type` | `runtime_conformance::shared_record_runtime_profile` | a missing field tolerated by every null mode: `required-missing`; the declared type not checked on a required field: `required-null`; `unknown_field` reported as `field_missing`: `unknown-field` |
233+
| `given_a_source_that_does_not_fit_the_plan::encrypt_and_check_source_refuse_it_alike_with_no_key_request` (`record.rs`), 3 of 11 rows and the two matching `encrypt` checks removed | as the row above; the runner also asserts no data key is generated on a refusal | `runtime_conformance::shared_record_runtime_profile` | as the row above |
234+
| `every_refusal_names_its_field_and_reason::a_stored_record_that_does_not_fit` (`record.rs`), 5 of 7 rows removed; the repeated-field row stays (the engine guard is reached natively alone, see the raw-frame contract), and so does the record that is one leaf: the read profile stores every record as a batch, so `row-not-map` reaches the batch-row arm and not the whole-record one | `missing-field`, `field-not-map`, `missing-ciphertext`, `plaintext-under-c`, `context-tenant-no-payload` | `read_conformance::shared_record_read_profile` (`check_record` and `decrypt`, with the retrieval counter) | `outputs_not_map` and `no_ciphertext_node` reported as other reasons: `field-not-map`, `missing-ciphertext`; a missing field tolerated by every null mode: `missing-field`, `late-missing-field`, `context-drop-tenant`; `passthrough` and `no_passthrough_node` reported as other reasons: `plaintext-under-c`, `context-tenant-no-payload` |
235+
| `given_a_field_that_stores_a_null::a_null_in_a_field_with_no_null_mode_is_refused` (`record.rs`), removed | `required-null` | `runtime_conformance::shared_record_runtime_profile` | the declared type not checked on a required field: `required-null` |
236+
| `given_a_field_that_stores_a_null::a_stored_null_is_refused_through_a_plan_that_has_no_null` (`record.rs`), removed | `authenticated-null-as-required` (the refusal), `sealed-null` and `sealed-boundaries` (a value opens through the sealing plan) | `read_conformance::shared_record_read_profile`, `runtime_conformance::shared_record_runtime_profile` | a sealed null accepted by a plan with no null mode: `authenticated-null-as-required` |
237+
| `given_a_field_that_stores_a_null::a_row_with_every_field_left_out_is_an_empty_record` (`record.rs`), removed | `sql-all-absent`, `sql-null` | `runtime_conformance::shared_record_runtime_profile` | an explicit SQL null not left out of the record: `sql-null` |
238+
| `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` |
239+
| `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` |
240+
| `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` |
241+
| `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` |
242+
| `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 |
243+
| `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 |
244+
245+
Considered and kept, with the reason:
246+
247+
- `given_a_stored_record_that_does_not_fit_the_plan::decrypt_and_check_record_refuse_it_before_any_key_is_retrieved`:
248+
eight of its thirteen shapes are read cases, but the five that are not (a
249+
passthrough inside the ciphertext subtree, a passthrough field carrying a
250+
ciphertext, a field, an output and a key given twice) are the engine guards
251+
the transport reaches natively alone, and the test is the module's
252+
load-bearing forged-plaintext check with its retrieval counter.
253+
- `refuses_fields_under_different_contexts_or_extensions` and
254+
`refuses_two_fields_keyed_under_one_identity`: each holds one shared row
255+
beside shapes the corpus has not got (one field extended and one not; two
256+
passthrough fields sharing a label).
257+
- `tests/op.rs` typed refusals (`a_match_query_with_no_tokens_is_refused_before_any_term_or_keyset`,
258+
`a_match_query_is_cut_in_nfc_and_refuses_text_with_no_normal_form`,
259+
`an_inverted_range_is_a_query_like_any_other`): the corpus's `typed` entries
260+
record the typed chain's refusal stage, not its `via`, batch, case-sensitive
261+
and bound-order assertions.
262+
- Go `TestPlanCheckAnswersWithoutACipher`, `TestQueryTermRefusesWhatTheFieldDoesNotAnswerBeforeState`,
263+
`TestGuestRefusesMalformedInputsBeforeState`, `TestCheckerRefusesAnIndexedUntypedField`:
264+
their rows are shared declaration and refusal cases, but each is about the
265+
uninitialised instance answering `ErrEncoding` before `ErrState`, or the
266+
host rule refusing before the engine, which the corpus runners do not observe.
267+
- Everything in the retained list above: compile-fail, ownership and
268+
zeroization, batching, property, frozen-bytes, generated-code, host
269+
conversion, error wrapping, cancellation, guest lifecycle, PostgreSQL and
270+
live-provider tests.

‎conformance/stack-encrypt/fixture-contract.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ which the record-interface test covers. Its existing SQL parameter conversion,
6969
empty-page, zero-query, inverted-range and floating-point ordering assertions
7070
remain in those selected tests. Wider operator refusal and secret-diagnostic
7171
tests remain in the full suites; this slice does not turn them into shared
72-
negative cases. In Go, `TestAQueryTheFieldDoesNotAnswerIsRefused` and
72+
negative cases. In Go, `TestVerifyAndTargetLimitRefuseWhatIsNotAMatchQuery` and
7373
`TestAMatchesQueryNeverPrintsItsText` share the fixture client, so they also
7474
fail on a missing guest in required mode. They remain outside the aggregate
7575
selection and the shared requirements; the missing-guest regression covers them.

‎conformance/stack-encrypt/v1/record-declarations-v1.cases.json‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,6 +2342,19 @@
23422342
"fields": { "reason": "unknown_output", "field": "value" }
23432343
}
23442344
},
2345+
{
2346+
"id": "output-not-string",
2347+
"input": {
2348+
"json": {
2349+
"value": { "context": ["users", "value"], "outputs": [1] }
2350+
}
2351+
},
2352+
"accepted": false,
2353+
"expected_error": {
2354+
"code": "stack_encrypt::dynamic_plan",
2355+
"fields": { "reason": "unknown_output", "field": "value" }
2356+
}
2357+
},
23452358
{
23462359
"id": "output-options-on-equality",
23472360
"input": {
@@ -2405,6 +2418,22 @@
24052418
"fields": { "reason": "passthrough_with_outputs", "field": "value" }
24062419
}
24072420
},
2421+
{
2422+
"id": "passthrough-with-index",
2423+
"input": {
2424+
"json": {
2425+
"value": {
2426+
"context": ["users", "value"],
2427+
"outputs": ["eq", "passthrough"]
2428+
}
2429+
}
2430+
},
2431+
"accepted": false,
2432+
"expected_error": {
2433+
"code": "stack_encrypt::dynamic_plan",
2434+
"fields": { "reason": "passthrough_with_outputs", "field": "value" }
2435+
}
2436+
},
24082437
{
24092438
"id": "type-unknown",
24102439
"input": {
@@ -2760,6 +2789,17 @@
27602789
"fields": { "reason": "invalid_target", "field": "value" }
27612790
}
27622791
},
2792+
{
2793+
"id": "target-number",
2794+
"input": {
2795+
"json": { "value": { "context": ["users", "value"], "target": 1 } }
2796+
},
2797+
"accepted": false,
2798+
"expected_error": {
2799+
"code": "stack_encrypt::dynamic_plan",
2800+
"fields": { "reason": "invalid_target", "field": "value" }
2801+
}
2802+
},
27632803
{
27642804
"id": "target-options-null",
27652805
"input": {

‎conformance/stack-encrypt/v1/record-query-refusals-v1.cases.json‎

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,6 +1457,58 @@
14571457
"refusal": "after_keyset"
14581458
}
14591459
},
1460+
{
1461+
"id": "ore-block-between-long-low",
1462+
"field": "title",
1463+
"operator": "between",
1464+
"input": {
1465+
"type": "list",
1466+
"items": [
1467+
{
1468+
"type": "string",
1469+
"text": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
1470+
},
1471+
{
1472+
"type": "string",
1473+
"text": "b"
1474+
}
1475+
]
1476+
},
1477+
"accepted": false,
1478+
"expected_error": {
1479+
"class": "term",
1480+
"code": "stack_encrypt::ore_block_too_long"
1481+
},
1482+
"typed": {
1483+
"refusal": "after_keyset"
1484+
}
1485+
},
1486+
{
1487+
"id": "ore-block-between-nul-high",
1488+
"field": "title",
1489+
"operator": "between",
1490+
"input": {
1491+
"type": "list",
1492+
"items": [
1493+
{
1494+
"type": "string",
1495+
"text": "a"
1496+
},
1497+
{
1498+
"type": "string",
1499+
"text": "b\u0000"
1500+
}
1501+
]
1502+
},
1503+
"accepted": false,
1504+
"expected_error": {
1505+
"class": "term",
1506+
"code": "stack_encrypt::ore_block_trailing_nul"
1507+
},
1508+
"typed": {
1509+
"refusal": "after_keyset"
1510+
}
1511+
},
14601512
{
14611513
"id": "inverted-range",
14621514
"field": "age",

0 commit comments

Comments
 (0)