remove event assertion crate#763
Conversation
WalkthroughThe stellar-event-assertion crate is removed entirely (manifest and source), along with its workspace member entry and dependency references across all consuming crates. Documentation files describing the crate and its usage are updated. All test files across access, accounts, contract-utils, and tokens packages are migrated from EventAssertion helper calls to direct assertions on Soroban's captured event log, using ChangesEvent assertion crate removal and test migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #763 +/- ##
==========================================
- Coverage 96.63% 96.56% -0.07%
==========================================
Files 72 71 -1
Lines 7615 7346 -269
==========================================
- Hits 7359 7094 -265
+ Misses 256 252 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🧹 Nitpick comments (3)
packages/tokens/src/rwa/identity_verification/identity_registry_storage/test.rs (1)
4-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMigration correct; counts verified across all seven test cases.
All event-count assertions (2, 3, 4, 3, 3, 5, 4) correctly match the documented add/modify/remove/recover event sequences.
As with the other files in this layer, only counts are checked rather than payload comparisons via
.to_xdr(&e, &address)per coding guidelines; consistent with the stack's accepted tradeoff.Also applies to: 52-52, 112-112, 194-194, 242-242, 276-276, 343-343, 710-710
🤖 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 `@packages/tokens/src/rwa/identity_verification/identity_registry_storage/test.rs` around lines 4 - 7, No code changes are needed here: the event-count assertions in identity_registry_storage::test already match the expected seven test cases, and the current count-only checks are consistent with the accepted testing approach in this layer. Keep the existing imports and assertions as-is in test_identity_registry_storage and the related event-verification test blocks.Source: Coding guidelines
packages/tokens/src/rwa/test.rs (1)
4-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMigration correct; counts verified across all nine test cases.
All event-count assertions correctly account for
setup_all_contracts(2 events) plus subsequent operation-specific events; math checks out for mint/burn/freeze/recover scenarios.Also applies to: 131-131, 155-155, 179-179, 207-207, 313-313, 366-366, 393-393, 457-457
🤖 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 `@packages/tokens/src/rwa/test.rs` around lines 4 - 8, The event-count assertions in the RWA tests are already correct, so no logic change is needed; keep the existing counts aligned with setup_all_contracts contributing 2 events plus the operation-specific events in each of the listed test cases. If you touch these tests, preserve the same event math in the relevant assertions so the counts stay consistent across mint, burn, freeze, and recover scenarios.Source: Coding guidelines
packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/test.rs (1)
3-7: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueMigration correct; counts verified.
Import restructuring and all five event-count assertions (1, 3, 3, 4, 7) match the documented event math for each scenario.
Per coding guidelines, event assertions should ideally compare against the typed
#[contractevent]struct via.to_xdr(&e, &address)rather than only counting. This file only checks counts everywhere; since the PR's linked issue explicitly accepts count-only assertions outside of the primary event-defining tests, this is likely intentional and consistent with the stack-wide approach, but flagging for awareness.Also applies to: 37-37, 116-116, 248-248, 405-405, 566-566
🤖 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 `@packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/test.rs` around lines 3 - 7, The event-count assertions in the test module are intentionally count-only here, so no behavioral change is needed for this file; if you do touch these tests later, prefer asserting against the typed #[contractevent] structs via .to_xdr(&e, &address) in the relevant scenario tests rather than adding more count-only checks, and keep the existing import setup around Events, Env, Address, and Vec as-is.Source: Coding guidelines
🤖 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.
Nitpick comments:
In
`@packages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/test.rs`:
- Around line 3-7: The event-count assertions in the test module are
intentionally count-only here, so no behavioral change is needed for this file;
if you do touch these tests later, prefer asserting against the typed
#[contractevent] structs via .to_xdr(&e, &address) in the relevant scenario
tests rather than adding more count-only checks, and keep the existing import
setup around Events, Env, Address, and Vec as-is.
In
`@packages/tokens/src/rwa/identity_verification/identity_registry_storage/test.rs`:
- Around line 4-7: No code changes are needed here: the event-count assertions
in identity_registry_storage::test already match the expected seven test cases,
and the current count-only checks are consistent with the accepted testing
approach in this layer. Keep the existing imports and assertions as-is in
test_identity_registry_storage and the related event-verification test blocks.
In `@packages/tokens/src/rwa/test.rs`:
- Around line 4-8: The event-count assertions in the RWA tests are already
correct, so no logic change is needed; keep the existing counts aligned with
setup_all_contracts contributing 2 events plus the operation-specific events in
each of the listed test cases. If you touch these tests, preserve the same event
math in the relevant assertions so the counts stay consistent across mint, burn,
freeze, and recover scenarios.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: cf33aad6-a57a-464f-a4c4-c50b0eff3b49
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (34)
.claude/commands/code-quality.mdArchitecture.mdCLAUDE.mdCargo.tomlREADME.mdpackages/access/Cargo.tomlpackages/access/src/access_control/test.rspackages/access/src/ownable/test.rspackages/accounts/Cargo.tomlpackages/contract-utils/Cargo.tomlpackages/contract-utils/src/merkle_distributor/test.rspackages/test-utils/event-assertion/Cargo.tomlpackages/test-utils/event-assertion/src/lib.rspackages/tokens/Cargo.tomlpackages/tokens/src/confidential/auditor/test.rspackages/tokens/src/confidential/compliance/test.rspackages/tokens/src/confidential/test.rspackages/tokens/src/confidential/verifier/test.rspackages/tokens/src/fungible/extensions/burnable/test.rspackages/tokens/src/fungible/test.rspackages/tokens/src/non_fungible/extensions/burnable/test.rspackages/tokens/src/non_fungible/extensions/consecutive/test.rspackages/tokens/src/non_fungible/extensions/enumerable/test.rspackages/tokens/src/non_fungible/test.rspackages/tokens/src/rwa/compliance/modules/supply_limit/test.rspackages/tokens/src/rwa/compliance/test.rspackages/tokens/src/rwa/extensions/doc_manager/test.rspackages/tokens/src/rwa/identity_verification/claim_issuer/test.rspackages/tokens/src/rwa/identity_verification/claim_topics_and_issuers/test.rspackages/tokens/src/rwa/identity_verification/identity_claims/test.rspackages/tokens/src/rwa/identity_verification/identity_registry_storage/test.rspackages/tokens/src/rwa/identity_verification/test.rspackages/tokens/src/rwa/test.rspackages/tokens/src/rwa/utils/token_binder/test.rs
💤 Files with no reviewable changes (9)
- packages/test-utils/event-assertion/Cargo.toml
- Architecture.md
- README.md
- packages/accounts/Cargo.toml
- packages/access/Cargo.toml
- packages/contract-utils/Cargo.toml
- Cargo.toml
- packages/tokens/Cargo.toml
- packages/test-utils/event-assertion/src/lib.rs
Fixes #762
PR Checklist
Summary by CodeRabbit
Documentation
Tests
Chores