Repository navigation
feat(writeback): restore merged Salesforce records and revert master changes (#996) - #1320
Merged
Merged
Conversation
…changes (#996) POST …/merge-previews/{id}/restore (Admin) undoes an applied merge from the apply's journal; GET shows its steps and conflicts. One undo per apply — a repeat request returns it and queues nothing. - Resolution side: a never-match assertion per (master, victim), staged exactly as the engine's unmerge does, so resolution does not re-propose. - Victims: SOAP undelete() from the Recycle Bin; when the bin no longer has the record, recreated from the preimage (system fields dropped) with the old → new id recorded; a victim already live is left alone. - Master: each field the apply wrote is reverted only where Salesforce still holds what the apply wrote; a value already back is left; anything else is a conflict, never overwritten. - merge_restore_steps are journaled in flight before each call: a lost undelete is resolved by the next run's re-read; a recreate with an unknown outcome is a conflict, never retried (it could duplicate). - Records the merge reparented are NOT moved back, and the view says so (related_records_reverted: false). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
athvin
temporarily deployed
to
marketing-preview
November 27, 2026 07:20 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Closes #996
The
merge_restorejob (restore_merges),src/merge_restore.rs, three Salesforce calls insf_apply(SOAPundelete(), REST create, field read), entitiesmerge_restore+merge_restore_step, the POST/GET restore routes, andconnectors.md§4.3.3.#996: an applied merge must be undoable from its journal — without overwriting edits made since and without pretending reparented children move back.
Proof
pg_merge_restoreagainst a mock Salesforce (queryAll, query, PATCH, create, SOAP merge/undelete): three groups applied through #995, then undone. A: victim undeleted, master Email reverted →restored. B: Recycle Bin emptied and the master edited after the merge → victim recreated with old→new id recorded, the edited Email reported as a conflict and left untouched →partial. C: the undelete's response lost → left in flight, thenverifiedby the next run with no second undelete call. Never-match assertions staged; a repeated undo queues nothing; viewer 403; another tenant 404; nothing-applied 404; a third run touches nothing; the journal readsplanned → approved → applying → applied → restoring → partial. Full Postgres suite 160 passed;make checkexit 0.Risk & rollback
Admin-only, acts only on our own applied merges, refuses to overwrite anything changed since.
git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onbrians-MacBook-Pro· 2026-11-27T07:39:08Zmainis green with this change on it — the merge SHA, and the runthat proves it. A later head SHA with this commit as an ancestor counts;
a cancelled run with zero jobs does not: — 14f24d0, rust 45957756424 + frontend 45957756342 success
imagesbuilt, or correctly never ran because nothing that goes intoan image changed: — success, run 45957756451
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: — run 45958143471 success; the live process serves the new route:
https://dupezero.com/api/openapilists/merge-previews/{preview_id}/restoredeploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: — infra, devcontainer, marketing preview all success on 14f24d0
Donethrough the automation rather than byhand, and the issue closed: — E9: Restore merged records and revert approved master changes #996 CLOSED by feat(writeback): restore merged Salesforce records and revert master changes (#996) #1320 via automation
(a skill, a reference, memory) — or nothing new was learned: — nothing beyond the PR's Discoveries
Specific to this change
merge_restoresandmerge_restore_steps— the new pod serves (boot reconcile refuses to start on a failed apply), run 45958143471Context — plan, discoveries, measurements, files
Plan
Discoveries
merge(),undelete()is SOAP-only.Measurements
Files
🤖 Generated with Claude Code