feat(escrow): cut over to Rust core and retire process-escrow - #44
Draft
DCT-Berinyuy wants to merge 2 commits into
Draft
DCT-Berinyuy wants to merge 2 commits into
DCT-Berinyuy wants to merge 2 commits into
Conversation
Replace the process-escrow edge function calls with authenticated POSTs to bookbridge-rust-core (/escrow/confirm-receipt, /escrow/dispute), using the user's Supabase access token. Adds RUST_CORE_URL (defaults to the Render deployment) and data source tests with a mock HTTP client. Co-authored-by: Copilot App <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Repoint the hourly auto-release-escrows-job at the Rust core's /internal/escrow/process-releases (X-Internal-Secret from Vault) and delete the process-escrow edge function, now fully replaced by Rust. Co-authored-by: Copilot App <[email protected]>
Member
|
An edge function? |
This branch was successfully 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.
Right now the live Rust service returns 404 for
/escrow/confirm-receipt, which I verified. If this PR shipped first, confirm-receipt and dispute would break. It stays a draft until the steps below are done.SUPABASE_URLandSUPABASE_ANON_KEYon the service first, because it won't start without them.curl -i https://bookbridge-rust-core.onrender.com/escrow/confirm-receiptshould now return 405, not 404.SELECT vault.create_secret('<INTERNAL_API_SECRET from Render>', 'rust_internal_api_secret');supabase/migrations/20260927230000_auto_release_via_rust.sql. It refuses to run if step 3 hasn't been done.supabase functions delete process-escrow.Why
This moves every escrow path off the
process-escrowedge function (GHSA-xq84-qm9j-hf6p) and onto Rust's guardedrelease_escrow, which requires both rows to beheldand de-duplicates payouts with Fapshi.What
App
confirmReceipt→POST {RUST_CORE_URL}/escrow/confirm-receipt;disputeTransaction→POST {RUST_CORE_URL}/escrow/dispute.Authorization: Bearer <Supabase access token>, refreshing the session first if it has expired. With no session, the app asks the user to sign in and sends nothing.{"error": ...}message, orRequest failed (<status>)if the body isn't JSON.RUST_CORE_URLdart-define, defaulting tohttps://bookbridge-rust-core.onrender.com. It's a public URL, so existing build commands and CI are unaffected.Cron:
auto-release-escrows-job(hourly) now calls/internal/escrow/process-releaseswithX-Internal-Secretfrom Vault and a 120 s timeout.Removed:
supabase/functions/process-escrow.Known gap
The edge function's admin-only
resolve-disputeaction has no Rust equivalent yet. Nothing in the repo called it, and its "refund" only changed statuses without returning money. Until Rust gets an admin resolve endpoint, disputes are resolved by hand. That endpoint needs to exist before real buyers transact.Test plan
flutter test: 8 new data source tests usingMockClient. All 17 pass.flutter analyze: no new issues.