Repository navigation
test(eql-bindings): build test values as frames of Rust values, not FfiValue - #1259
Conversation
…fiValue
eql-bindings' API takes a ValueFrame since the plaintext moved to frames,
but its tests still built every input as an FfiValue and read every
opened value back into one. That kept FfiValue looking like a plaintext
type eql-bindings depends on, which it no longer is.
The tests now write a Rust value straight into a frame
(ValueFrame::of(-7i32), ValueFrame::of("café")) and compare an opened
frame with the frame of the value expected, byte for byte, which checks
the kind and a float's bit pattern too. A null is the frame of
None::<i32>. The README's dispatch example, a Cargo.toml comment and an
unreleased CHANGELOG line still named FfiValue as the dispatch's plaintext
and now say ValueFrame.
No test changed what it asserts. eql-bindings and its encryption tests
no longer name FfiValue anywhere.
Refs #1252.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
coderdan
left a comment
There was a problem hiding this comment.
Automated high-effort review by a Claude Code sub-agent.
What I ran (in a fresh worktree of the stack, #1260 on top of this PR, since #1260 changes no test code):
mise run test:encryption: passes.v4_types12 passed and 3 ignored,targets16,heap_hygiene2, and theencryption::targetsunit tests 7 (115 unit tests withtargetsagainst 108 without). These match the counts in the description.cargo clippy -p eql-bindings --features stack-encrypt --all-targets -D warningsand--all-features: clean.- I compared every changed assertion with the one it replaces.
Assertions: nothing got weaker.
same()now compares frame bytes. The frame keeps the integer width (Int32andInt64stay apart, asfound: Some(ValueKind::Int64)in the unit test shows) and a float's bit pattern. So the check is at least as strict as the oldmatches!/to_bits()comparison.opened()now reads throughString::sink(). vitaminc'sFromScalar for Stringaccepts only(None, Physical::Text), which is the same as the oldFfiValue::Stringmatch.None::<i32>encodes assink.scalar(None, Physical::Null)in vitaminc'sOptionimpl, which is the same nullFfiValue::Nullproduced.- In
heap_hygiene, the frame is still built outsidewatched(), so the spy covers the same calls.
Findings (all low):
- The README's interop matrix still says "value enum".
packages/eql/crates/eql-bindings/README.md:195: "...in both directions between the typed plaintexts and the value enum." This PR renamed that direction to a frame inv4_types.rs(a_leaf_sealed_from_a_frame_opens_as_the_typed_plaintext), and the module docs there now say "frame".git grep FfiValuemisses this line because it never names the type. I'm putting it in this body because the line is outside the diff. - One test frames a frame twice. See the inline comment on
v4_types.rs:532. - The README sentence on line 121 reads badly. See the inline comment.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
cipherstash-agent
left a comment
There was a problem hiding this comment.
Review attestation: Claude Code /code-review medium + /cross-check-review-findings
Reviewed: head 36aadd6, all 8 changed files (full diff).
Critical / blocking: none.
Findings: none.
What I checked:
- Every
FfiValueuse inv4_types.rs,targets.rs,heap_hygiene.rsand thesrc/encryption/targets.rsunit tests was replaced with the equivalentValueFramebuilt from the same Rust value. The kinds are kept:frame::<i32>vsframe::<i64>still drives the "another kind is refused" cases, andNone::<i32>still stands in for null. same()now compares frame bytes. That checks kind and value, and a float's bit pattern, so the-0.0and NaN assertions are no weaker than the oldto_bits()match. The assertions are unchanged.- The README example,
Cargo.tomlcomments and CHANGELOG line now match what the code does. - The Rust CI jobs (
cargo test + clippy + rustfmt,Rust workspace crates,Build test archive) are green on this head. Go macOS/Windows, the Go live tests and the Postgres shards were still running when I looked. - No changeset is needed: this is tests and docs only, and the bot's "No Changeset" notice is expected. The CHANGELOG edit rewords an unreleased line.
Nothing to fix before merge. This is a review of the diff and CI state, not a local build or test run.
Generated by Claude Code
In a_value_of_another_kind_is_refused_not_converted each case is already built as a ValueFrame. Wrapping it in frame() again ran ValueFrame::of over a frame and wrote the same bytes, which read as if the value were still an FfiValue. Pass the frame straight to targets::encrypt. Refs #1252
…c frame The typed-path paragraph named stack_encrypt::dynamic::ValueFrame to say which leaf each type seals. A typed-only build does not build Stack Encrypt's dynamic module, so point at the Go SDK instead, which is the compatibility the sentence is about. The sentence also read badly. The interoperability matrix still called the other direction "the value enum". The tests now build value frames, so say that. Refs #1252
|
Reply to the review body's finding 1 (outside the diff, so no inline thread):
Findings 2 and 3 are answered on their inline threads (458d37a and 75336d3). Checks on 75336d3, from |
…pes compiles on next #1257 added a TextEq query to the v4 query fixture with an FfiValue input, and #1259 removed FfiValue from v4_types.rs. Each passed on its own; merged together on next, the test file does not compile. The input is now frame("alice@example.com"), as every other query there is, and the fixture's bytes are unchanged. (cherry picked from commit cd6d7c5)
Summary
eql-bindings maps EQL's Postgres types to Rust. Its by-name dispatch, which the Go SDK uses, has taken a
ValueFramesince #1245: one plaintext value in vitaminc's transport encoding. But its tests still built every input as anFfiValue, Stack Encrypt's untyped value tree, and read every opened value back into one. That madeFfiValuelook like a plaintext type eql-bindings depends on, which it no longer is. It's also the first step of #1252, which removesFfiValuealtogether.Changes
tests/encryption/tests/{v4_types,targets,heap_hygiene}.rs, and the unit tests insrc/encryption/targets.rs):ValueFrame::of(-7i32),ValueFrame::of("café"), andNone::<i32>for a null.as_frame,sealed_from_frame).FfiValueas the dispatch's plaintext, wrong since feat(stack-encrypt)!: hold a dynamic plaintext as its frame, not a value tree #1245:Cargo.toml;Cargo.tomlcomment.Verification
mise run test:encryptionandmise run test:crates: pass. The per-file counts matchnext:v4_typeshas 12 passing and 3 Postgres-only ignored,targets16,heap_hygiene2, and theencryption::targetsunit tests 7.cargo clippy -p eql-bindings -p eql-encryption-tests --all-features --all-targets -D warnings: clean.git grep FfiValue -- packages/eql: no matches.Related
Refs #1252 (proposal step 1). Step 2, the
targetsfeature, is #1260, stacked on this PR.