Skip to content

Commit 302a5f1

Browse files
committed
docs(v3): reconcile float spec with plan (cast tokens, oracle paths)
1 parent b699299 commit 302a5f1

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

docs/plans/2026-06-19-float-encrypted-domain-design.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,13 @@ generated by the existing kind-agnostic renderers.
6767
- **Two widths, one crypto path.** Both encrypt via `Plaintext::Float(Some(x as
6868
f64))`. `float4` fixtures use only values exactly representable in f32 (e.g.
6969
`0.5`, `-2.25`, powers of two) so the `real` round-trip is lossless; f32→f64
70-
widening is exact and monotonic, so the oracle holds. The bare `float` cast →
71-
`float8`.
70+
widening is exact and monotonic, so the oracle holds.
71+
- **Cast tokens — distinct per width** for surface faithfulness even though the
72+
ciphertext is identical f64: `float4``Cast::REAL` (plaintext column `real`),
73+
`float8``Cast::DOUBLE` (plaintext column `double precision`). Both resolve to
74+
`ColumnType::Float` in `cast_to_column_type`. The bare `float` cast is
75+
interchangeable with `double` and routes to `float8`. (Supersedes an earlier
76+
note that both would share `Cast::FLOAT`.)
7277
- **Total order.** `ScalarType` requires `Ord`, which `f32`/`f64` lack. Add thin
7378
harness newtypes `F4(f32)` / `F8(f64)` implementing `Ord` via `total_cmp` (safe —
7479
NaN is never stored), `Display`, `Default = 0.0`, and `#[sqlx(transparent)]`
@@ -139,10 +144,11 @@ fixture lists.
139144
discriminator arm (twin of the `numeric` arm).
140145
- `tests/sqlx/src/fixtures/scalar_fixture.rs` — a `float` arm (twin of `numeric`:
141146
`[Hm, Ore]`, pivot-presence asserts).
142-
- `tests/sqlx/src/fixtures/eql_plaintext.rs``PlaintextSqlType` consts
147+
- `tests/sqlx/src/fixtures/eql_plaintext.rs``Cast::REAL` / `Cast::DOUBLE` consts
148+
(add if absent; only `Cast::FLOAT` exists today) and `PlaintextSqlType` consts
143149
(`real` / `double precision`); `cast_for_kind` + `plaintext_sql_type_for_kind`
144-
arms for `F32`/`F64` (`Cast::FLOAT` already exists); `Sealed` + `EqlPlaintext`
145-
for `F4`/`F8``Plaintext::Float(Some(x as f64))`; three mirrored `#[test]`s.
150+
arms for `F32`/`F64`; `Sealed` + `EqlPlaintext` for `F4`/`F8`
151+
`Plaintext::Float(Some(x as f64))`; three mirrored `#[test]`s.
146152
- `tests/sqlx/src/scalar_domains.rs``F4`/`F8` newtypes (`Ord` via `total_cmp`,
147153
`Display`, `Default = 0.0`, `#[sqlx(transparent)]`); `float4_values()` /
148154
`float8_values()` accessors parsing catalog strings (incl. `"inf"`/`"-inf"`);
@@ -152,8 +158,9 @@ fixture lists.
152158
lists and the pivot/arbitrary test lists.
153159

154160
### C. Tests
155-
- `tests/sqlx/tests/encrypted_domain/{fixture_oracle.rs, e2e_oracle.rs}` — add
156-
`float4`/`float8` to both oracle suite lists.
161+
- `tests/sqlx/tests/encrypted_domain/property/{fixture_oracle.rs, e2e_oracle.rs}`
162+
add `float4`/`float8` to both oracle suite lists. (Oracle suites live under
163+
`property/`, not directly under `encrypted_domain/`.)
157164
- NEW `tests/sqlx/tests/encrypted_domain/float_special.rs` + `#[path]` mod in
158165
`encrypted_domain.rs` (outside `scalars::`) — the NaN/`±0`/`±Inf` behavioural
159166
regression suite.

0 commit comments

Comments
 (0)