Skip to content

test(dpp): add validation error path tests for identity_nonce, max_depth, and GroupV0#3323

Merged
QuantumExplorer merged 2 commits intov3.1-devfrom
test/validation-error-paths-simple
Mar 15, 2026
Merged

test(dpp): add validation error path tests for identity_nonce, max_depth, and GroupV0#3323
QuantumExplorer merged 2 commits intov3.1-devfrom
test/validation-error-paths-simple

Conversation

@QuantumExplorer
Copy link
Copy Markdown
Member

@QuantumExplorer QuantumExplorer commented Mar 15, 2026

Summary

  • Add 16 tests covering boundary conditions and specific error variants for:
    • validate_new_identity_nonce: valid/invalid at boundary values (5 tests)
    • validate_max_depth: schema exceeding max depth (1 test)
    • GroupV0::validate: max members, too few members, power limits, required power (10 tests)
  • All assertions check specific error types, not just error presence

Context

Originally authored by @thepastaclaw in #3123. Recreated from the main repo so coverage reports work (fork PRs can't upload to Codecov due to missing CODECOV_TOKEN secret).

Test plan

  • All new tests pass on macOS runner
  • Coverage report will be generated

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Tests
    • Expanded test coverage for data contract max depth validation to verify error handling.
    • Added comprehensive test suite for group validation scenarios including member limits and power validation.
    • Added test coverage for identity nonce validation edge cases and boundary conditions.

…pth, and GroupV0

Add 16 tests covering boundary conditions and specific error variants:
- validate_new_identity_nonce: valid/invalid at boundary values
- validate_max_depth: schema exceeding max depth
- GroupV0::validate: max members, too few members, power limits,
  required power validation

Originally authored by thepastaclaw in PR #3123, recreated from main
repo for coverage reporting.

Co-Authored-By: thepastaclaw <thepastaclaw@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions github-actions Bot added this to the v3.1.0 milestone Mar 15, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 15, 2026

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5b8b7809-f928-43e4-a6fb-edbebe0afbd7

📥 Commits

Reviewing files that changed from the base of the PR and between 993abd2 and 101c5e7.

📒 Files selected for processing (2)
  • packages/rs-dpp/src/data_contract/group/v0/mod.rs
  • packages/rs-dpp/src/identity/identity_nonce.rs
📝 Walkthrough

Walkthrough

Three modules received unit test additions validating existing functionality: max depth schema validation, GroupV0 member validation, and identity nonce boundaries. Production code remains unchanged; all modifications are test-only additions covering error scenarios and edge cases.

Changes

Cohort / File(s) Summary
Max Depth Validation Tests
packages/rs-dpp/src/data_contract/document_type/schema/validate_max_depth/v0/mod.rs
Added unit test for max depth enforcement, verifying DataContractMaxDepthExceedError triggers correctly when schema depth exceeds platform limits.
Group Validation Tests
packages/rs-dpp/src/data_contract/group/v0/mod.rs
Added comprehensive test suite covering nine validation scenarios: member count bounds, member power constraints, required power validation, and unilateral power requirements.
Identity Nonce Validation Tests
packages/rs-dpp/src/identity/identity_nonce.rs
Added tests for nonce boundary conditions covering valid cases (zero, max-minus-one) and invalid cases (at-max, above-max, large values) with StateError assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 With whiskers twitching, I've hopped through the code,
Tests now abound on this validation road!
Max depths and nonces and groups oh so fine,
Each edge case checked with a hoppy design.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding validation error path tests for three components (identity_nonce, max_depth, and GroupV0).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch test/validation-error-paths-simple
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 15, 2026

Codecov Report

❌ Patch coverage is 92.30769% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.78%. Comparing base (6bc1c1b) to head (101c5e7).
⚠️ Report is 4 commits behind head on v3.1-dev.

Files with missing lines Patch % Lines
packages/rs-dpp/src/data_contract/group/v0/mod.rs 91.96% 9 Missing ⚠️
.../document_type/schema/validate_max_depth/v0/mod.rs 94.73% 1 Missing ⚠️
packages/rs-dpp/src/identity/identity_nonce.rs 91.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           v3.1-dev    #3323      +/-   ##
============================================
+ Coverage     72.62%   72.78%   +0.15%     
============================================
  Files          3293     3293              
  Lines        269077   270061     +984     
============================================
+ Hits         195425   196556    +1131     
+ Misses        73652    73505     -147     
Components Coverage Δ
dpp 60.38% <92.30%> (+0.21%) ⬆️
drive 78.31% <ø> (ø)
drive-abci 84.44% <ø> (+0.26%) ⬆️
sdk 31.25% <ø> (ø)
dapi-client 79.06% <ø> (ø)
platform-version ∅ <ø> (∅)
platform-value 58.46% <ø> (ø)
platform-wallet 60.40% <ø> (ø)
drive-proof-verifier ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thepastaclaw
Copy link
Copy Markdown
Collaborator

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 15, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

- validate_new_identity_nonce_valid_max_minus_one: same else branch as valid_zero
- validate_new_identity_nonce_invalid_above_max: same if branch as invalid_at_max
- validate_new_identity_nonce_invalid_large: same if branch as invalid_at_max
- test_group_too_few_members_zero: same members.len() < 2 branch as _one

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer merged commit d604d92 into v3.1-dev Mar 15, 2026
34 checks passed
@QuantumExplorer QuantumExplorer deleted the test/validation-error-paths-simple branch March 15, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants