Repository navigation
refactor(core): flatten RowEvent once in the core - #1133
Merged
Merged
Conversation
Both bindings carried an arm-for-arm match over the four RowEvent variants producing the same flat record. Move that decision into a pure, unit-tested dirsql::flatten_row_event and leave each binding its marshaling half. Fixes #1131
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1131. Part of #1072.
Both bindings carried the same arm-for-arm
matchoverRowEvent's fourvariants, producing the same
{table, action, row, old_row, error, file_path}record. That decision is language-neutral, so it moves into the core as
dirsql::flatten_row_event(#[doc(hidden)],packages/rust/src/row_event_flat.rs),the shape
extension_resolutionestablished. Each binding keeps only itsmarshaling half:
value_row_to_py_dictover the borrowed rows plus the GILstep for PyO3,
value_row_to_jsplus the unsafe-integer error for napi.Rows are borrowed (
Option<&'a Row>), so no clone is added in the core; theclone stays at the binding boundary where it was already paid.
PlainRowEvent/row_event_to_plainare gone frompackages/python/src/lib.rs,and the four Python tests that only restated the flattening moved into the core
(joined by a fifth:
Errorwith a named table, which neither binding covered).The napi tests stay put — they assert on the napi
RowEventstruct and covervalue marshaling and the unsafe-integer error path, which is the binding's own
half, not the flattening.
No public API changed in any SDK. No migration fragment.
One shape note
row_event_flat.rsimportsValueat module level under#[cfg(test)]ratherthan inside the test module:
unit lint'sno-out-of-module-importruleforbids a unit test importing
crate::db::Valuedirectly, and an unconditionalmodule-level import would be unused in a non-test build. This mirrors how
differ.rstests reachValuethroughuse super::*.Cross-SDK Parity
Parity-restoring, not drift: no SDK's observable surface changes, and the
flattening that was implemented twice is now implemented once for both.
PARITY.mdgains a "Where the row-event flattening lives" note under CoreTypes, matching the
extension_resolutionnote. No follow-up issues needed.Manual verification
Built both bindings and watched a real directory through each SDK, observing
all four variants.
Python (
uv run maturin develop --uv, then a script drivingdb.watch()overa temp dir):
Node (
pnpm build, then a script drivingfor await (const e of db.watch())):Same field values, same action strings, same error path as before the move.
just preflight(with nightly on PATH for the Rust coverage gate): 0 failingpairs, 3 skipped (
packaging). The Rust coverage floors did not move — thechange adds fully-covered core lines and removes none, so no re-pin of
[rust.coverage].E2E Verification
cargo test --workspace)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)just e2e-attest-python,just e2e-attest-ts,cargo test --workspace,just preflightChangelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (packages/rust,packages/python,packages/ts)<root>/<pkg>/migrations.d/(or: not required -- additive/bugfix only) — not required: no public API change, no behavior change