[N-02 and N-04] Collections audit - #492
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #492 +/- ##
==========================================
- Coverage 96.68% 96.66% -0.03%
==========================================
Files 39 39
Lines 3895 3895
Branches 875 875
==========================================
- Hits 3766 3765 -1
Misses 74 74
- Partials 55 56 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 37 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughDocumentation and test contracts for ChangesSortedMap contracts and examples
SortedSet contracts and examples
Test contract alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
collections/README.md (1)
67-71: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winKeep the price-book constructor composable.
deploy_and_shareconsumes the newPriceBookinsidetransfer::share_objectand returns nothing, preventing callers from composing setup or choosing the final ownership action in the same PTB. Prefer returning the object and show sharing as an explicit finalizer step.As per path instructions, integration examples should follow the composability and return-for-chaining guidance.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@collections/README.md` around lines 67 - 71, Update deploy_and_share to return the newly constructed PriceBook instead of consuming it with transfer::share_object; make it a composable constructor and add the integration example’s sharing as a separate explicit finalizer step using the returned object.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@collections/README.md`:
- Line 203: The README comparator guidance incorrectly claims is_well_formed_by!
detects all inconsistent or non-strict comparators. Update the paragraph to
state that it checks only adjacent ordering violations, note that non-strict
comparators such as <= can pass when adjacent keys satisfy the relation, and
avoid claiming keys() is universally available since it requires K: copy. Direct
non-strict and coarse comparator failures to comparator-law and cardinality
checks.
In `@collections/sources/sorted_map.move`:
- Around line 674-675: Document caller-supplied comparator aborts in the public
`_by` API contracts: update sorted_map.move lines 674-675 for the removal API
alongside EKeyNotFound, sorted_map.move lines 877-884 for keys_from_by, and
sorted_set.move lines 625-633 for delegated pagination. Include the comparator
abort in each function’s listed aborts while preserving the existing contracts.
In `@collections/tests/sorted_set/test_util.move`:
- Around line 358-361: Expand the documentation for public function
from_sorted_dk to state that ids must be sorted and that duplicate adjacent IDs
are de-duplicated, then add an “#### Aborts” section naming
sorted_set::EKeysNotSorted as the abort for unsorted IDs.
---
Nitpick comments:
In `@collections/README.md`:
- Around line 67-71: Update deploy_and_share to return the newly constructed
PriceBook instead of consuming it with transfer::share_object; make it a
composable constructor and add the integration example’s sharing as a separate
explicit finalizer step using the returned object.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0b236443-80b2-4f87-8899-382f0dfca58f
📒 Files selected for processing (16)
collections/README.mdcollections/examples/sorted_map/order_book.movecollections/examples/sorted_map/prize_vault.movecollections/examples/sorted_map/tick_registry.movecollections/examples/sorted_set/tests/unlock_queue_tests.movecollections/examples/sorted_set/unlock_queue.movecollections/sources/sorted_map.movecollections/sources/sorted_set.movecollections/tests/sorted_map/comparator_tests.movecollections/tests/sorted_map/conservation_tests.movecollections/tests/sorted_map/type_tests.movecollections/tests/sorted_set/abort_tests.movecollections/tests/sorted_set/comparator_tests.movecollections/tests/sorted_set/polarity_tests.movecollections/tests/sorted_set/test_util.movecollections/tests/sorted_set/type_tests.move
…elin/contracts-sui into fix/collections-audit-N-02-N-04
Summary by CodeRabbit
Documentation
Tests
SortedSet<DropKey>from avector<u64>of ids.