feat(compare): filter and limit rows per table, review them in a grid, and fix the data sync script - #2854
Merged
Conversation
…, and fix the data sync script
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
…a row's exclusion across a run
Member
Author
|
Second commit answers a review pass over the first one. What it changes:
|
…ore reporting them, and surface a rolled-back run
Member
Author
|
Third round: 20 findings from a Codex review of the whole branch against Four that could corrupt or misreport a sync
Also in this round
Verification
|
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 #2537.
Data mode existed in Compare & Sync, but it could not do the job the issue asks for, and the script it generated was wrong in ways that would have written to the wrong table. This gives each table its own comparison scope, shows the rows in a grid, and repairs the sync path underneath.
The feature
Per-table scope. Select a table in the Rows tab and set its key columns, its compared columns, a SQL filter and a row limit. Each table keeps its own; a saved comparison stores all four.
--,#,/* */) or an unclosed quote or parenthesis is refused before either side is read, and the parentheses are checked under both readings of a backslash, because MySQL treats it as an escape inside a literal and PostgreSQL does not.LIMIT,OFFSET/FETCHorTOP, per dialect) along with aIS NOT NULLon each key column, and the walk stops after N keys or as soon as a side that hit its limit runs out. A per-sideLIMITalone would have reported the other side's later keys as inserts and deletes.updated_atin one table no longer excludes it everywhere.Filter boundary. A row that matches the filter on one side and exists outside it on the other is looked up by key on the other side after both streams drain, and lists as Outside Filter. It is never written, so a filtered sync cannot overwrite a row that belongs to another tenant or region, and cannot emit an INSERT that collides with an existing key. Redgate ships the naive version of this and its forum carries the resulting
Violation of PRIMARY KEYreport.Row review. The rows show in the data grid, read-only, with every column. A row only in the source is underlined, a row only in the target is struck through, and a changed row shows its source line over its target line with each differing value marked. Marks carry a symbol as well as a tint, and read to VoiceOver in comparison words rather than the grid's editing words. Include is a checkbox column;
Spacetoggles the selection.This needed three additions to the data grid, all opt-in: a checkbox column kind, a struck-through mark for a replaced value, and a compare vocabulary for the accessibility description. Everything else in the grid behaves as before.
The defects this repairs
Found while tracing the issue, each one in the path the feature extends:
stagingtopublicsync wrote back intostaging.'007'was written as007, andWHERE code = 007matches7,07and007on MySQL. Literals are now typed by the target column.GENERATED ALWAYScolumns were inserted without their override.IDENTITY_INSERTis opened and always closed again, even when the run stops, fails or is cancelled, because it is session state on a pooled connection.Verification
verify.sh build: PASS.verify.sh test: 493 cases across the compare, data grid and data write suites, 0 failed. New coverage: the merge join's limit and filter rules, duplicate and case-only keys, the difference digest, typed literals, identity handling, session-scope closing, per-table scope persistence with the legacy decode path, the session's gating and refusals, and the grid model.swiftlint --stricton the changed paths: clean.docs/scripts/check-writing-style.shandcheck-docs-against-source.py: clean.#comments, backslash escaping) are fixed above with tests.No UI automation: the Compare & Sync window is license gated and the UI test sandbox carries no license, so XCUITest cannot open it.
CompareSyncUITestsdocuments that, and the window's contract is covered by unit tests instead. For the same reason there are no before and after screenshots: the window cannot be opened in a throwaway sandbox.