Conversation
… compiles again The Swift job on v5.1-dev fails with "the compiler is unable to type-check this expression in reasonable time" at SendTransactionView.swift:80. The view's body was one expression of about 365 lines: the whole form, the toolbar with the Send action inline, four alerts and the change handlers. Each form section, the toolbar, the sending overlay, the scanner sheet and the Send action are now their own members, and the four result alerts are a view modifier. The view tree, modifier order, strings and identifiers are unchanged, and the Core balance is still read once per render. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 27 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
|
🔍 Review in progress (commit c8b37fd) · live progress |
…text ContractDownloader.apply saves the refreshed contract in a context of its own, and the caller's context kept its old copy: a context does not take in another context's save until it fetches. The update screen's contract stayed at the old version, and its keyword relations could still point at a keyword row the refresh deleted, which crashes on read. apply now takes the caller's context and, after its save, fetches the contract, its keywords, tokens and document types again there. The tests no longer wait on the run loop for a merge that never comes; they check the main context as soon as apply returns. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…yte limit The preview's budget counted each record as encoded on its own, but the text it returns indents every record line, separates records, and wraps them in the inputs and a cursor or note. With a 2,000 byte limit it returned 2,668 bytes. The budget now starts at the size of the text around the records and charges each record as emitted. The emitted text for a given set of records is unchanged. The test checks the limit it passes in. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
Changes requested: 1 blocker
- Core payments can fail because Send picks the funding account from Platform balances —
packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/SendTransactionView.swift:442-454(new)
Impact: A wallet owner with enough confirmed Core funds outside the selected BIP44 account can tap an enabled Send button and have the payment fail before broadcast.
This PR splits the SwiftExampleApp send screen into smaller view builders, reloads saved contract data in the caller’s SwiftData context, and counts the bytes actually rendered in removal previews. On b4128cd, the Swift build and tests passed with warnings treated as errors, and the frozen-schema check passed. PR Hygiene and PastaClaw review were pending; no code checks were failing.
🔴 1 blocking | 🟡 3 suggestion(s)
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)
- Triage:
normalbygpt-6.2-sol(effort low) — The PR combines a substantial SwiftUI refactor with fixes to SwiftData refresh behavior and preview byte accounting, but it does not change transaction or coin-selection logic, protocol rules, or storage schemas. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort xhigh); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity quota lookup failed),glm-5.3-flash(not used above high effort; tier asks max) - Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
- Fresh verifier:
gpt-6.2-sol— final-verifier; agentsol-verifier - Phase 2 reviewers:
gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— general (completed, effort high); agentphase2-reviewer,gpt-6.2-sol— architecture-layering (completed, effort high); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/SendTransactionView.swift`:
- [BLOCKING] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/SendTransactionView.swift:442-454: Core payments can fail because Send picks the funding account from Platform balances
Impact: A wallet owner with enough confirmed Core funds outside the selected BIP44 account can tap an enabled Send button and have the payment fail before broadcast.
A user who received enough DASH through a DashPay contact but has an empty BIP44 account can open Wallet Details → Send, enter a valid Core recipient and amount, and still get an insufficient-funds error. The screen offers Core based on confirmed balances across accounts, but the branch moved into `sendTapped()` takes an index from the first funded key-class-0 Platform address, or defaults to zero. `SendViewModel.swift:788–792` then asks Rust to fund from exactly that BIP44 account, excluding the contact funds. The other branch also makes a funding decision in the view: it can reject a Platform transfer using cached balances and an estimated fee before Rust checks proof-verified balances. Use the existing `.allSpendable` scope and matching `pooledSpendableBalance` for ordinary Core payments, and put automatic Platform payer selection in `rs-platform-wallet` alongside transfer planning. The view should pass a specific account only when the user chose it.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Utils/ContractDownloader.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Utils/ContractDownloader.swift:525-531: The update screen dismisses as successful when the caller’s contract reload fails
Impact: If SwiftData cannot reload the caller’s models after saving a contract update, the owner can be returned to details that still show the old version or relationships.
A successful save does not mean the models already held by the screen are current. Both reload fetches discard errors with `try?`, so `UpdateContractView.refreshStoredContract` returns no failure and the confirmation dismisses back to a view that holds the same contract. If the contract fetch failed, that model can still hold old metadata or relationships to rows the save deleted. Keep the committed save, but return a distinct reload-only failure so the screen can retry the local read or rebind its models before dismissing, without resending the Platform update or discarding unrelated edits.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/QueryDetailView.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/QueryDetailView.swift:1576-1589: A removal page can lose records and its cursor even when the full preview fits
Impact: When a complete removal page fits the byte limit with its cursor but not with the longer truncation note, the query catalog hides records and tells the user to rerun the query.
Users can lose the page’s continuation cursor even though nothing needed to be cut. The formatter reserves the longer truncation note before counting records, then drops the cursor as soon as that inflated budget forces a cut. With the existing whole-page fixture, set `maxBytes` to the complete output’s UTF-8 count: the short cursor fits, but the note makes the final record exceed the budget. Count against the actual complete-page framing first; only if that cannot fit, switch to the truncation note and trim the buffered suffix as needed. Add an exact-fit test that checks both the record count and the cursor.
In `packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/ContractRefreshApplyTests.swift`:
- [SUGGESTION] packages/swift-sdk/SwiftExampleApp/SwiftExampleAppTests/ContractRefreshApplyTests.swift:182-184: The refresh tests do not exercise document types the caller already holds
Impact: A regression that leaves a previously loaded document type or its index and property relationships stale would pass the current cross-context tests.
The new document-type prefetch has no test that distinguishes refreshed caller objects from correctly saved rows. These tests cover contract metadata, replaced keywords, and insertion of a first token; the parser’s own tests write and read in the same context. Seed an existing document type, load its indices and properties in the caller’s context before `apply`, then assert that the same held type reflects the changed definition and relationships immediately afterward while the unrelated edit remains pending.
|
Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them. |
…t be read again After a refresh is saved, the caller's context fetches the refreshed rows. A failure of that fetch was dropped, so the update screen could close on a contract it still held stale. It is now thrown: the screen's existing refresh failure path shows it and offers the refresh again, which accepts the version just saved and fetches the rows again. Adds a test that a document type, its properties and its index held by the caller's context show the refreshed definition as soon as apply returns. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…it exactly The preview reserved room for the truncation note before counting any record. A page that fit the limit with its cursor, but not with the longer note, was cut and lost its cursor. Records are now counted against the whole page's text first. Only when the page does not fit does the note replace the cursor, and records are dropped from the end until the text with the note fits. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post |
Basic explanation
The "Swift SDK build + tests" job fails on every pull request based on
v5.1-dev. First the app does not compile: the Swift compiler gives up on the send screen because itsbodyis one very large expression. Once that is fixed, three app tests fail, and they point at two real defects: a refreshed contract did not show on the screen that asked for the refresh, and the removal records preview went over its size limit. This PR fixes all three so the job can pass.Issue being fixed or feature implemented
1. Compile error. The job stops with:
SendTransactionView.bodywas a single expression of about 365 lines. #6051 added about 180 lines to it. #6085, #6013 and #6093 all failed on this line, while pull requests based onv5.2-devpass.2. A refreshed contract stays stale.
ContractRefreshApplyTests(from #6053) failed twice and then crashed the test host:ContractDownloader.applysaves the refreshed contract in a context of its own. The caller's context kept its old copy, because a context does not take in another context's save until it fetches. So after a refresh the update screen's contract still showed the old version and description, and its keywords could still point at a row the refresh had deleted, which crashes when read.3. The removal records preview passes its limit.
RemovalsPreviewFormatterTests(from #6056) failed with("2668") is greater than ("2600")for a 2,000 byte limit. The formatter counted each record as encoded on its own, but the text it returns indents every record line, separates the records, and wraps them in the inputs and a cursor or note.The same three tests already failed on #6056 before it merged. The compile error then hid them.
What was done?
1. Send screen (
SendTransactionView.swift).bodyis split into small members. The screen looks and behaves the same.Before:
After:
presentedFormapplies the title, toolbar, sending overlay and alerts tosendForm, in the same order as before.sendFormholds theFormand its conditions. Each section is its own member:recipientSection,amountSection(coreBalance:),memoSection,sendFromSection(sources:coreBalance:),transactionTypeSection(flow:), next to the three that already existed.sendToolbar,sendingOverlayandqrScannerSheethold the toolbar items, the progress overlay and the scanner.sendTapped()is the Send button's action, moved unchanged. It still refreshes the shielded fees first and reads the tapped flow, recipient, identity and amount before itsTaskstarts.SendResultAlertsis a file-private view modifier with the four alerts in their original order. The screen passes its owndismissin, so the "Done" buttons close the same sheet.The Core balance is still read once per render and passed down. All existing comments moved with their code. Strings, accessibility identifiers and labels are unchanged.
2. Contract refresh (
ContractDownloader.swift).applynow takes the caller'sModelContextinstead of its container. It still writes in a context of its own and saves only its own rows. After the save it fetches the contract again in the caller's context, with its keywords, tokens and document types (and their indexes and properties), so the copies the caller already holds show the refresh whenapplyreturns. A fetch leaves the caller's pending edits alone. If that fetch fails, the refresh is saved but the caller's copies are stale, soapplyreports it. The update screen's existing refresh failure state shows the message and offers the refresh again, which accepts the version just saved and fetches the rows again.Before, after
refreshPersistedContractreturned for an update to version 3:After:
3,"New"and the new keywords, as soon as the call returns.The tests used to run the main run loop for up to two seconds waiting for the main context to pick up the save, which never happens. They now check the main context right after
applyreturns.3. Removal records preview (
QueryDetailView.swift). The budget now starts at the size of the text around the records and charges each record as it is emitted, with its indentation and separator. The text produced for a given set of records is unchanged; only where the preview stops changes. Records are counted against the whole page's text first, so a page that fits its limit exactly is shown whole with its cursor; only when it does not fit does the note replace the cursor, and records are dropped from the end until the text with the note fits. The inputs and the note are always shown, even if they alone pass the limit, and the doc comment says so. The test now checks the limit it passes in (2,000) instead of 2,600, and new tests cover a page at exactly its size and one byte under.How Has This Been Tested?
build_ios.sh --target sim --profile dev), then ran the job's app build command with warnings as errors:** BUILD SUCCEEDED **, with no warning from the changed files.** BUILD SUCCEEDED **, then the three tests above failed. That run is https://github.com/dashpay/platform/actions/runs/45078895991/job/137382534279.ContractRefreshApplyTests(5),RemovalsPreviewFormatterTests(5) andInputBoundSubmissionsTests(6, also coversQueryDetailView):Executed 16 tests, with 0 failures. The new contract refresh test holds a document type, its properties and its index in the main context and checks they show the refreshed definition.-warn-long-function-bodies=20 -warn-long-expression-type-checking=20:body: 126 mssendTapped(): 22 ms,sendFromSection: 21 ms, everything else under 20 msThe local machine has a newer Xcode than the runner (which uses the iOS 18.5 simulator SDK), so this PR's own Swift job is the proof for the runner.
Not changed here: the review pointed out that Core sends are funded from one BIP44 account chosen from Platform address rows. Those lines are only moved by this PR and behave as on
v5.1-dev; #6105 tracks the fix.Not done: the send flows and the contract update screen were not exercised by hand in the simulator, and the full app test suite was not run locally.
Breaking Changes
None.
ContractDownloader.applyis internal to the app; its only caller isrefreshPersistedContract.Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
c8b37fd/skip-botsproceeds without the ones not yet reported/self-reviewedswift-sdk(packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Core/Views/SendTransactionView.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Utils/ContractDownloader.swift,packages/swift-sdk/SwiftExampleApp/SwiftExampleApp/Views/QueryDetailView.swiftand 2 more) — llbartekll or romchornyiWhen every merge requirement is met, the
PR Hygienecheck passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.