Skip to content

test: follow the test conventions in tests added in 4.1 and 4.2 - #5062

Merged
QuantumExplorer merged 2 commits into
v4.2-devfrom
claude/test-conventions-4-2
Sep 27, 2026
Merged

QuantumExplorer merged 2 commits into
v4.2-devfrom
claude/test-conventions-4-2

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: tidies tests written during 4.1 and 4.2 so they follow the project's test rules. Three kinds of fix: some encryption tests used a new random key every run (now they use a fixed seed, so a failure can be reproduced); some tests of the newest version of a function were locked to "protocol version 14" instead of "the latest protocol version" (the project's rule is that the newest code is tested at the latest version, and tests get locked to a number only when a newer version replaces that code); and one test only restated numbers from a settings table, which the project's rules say not to write.

Value: reproducible failures, and tests that follow the tip without churn when protocol version 15 arrives.

Risks: None for behaviour: test code only, and PlatformVersion::latest() is protocol version 14 today, so every converted test runs exactly as before.

Issue being fixed or feature implemented

book/src/contributing/coding-conventions.md, "Tests":

What was done?

  • rs-platform-encryption (aes.rs, ecdh.rs, compact_xpub.rs, account_label.rs): keys and IVs come from StdRng::seed_from_u64.
  • Latest-generation tests now use PlatformVersion::latest(): the try_from_schema v3 tests (the pv14() helper, whose doc argued for pinning, is replaced by latest()), the keep-history repair tests of validate_update, three of the four document_try_into_asset_unlock_base_transaction_info v1 tests (the one named for the v14 fee cap stays pinned), and the evaluate v1 stability test.
  • v14.rs: removed ranked_feature_slots_exist_but_are_dormant (it asserted only that four PLATFORM_V14 slots are 0) and moved a doc comment that had drifted onto the wrong test back to ranked_index_keywords_are_gated_by_meta_schema_v3.

Not changed here: the tests in v14.rs, v13.rs, protocol_version.rs and system_limits/mod.rs that assert a shipped version's slot next to protocol version 14's. They carry a replay rationale for the shipped half, which the book allows for freeze tests; whether to keep their protocol version 14 halves is a separate call.

How Has This Been Tested?

cargo test -p platform-encryption, cargo test -p dpp --lib for try_from_schema::v3 (332), document_try_into_asset_unlock_base_transaction_info (5) and distribution_function::evaluate (127), cargo test -p platform-version; cargo clippy -p dpp -p platform-encryption -p platform-version --all-features --all-targets -- -D warnings.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed
  • If I added or changed GroveDB structure, I described it in the area's structure.rs, regenerated grovedb-structure.json, and checked the structure viewer link posted on this pull request

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 8e26f1e

  • Bots — coderabbitai not yet · thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • Self-review — post /self-reviewed once the bots are done
  • Within your 5 open PRs
  • Build running
  • Approvals — you own every area touched; none needed

When every box is checked the PR Hygiene check passes and this can merge.

- rs-platform-encryption: the round-trip tests drew keys and IVs from
  thread_rng; seed them with StdRng::seed_from_u64 so a failure reproduces.
- try_from_schema v3, validate_update keep-history repair, the withdrawal
  asset-unlock info v1 and the token evaluate v1 tests pinned protocol
  version 14 although they test the latest generation; run them at
  PlatformVersion::latest() (pinning happens when a newer generation
  arrives). The one test named for the v14 fee cap stays pinned.
- v14.rs: drop ranked_feature_slots_exist_but_are_dormant, which only
  restated PLATFORM_V14 slot values, and put the meta-schema doc comment
  back on the test it describes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: dashpay/platform/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 9d7586ba-a809-414d-a212-6013635078a5

📥 Commits

Reviewing files that changed from the base of the PR and between 4d4f38d and 8e26f1e.

📒 Files selected for processing (9)
  • packages/rs-dpp/src/data_contract/associated_token/token_perpetual_distribution/distribution_function/evaluate.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/keep_history_tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/mod.rs
  • packages/rs-dpp/src/withdrawal/document_try_into_asset_unlock_base_transaction_info/v1/mod.rs
  • packages/rs-platform-encryption/src/account_label.rs
  • packages/rs-platform-encryption/src/aes.rs
  • packages/rs-platform-encryption/src/compact_xpub.rs
  • packages/rs-platform-encryption/src/ecdh.rs
  • packages/rs-platform-version/src/version/v14.rs

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.

@github-actions github-actions Bot added this to the v4.2.0 milestone Sep 27, 2026
@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Sep 27, 2026
@thepastaclaw

thepastaclaw commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

