PE-8687: show Turbo-uploaded files immediately with pending status#2089
PE-8687: show Turbo-uploaded files immediately with pending status#2089vilenarios merged 3 commits intodevfrom
Conversation
Remove blocking break statement in sync process that prevented unmined transactions from being displayed. Files uploaded via Turbo are now visible immediately with pending/orange status indicators. Changes: - Process unmined transactions (block == null) with block height 0 - Group unmined transactions separately in blockHistory - Leverage existing transaction status system for pending→confirmed flow - Existing cleanup marks transactions as failed if unmined > 24 hours Impact: - Turbo-uploaded files appear in 2-5 seconds instead of 30+ minutes - Better UX for cross-platform uploads (ardrive-core-js → web) - No breaking changes, uses existing pending transaction infrastructure
WalkthroughAdded an optional Changes
Sequence Diagram(s)sequenceDiagram
participant Sync as SyncRepository
participant Arw as ArweaveService
participant Agg as BlockAggregator
Note over Sync,Arw: caller may supply currentBlockHeight (optional)
Sync->>Arw: createDriveEntityHistoryFromTransactions(entityTxs, ..., currentBlockHeight?)
loop per transaction
Arw->>Arw: compute blockHeight = transaction.block?.height ?? currentBlockHeight ?? lastBlockHeight
alt blockHeight changed from previous
Arw->>Agg: emit previous BlockEntities
end
Arw->>Agg: add transaction to BlockEntities(blockHeight)
end
Arw->>Agg: emit final BlockEntities
Agg-->>Sync: DriveEntityHistory (grouped by computed blockHeight)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/services/arweave/arweave_service.dart (1)
436-439: Critical: Incorrect lastBlockHeight when unmined transactions are processed last.If unmined transactions are processed last (or exist anywhere in the list),
blockHistory.last.blockHeightcould be 0, which would be returned as thelastBlockHeightin the result. This breaks subsequent syncs because they would think the last processed block was 0, potentially causing reprocessing of the entire history.The returned
lastBlockHeightshould be the highest mined block height, excluding virtual block 0.Apply this diff to track the maximum mined block height correctly:
final blockHistory = <BlockEntities>[]; + int maxMinedBlockHeight = lastBlockHeight; for (var i = 0; i < entityTxs.length; i++) { final transaction = entityTxs[i].transactionCommonMixin; final tags = HashMap.fromIterable( transaction.tags, key: (tag) => tag.name, value: (tag) => tag.value, ); if (driveKey != null && tags[EntityTag.cipherIv] == null) { logger.d('skipping unnecessary request for a broken entity'); continue; } // Process unmined transactions (block == null) with block height 0 // They will be marked as pending and cleaned up by _updateTransactionStatuses // if they remain unmined beyond the timeout thresholds (8-24 hours) final blockHeight = transaction.block?.height ?? 0; + + // Track the highest mined block height for the next sync + if (blockHeight > 0 && blockHeight > maxMinedBlockHeight) { + maxMinedBlockHeight = blockHeight; + } if (blockHistory.isEmpty || blockHistory.last.blockHeight != blockHeight) { blockHistory.add(BlockEntities(blockHeight)); }Then update the return statement:
return DriveEntityHistory( - blockHistory.isNotEmpty ? blockHistory.last.blockHeight : lastBlockHeight, + maxMinedBlockHeight, blockHistory, );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lib/services/arweave/arweave_service.dart(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pre-build / test-and-lint
🔇 Additional comments (2)
lib/services/arweave/arweave_service.dart (2)
368-371: LGTM!The block grouping logic correctly creates new
BlockEntitiescontainers when processing a new block height, including the virtual block 0 for unmined transactions.
363-366: Cleanup mechanism verified—no issues found.The referenced
_updateTransactionStatusesexists inlib/sync/domain/repositories/sync_repository.dartand correctly handles unmined transactions. Pending transactions are marked as failed when either (1) unconfirmed for 8+ hours (line 715), or (2) creation date exceedspendingWaitTimeof 1 day (line 777). The blockHeight normalization to 0 is sound.
|
Visit the preview URL for this PR (updated for commit 23ba8cf): https://ardrive-web--pr2089-pe-8687-show-uploade-37af6zrf.web.app (expires Fri, 28 Nov 2025 19:06:37 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: a224ebaee2f0939e7665e7630e7d3d6cd7d0f8b0 |
Removed duplicate block history check at lines 404-408 that was redundant with the check at lines 368-371. Between these two checks, nothing mutates blockHistory or blockHeight, making the second check unreachable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
lib/services/arweave/arweave_service.dart(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: pre-build / test-and-lint
🔇 Additional comments (1)
lib/services/arweave/arweave_service.dart (1)
363-366: Verify the actual timeout duration and transaction ordering.The comment references a 8-24 hour timeout for cleaning up unmined transactions, but the code shows cleanup uses
pendingWaitTime(undefined in search results) with a 45-minute threshold. The actual timeout duration needs clarification.Additionally, verify that
createDriveEntityHistoryFromTransactionsreceives transactions in the expected order. The method constructsblockHistoryby iterating through transactions and returnsblockHistory.last.blockHeightas the new sync checkpoint. If transactions arrive in descending block order (typical for GraphQL), unmined transactions (blockHeight=0) may end up last in the history, causing the method to return 0 instead of the actual highest block—corrupting sync state for the next run.
Replace block height 0 assignment for unmined transactions with currentBlockHeight to prevent lastBlockHeight contamination that would cause full re-sync on subsequent syncs. Changes: - Add currentBlockHeight parameter to createDriveEntityHistoryFromTransactions - Use currentBlockHeight ?? lastBlockHeight fallback for unmined transactions - Pending files now appear at current block and update when mined - Prevents sync cursor from being reset to 0 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Remove blocking break statement in sync process that prevented unmined
transactions from being displayed. Files uploaded via Turbo are now
visible immediately with pending/orange status indicators.
Changes:
Impact:
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.