You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 54e952c
Browse filesBrowse the repository at this point in the historyBrowse files
fix(stack-encrypt): address the review of the query preparation
`dynamic::term` re-framed its probe value, which a uuid cannot survive,
so a probe `defines` took was refused; it now reads the value as given.
`Operator::OP` and `Leaf::AT` default to `None`, so an operator outside
the crate needs nothing new. The jsonpath doctest moves to `check_query`.
The one-index-per-operator rule is stated as a plan's rule, since the
low-level `indexed` and `encrypt_as` run any set, and two match indexes
were already a duplicate. A conformance case pins `overlapping_outputs`,
a unit test ties each index's operator list to its `Supports` impls, and
a heap-hygiene watch covers the typed equality query. The typed match
query's own unwiped text is #1593.
Refs #1279
{"every index on an integer", "\tScore int64 `stash:\"score,encrypt,index=equality;ore\"`\n\tRank int32 `stash:\"rank,index=ope\"`"},
325
325
{"two order indexes on an integer", "\tScore int64 `stash:\"score,encrypt,index=ore;ope\"`"},
326
326
{"orders on a decimal, a date and a timestamp", "\tAmount encrypt.Decimal `stash:\"amount,encrypt,index=equality;ore\"`\n\tDay encrypt.Date `stash:\"day,encrypt,index=ope\"`\n\tAt time.Time `stash:\"at,encrypt,index=equality;ore\"`"},
327
-
{"orders on text, bytes and a float", "\tName string `stash:\"name,encrypt,index=ore;ope;match\"`\n\tBlob []byte `stash:\"blob,encrypt,index=equality;ore\"`\n\tScore float64 `stash:\"score,encrypt,index=ore\"`"},
327
+
{"orders on text, bytes and a float", "\tName string `stash:\"name,encrypt,index=ope;match\"`\n\tBlob []byte `stash:\"blob,encrypt,index=equality;ore\"`\n\tScore float64 `stash:\"score,encrypt,index=ore\"`"},
328
328
{"a match query on an index-only field", "\tName string `stash:\"name,index=match\"`"},
Copy file name to clipboardExpand all lines: packages/stack-encrypt/docs/adr/0009-operators-select-the-index-and-a-query-term-is-not-the-stored-term.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1240,22 +1240,29 @@ query chain calls it once, when the query is awaited and before any keyset
1240
1240
is resolved, then keeps the verifier until the term is derived. A match
1241
1241
query cuts its tokens once. `check_label` and `QueryToken` are unchanged.
1242
1242
1243
-
**Refusals are written once.** What a query is refused for before any term
1244
-
exists lives in `sem::query`, one function per index: match options the
1245
-
index cannot use, text that cuts no token, text an equality or order index
1246
-
cannot normalize, and block ORE text over its limit. The typed `prepare`
1247
-
impls and the dynamic path (`check_query`, `query_term`, `verify`) call the
1248
-
same functions, so neither has a copy of a rule. A consequence for the
1243
+
**The scalar refusals are written once.** What a scalar query is refused
1244
+
for before any term exists lives in `sem::query`, one function per index:
1245
+
match options the index cannot use, text that cuts no token, text an
1246
+
equality or order index cannot normalize, and block ORE text over its
1247
+
limit. The typed `prepare` impls and the dynamic path (`check_query`,
1248
+
`query_term`, `verify`) call the same functions, so neither has a copy of
1249
+
a rule. The JSON document operators' refusals (a path that does not parse,
1250
+
a container at a path, a path the field does not order) are still written
1251
+
for the typed index and for the dynamic path separately; they join when
1252
+
the dynamic path runs the typed derivation (the plan's step 4). A consequence for the
1249
1253
typed chain: an equality or order query of text that cannot be normalized
1250
1254
is refused before the keyset is resolved, as the dynamic path refused it
1251
1255
already. The equality index reads a copy of the value for that check, so
1252
1256
its plaintext is `Clone`. The shared conformance profile
1253
1257
`record-query-refusals-v1` pins both paths at the same stage.
1254
1258
1255
-
**A field declares at most one index per operator.**`(Equality, Ore)`
1256
-
answer different operators and are allowed. `(Ore, Ope)`, `(Ore,
1257
-
OreBlock)` and two match indexes are refused when the plan is built, on
1258
-
both paths (`PlanError::IndexOverlap`, `overlapping_outputs`). Each index
1259
+
**A field of a plan declares at most one index per operator.** `(Equality,
1260
+
Ore)` answer different operators and are allowed. `(Ore, Ope)` and `(Ore,
1261
+
OreBlock)` are refused when the plan is built, on both paths
1262
+
(`PlanError::IndexOverlap`, `overlapping_outputs`); two match indexes were
1263
+
already one index twice (`DuplicateIndex`). The rule is a plan's: the
1264
+
low-level `indexed(..)` operation and `encrypt_as` run any set of indexes,
1265
+
since no plan holds them and no query reads the second term. Each index
1259
1266
declares the operators it answers once (`Equality::OPERATORS`,
1260
1267
`Ore::OPERATORS`, …), and the dynamic lookup reads that declaration with
1261
1268
no priority between indexes, since a plan never holds two that answer one
0 commit comments