🔍 Review in progress — actively reviewing now (commit 8e26f1e) · triage: low

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 1 + Phase 2

Verified the supplied findings against head 577b0e8 and the base-to-head diff. The changes are confined to tests and comments, with no production behavior or consensus changes; two non-blocking documentation/naming inconsistencies remain. Static inspection and git diff --check passed; reviewer-reported test and clippy results were not independently rerun.

💬 2 nitpick(s)

Review provenance

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: architecture-layering); reviewer 3: glm-5.3-flash (agent: phase1-reviewer, role: platform-versioning); reviewer 4: glm-5.3-flash (agent: phase1-reviewer, role: rust-quality); reviewer 5: glm-5.3-flash (agent: phase1-reviewer, role: security-auditor); reviewer 6: gpt-6-astra (agent: phase2-reviewer, role: general); reviewer 7: gpt-6-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 8: gpt-6-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 9: gpt-6-astra (agent: phase2-reviewer, role: rust-quality); reviewer 10: gpt-6-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

  • Triage: low by gpt-6-astra (effort low) — The diff is straightforward test-only maintenance—seeding randomness, using the latest protocol version, and removing a redundant assertion—with no changes to production behavior or critical surfaces.
  • Phase 1 reviewers: glm-5.3-flash — general (completed, effort high); agent phase1-reviewer, glm-5.3-flash — architecture-layering (completed, effort high); agent phase1-reviewer, glm-5.3-flash — platform-versioning (completed, effort high); agent phase1-reviewer, glm-5.3-flash — rust-quality (completed, effort high); agent phase1-reviewer, glm-5.3-flash — security-auditor (completed, effort high); agent phase1-reviewer
  • Phase 1 model: glm-5.3-flash — zai quota: 5h 74% left, weekly 29% left; passed over gemini-3.8-flash-high (antigravity below 15% reserve: weekly 13% left, 5h 100% left)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort medium); agent phase2-reviewer, gpt-6-astra — architecture-layering (completed, effort medium); agent phase2-reviewer, gpt-6-astra — platform-versioning (completed, effort medium); agent phase2-reviewer, gpt-6-astra — rust-quality (completed, effort medium); agent phase2-reviewer, gpt-6-astra — security-auditor (completed, effort medium); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/mod.rs`:
- [NITPICK] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/mod.rs:1287-1293: Update the remaining PV14-specific test name and diagnostics
  This test now calls latest(), but its name, doc comment, and expect message still describe a PV14-specific run. Unlike the explicitly pinned historical tests, it will follow the next protocol version, making its failure output identify the wrong version. Rename it to use at_latest and update the accompanying version-specific prose, as this PR already does for sibling test names. The nearby latest-based dispatcher test also retains PV14-specific diagnostics; historical explanations and genuinely pinned tests should keep their version references.

In `packages/rs-platform-version/src/version/v14.rs`:
- [NITPICK] packages/rs-platform-version/src/version/v14.rs:1656-1657: Restore the retained freeze test's replay rationale
  Removing ranked_feature_slots_exist_but_are_dormant also deletes the separate six-line rationale belonging to contested_index_cross_check_is_v14_only, although that test remains. The deleted comment explains why changing the v13 structure-validation slot would retroactively reject historical transitions. That is the replay rationale required by the book's exception for historical table-freeze tests, and the PR description explicitly cites those rationales as the reason for retaining these tests. Restore the comment above the surviving test; this is documentation loss, not a runtime or consensus defect.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Extend test-RNG seeding to the remaining unseeded randomness in test code outside rs-platform-encryption — Out of scope: the cited OsRng uses exist in unchanged shield and state-transition tests, but this PR neither introduces nor worsens them. A workspace-wide RNG cleanup is routine adjacent work, not an exceptional high-value follow-up to preserve in this review.
    • Follow-up: Consider creating a separate issue or author/maintainer-requested PR for this.

Comment thread packages/rs-platform-version/src/version/v14.rs
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. and removed waiting-bots Waiting for the review bots to report on this head labels Sep 27, 2026
Review follow-ups: removing the dormant-slots test also removed the replay
rationale of contested_index_cross_check_is_v14_only; put it back. The
generation 3 tests that now run at the latest protocol version no longer
name protocol version 14 in their name, docs or failure messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Sep 27, 2026
@QuantumExplorer
QuantumExplorer merged commit 013dce6 into v4.2-dev Sep 27, 2026
15 of 16 checks passed
@QuantumExplorer
QuantumExplorer deleted the claude/test-conventions-4-2 branch September 27, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-bots Waiting for the review bots to report on this head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants