Repository navigation
feat(writeback): apply approved Salesforce merges through a durable journal (#995) - #1317
Merged
Merged
Conversation
Contributor
|
The marketing preview was removed because this PR is closed or merged. |
…ournal (#995) POST …/merge-previews/apply (Admin) queues a merge_apply job: one control task that executes exactly the approved proposals, acting as the connection's delegated reviewer (#994). - APPROVED → APPLYING is a conditional insert under a unique index (at most once per preview), journaled in the same transaction; each apply settles once into applied / failed / skipped_stale / applied_externally. - Before any write, every member is re-read (queryAll): a moved SystemModstamp skips the group as stale and queues an incremental extract so the next generation re-scores it; a victim deleted with MasterRecordId = master is external-merge evidence; a missing victim proves nothing and fails the group. - The preimage is persisted before the first mutation; the master update (PATCH) and each merge batch (SOAP merge(), ≤2 victims) are journaled in flight before the call. An in-flight operation is resolved by the next run's re-read, never replayed blind. - Reads retry with backoff; mutations retry only on 429/503 (Retry-After honoured up to 30s); any other post-send failure is ambiguous. API-budget exhaustion and exhausted rate limits stop the job and the begun group resumes. Groups fail in isolation; cancellation is checked between them. - Entities merge_apply and merge_apply_operation; the executor carries an Egress (Guarded in product code) so the test can reach a mock. Co-Authored-By: Claude Opus 5.5 <[email protected]>
athvin
force-pushed
the
feat/995-journaled-apply
branch
from
November 27, 2026 06:56
23fe622 to
0f181f4
Compare
athvin
temporarily deployed
to
marketing-preview
November 27, 2026 07:04 — 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 #995
The
merge_applyjob (one control task,apply_merges),src/merge_apply.rs(the journaled state machine),src/sf_apply.rs(queryAll / PATCH / SOAP merge with classified outcomes), entitiesmerge_apply+merge_apply_operation, the apply route, anEgressonExecutorConfig, and the as-built contract inconnectors.md§4.3.2.#995: execute exactly the approved proposals, safely, with a durable record. Builds on #993 (previews) and #994 (delegated authorization); #996 restore reads its preimages.
Proof
pg_merge_apply: eight approved groups against a mock Salesforce (queryAll, PATCH, SOAP merge, token refresh) — clean apply (victim deleted withMasterRecordId= master, preimage stored); stale member →skipped_stale+ one resync extract queued, no mutation; external merge →applied_externallywith zero mutations; missing victim →failed; a 429 withRetry-Afterretried to success; a merge whose response was lost (performed, then 500) left in flight, then resolvedverifiedby the next run's re-read with no second merge call; a rejected merge (ENTITY_IS_LOCKED) fails its group while the batch continues;REQUEST_LIMIT_EXCEEDEDstops the job and the begun group resumes and applies next run; a third run touches nothing. Journal pathplanned → approved → applying → applied. Route: 409 with nothing approved, viewer 403, admin 202. Full Postgres suite 159 passed;make checkexit 0.Risk & rollback
Writes to customer Salesforce only for previews a human approved, through a grant an admin authorized; nothing in dev has a grant.
git revert <merge-sha>.Post-merge ledger
Closed by: agent · session
Claude Code:24d16c2e-fec6-49d8-9797-060338df4848onbrians-MacBook-Pro· 2026-11-27T07:20:43Zmainis 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: — 5ed5a11: rust 45955972000 success; its frontend run was cancelled by the next merge's burst, so frontend is proven on d05da84 (contains 5ed5a11), run 45956035108 success
imagesbuilt, or correctly never ran because nothing that goes intoan image changed: — success, run 45955972021 (and 45956035174 on d05da84)
deployconverged — proved by a line the running process emitted, notby the image digest and not by the workflow conclusion: — run 45956397395 deployed d05da84 (contains this change); the live process serves the new route:
https://dupezero.com/api/openapilists/merge-previews/applydeploy,drift,kind's nightly leg) is green, or knowingly red for a reason that is notthis change: — infra, devcontainer success on 5ed5a11; marketing preview success on d05da84
Donethrough the automation rather than byhand, and the issue closed: — E9: Apply approved Salesforce merges with a durable journal #995 CLOSED by feat(writeback): apply approved Salesforce merges through a durable journal (#995) #1317 via automation
(a skill, a reference, memory) — or nothing new was learned: — a new required-ish workflow (
stale tree guard, feat(ci): flag a pull request whose files return to an older main version (#1307) #1315) fails on a branch cut before it existed because its script is absent; rebasing is the fix, not a findingSpecific to this change
merge_appliesandmerge_apply_operations— the new pod serves (boot reconcile refuses to start on a failed apply), run 45956397395Context — plan, discoveries, measurements, files
Plan
Discoveries
merge()is SOAP-only, so the apply speaks both.INSERT … SELECT's WHERE to the insert target's accepted values (E010), somerge_apply/create/beginbinds'approved'as a parameter.Measurements
Files
🤖 Generated with Claude Code