Skip to content

chore(dpp): remove orphaned JSON schemas and dead wasm-dpp tests#3470

Open
thephez wants to merge 11 commits intov3.1-devfrom
fix/schema-public-key-max-items-discrepancy
Open

chore(dpp): remove orphaned JSON schemas and dead wasm-dpp tests#3470
thephez wants to merge 11 commits intov3.1-devfrom
fix/schema-public-key-max-items-discrepancy

Conversation

@thephez
Copy link
Copy Markdown
Collaborator

@thephez thephez commented Apr 9, 2026

Issue being fixed or feature implemented

rs-dpp contained JSON schema files for identity, data contract, and document state transitions that were never loaded by any code — validation for these transitions moved entirely to native Rust. These orphaned files were misleading (e.g. identityUpdate.json declared addPublicKeys.maxItems: 10 while Rust enforces 6) and would inevitably drift further from the actual implementation. This was causing confusion when updating docs also.

What was done?

  • Removed all 13 orphaned JSON schema files under packages/rs-dpp/src/schema/:
    • All identity schemas: identity.json, publicKey.json, all stateTransition/ files including asset lock proofs
    • Data contract schemas: dataContractCreate.json, dataContractUpdate.json
    • Document schema: documentBase.json
  • Deleted two fully-skipped wasm-dpp integration test files that only existed to reference identity.json:
    • validatePublicKeysState.spec.js
    • validateIdentityUpdateTransitionStateFactory.spec.js

The four document transition schemas loaded via include_str! in schema/mod.rs (base.json, create.json, replace.json, documentsBatch.json) are retained as they are actively used.

How Has This Been Tested?

The deleted JS tests were describe.skip and covered by existing Rust tests in rs-drive-abci:

  • test_identity_update_duplicate_key_ids_to_disable
  • test_identity_update_wrong_revision
  • test_identity_update_disabling_nonexistent_key
  • test_identity_update_too_many_keys_to_disable
  • Strategy tests in update_identities_tests.rs

No new tests added — this is pure deletion of dead code.

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

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Removed schema definition files for identity structures, documents, data contracts, and related state transitions.
    • Removed associated integration test files for identity state transition validation.

thephez and others added 4 commits April 9, 2026 15:38
… of 6

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
identityCreate.json and identityUpdate.json are not referenced anywhere
in the codebase; validation is handled entirely by Rust code.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Validation for these state transitions moved entirely to Rust.
identity.json is retained as it is still referenced in test fixtures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Both test suites were describe.skip and fully covered by Rust tests in
rs-drive-abci and rs-dpp. identity.json had no other references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thephez thephez requested a review from QuantumExplorer as a code owner April 9, 2026 20:04
@github-actions github-actions Bot added this to the v3.1.0 milestone Apr 9, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 9, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 413c53d5-75b8-4356-9a3c-bffcd864c1b0

📥 Commits

Reviewing files that changed from the base of the PR and between 6f72a64 and d7333f9.

📒 Files selected for processing (15)
  • packages/rs-dpp/src/schema/data_contract/v0/stateTransition/dataContractCreate.json
  • packages/rs-dpp/src/schema/data_contract/v0/stateTransition/dataContractUpdate.json
  • packages/rs-dpp/src/schema/document/v0/documentBase.json
  • packages/rs-dpp/src/schema/identity/v0/identity.json
  • packages/rs-dpp/src/schema/identity/v0/publicKey.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/assetLockProof/chainAssetLockProof.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/assetLockProof/instantAssetLockProof.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreate.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreditTransfer.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreditWithdrawal.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityTopUp.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/publicKey.json
  • packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js
  • packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validatePublicKeysState.spec.js
💤 Files with no reviewable changes (15)
  • packages/rs-dpp/src/schema/data_contract/v0/stateTransition/dataContractUpdate.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/assetLockProof/instantAssetLockProof.json
  • packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validatePublicKeysState.spec.js
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreate.json
  • packages/rs-dpp/src/schema/identity/v0/publicKey.json
  • packages/rs-dpp/src/schema/document/v0/documentBase.json
  • packages/rs-dpp/src/schema/identity/v0/identity.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityUpdate.json
  • packages/rs-dpp/src/schema/data_contract/v0/stateTransition/dataContractCreate.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityTopUp.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/assetLockProof/chainAssetLockProof.json
  • packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreditTransfer.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/publicKey.json
  • packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreditWithdrawal.json

📝 Walkthrough

Walkthrough

Removed 15 JSON Schema definition files and 2 test suites totaling approximately 1,214 lines. The deleted schemas validated data contract, document, identity, and associated state transition objects across the rs-dpp package.

Changes

Cohort / File(s) Summary
Data Contract Schemas
packages/rs-dpp/src/schema/data_contract/v0/stateTransition/dataContractCreate.json, dataContractUpdate.json
Removed JSON Schema definitions for data contract create (type 0) and update (type 4) state transitions, including field constraints and signature validation rules.
Document Schemas
packages/rs-dpp/src/schema/document/v0/documentBase.json
Removed document base schema defining core document structure with protocol versioning, identifier, typing, revision, and timestamp/block-height fields.
Identity Core Schemas
packages/rs-dpp/src/schema/identity/v0/identity.json, publicKey.json
Removed base identity schema (with protocolVersion, id, publicKeys, balance, revision) and public key schema with type-dependent byte-length validation rules.
Asset Lock Proof Schemas
packages/rs-dpp/src/schema/identity/v0/stateTransition/assetLockProof/chainAssetLockProof.json, instantAssetLockProof.json
Removed asset lock proof schemas for chain-based (type 1) and instant (type 0) proof validation including height/output constraints.
Identity State Transition Schemas
packages/rs-dpp/src/schema/identity/v0/stateTransition/identityCreate.json, identityCreditTransfer.json, identityCreditWithdrawal.json, identityTopUp.json, identityUpdate.json, publicKey.json
Removed state transition schemas for identity operations (create, credit transfer/withdrawal, top-up, update) and public key management, including type constants, field constraints, and signature validation.
Integration Tests
packages/wasm-dpp/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js, validatePublicKeysState.spec.js
Removed skipped test suites for identity update transition state validation and public key validation, including fixture setup and error case assertions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 With hop and cheer, we bid goodbye,
To schemas old that once stood high,
Fifteen files now softly fade,
Tests retired from their parade,
The codebase hops to brighter days! 🌱

🚥 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: removal of orphaned JSON schemas and dead tests from the dpp package.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/schema-public-key-max-items-discrepancy

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.

@thepastaclaw
Copy link
Copy Markdown
Collaborator

thepastaclaw commented Apr 9, 2026

🕓 Ready for review — 7 ahead in queue (commit 0c28504)
Queue position: 8/20

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

I verified the PR against the source at d7333f9e9599b7c4eb54be3e92ea825b082112a3. The change is deletion-only: it removes packages/rs-dpp/src/schema/identity/v0/identity.json plus two describe.skip wasm tests that were the only consumers of that file, while the active Rust schema implementation in packages/rs-dpp/src/schema/identity/v0/identity.rs remains intact. I did not find any runtime regressions, broken references, or consensus-critical issues in this diff.

Reviewed commit: d7333f9

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.29%. Comparing base (c556a86) to head (0c28504).
⚠️ Report is 15 commits behind head on v3.1-dev.

Additional details and impacted files
@@            Coverage Diff            @@
##           v3.1-dev    #3470   +/-   ##
=========================================
  Coverage     88.29%   88.29%           
=========================================
  Files          2474     2474           
  Lines        300927   300927           
=========================================
  Hits         265707   265707           
  Misses        35220    35220           
Components Coverage Δ
dpp 87.97% <ø> (ø)
drive 87.35% <ø> (ø)
drive-abci 90.25% <ø> (ø)
sdk ∅ <ø> (∅)
dapi-client ∅ <ø> (∅)
platform-version ∅ <ø> (∅)
platform-value 92.26% <ø> (ø)
platform-wallet ∅ <ø> (∅)
drive-proof-verifier 55.66% <ø> (ø)
🚀 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.

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

I re-reviewed this PR at 0d0a8cd4 against the checked-out tree. The change remains a pure deletion of 13 unused JSON schema files plus 2 skipped wasm-dpp tests, and the live schema loading path in packages/rs-dpp/src/schema/mod.rs still references only the retained document transition schemas. I did not find any correctness, security, consensus, or test-coverage regressions caused by these deletions.

Reviewed commit: 0d0a8cd

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

No agent findings or CodeRabbit findings were provided in the verifier prompt for PR #3470, so there was nothing to validate against detached HEAD cb57e99ef3cae0e4ef788abd8c8b1ffa846863e0. Based on the prompt contents alone, this review produces no verified issues.

Reviewed commit: cb57e99

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

The PR is described as a focused cleanup that removes orphaned JSON schemas and two skipped wasm-dpp tests, but the actual merge diff against v3.1-dev is a massive feature branch: 1018 files changed with 182k+ insertions across workflows, docs, rs-dpp, rs-dapi, data contracts, SDK crates, and many unrelated packages. That mismatch is the real review problem here — this is not reviewable or merge-safe as a narrowly scoped schema-cleanup PR.

Reviewed commit: 556d857

🔴 1 blocking

1 additional finding

🔴 blocking: This schema-cleanup PR is not actually a focused deletion — it merges a huge product branch into `v3.1-dev`

packages/rs-dpp/src/schema/identity/stateTransition/identityUpdate.json (line 1)

The PR description says this change simply removes 13 orphaned JSON schema files from packages/rs-dpp/src/schema/ and deletes two fully skipped wasm-dpp tests that only referenced identity.json. But the real merge diff against v3.1-dev is 1018 files with 182k+ insertions touching workflows, docs/book content, rs-dpp core types and validation, rs-dapi, rs-dapi-client, new/expanded data-contract packages, SDK/support crates, and many unrelated packages across the monorepo. That means approving/merging this PR would not just land the schema cleanup — it would also merge a very large body of unrelated platform changes that are not disclosed by the PR summary and cannot be meaningfully audited as part of a narrow chore review. Split this into (a) a true schema-cleanup PR containing only the orphaned JSON schema/test deletions, and (b) separate feature/integration PRs for the broader platform changes. As-is, the PR description materially understates what will actually merge.

🤖 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/schema/identity/stateTransition/identityUpdate.json`:
- [BLOCKING] line 1: This schema-cleanup PR is not actually a focused deletion — it merges a huge product branch into `v3.1-dev`
  The PR description says this change simply removes 13 orphaned JSON schema files from `packages/rs-dpp/src/schema/` and deletes two fully skipped wasm-dpp tests that only referenced `identity.json`. But the real merge diff against `v3.1-dev` is 1018 files with 182k+ insertions touching workflows, docs/book content, rs-dpp core types and validation, rs-dapi, rs-dapi-client, new/expanded data-contract packages, SDK/support crates, and many unrelated packages across the monorepo. That means approving/merging this PR would not just land the schema cleanup — it would also merge a very large body of unrelated platform changes that are not disclosed by the PR summary and cannot be meaningfully audited as part of a narrow chore review. Split this into (a) a true schema-cleanup PR containing only the orphaned JSON schema/test deletions, and (b) separate feature/integration PRs for the broader platform changes. As-is, the PR description materially understates what will actually merge.

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

The actual PR-shaped diff is the narrow cleanup described in the PR: relative to the merge base used by the review branch, it deletes 15 files and no production code paths. One suggestion remains: the surviving packages/rs-dpp/src/schema/ Rust module is still dead code, so the cleanup rationale is incomplete. The blocking finding from Codex does not apply because it compared the merge commit against the wrong side of the merge.

Reviewed commit: 556d857

🟡 1 suggestion(s)

1 additional finding

🟡 suggestion: The remaining `src/schema` module is still unreachable dead code

packages/rs-dpp/src/schema/mod.rs (lines 4-23)

packages/rs-dpp/src/lib.rs:28-77 never declares mod schema;, so this module is not compiled into the crate at all. That makes the retained include_str! loads here for documentTransition/base.json, create.json, replace.json, and documentsBatch.json unreachable, and the same dead module tree still contains packages/rs-dpp/src/schema/identity/v0/identity.rs:3-45, whose identity_json helper has no callers outside src/schema. This does not make the PR unsafe, but it means the reason given for keeping the remaining src/schema files is incorrect and the cleanup is incomplete.

🤖 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/schema/mod.rs`:
- [SUGGESTION] lines 4-23: The remaining `src/schema` module is still unreachable dead code
  `packages/rs-dpp/src/lib.rs:28-77` never declares `mod schema;`, so this module is not compiled into the crate at all. That makes the retained `include_str!` loads here for `documentTransition/base.json`, `create.json`, `replace.json`, and `documentsBatch.json` unreachable, and the same dead module tree still contains `packages/rs-dpp/src/schema/identity/v0/identity.rs:3-45`, whose `identity_json` helper has no callers outside `src/schema`. This does not make the PR unsafe, but it means the reason given for keeping the remaining `src/schema` files is incorrect and the cleanup is incomplete.

Copy link
Copy Markdown
Collaborator

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

Code Review

PR is a clean dead-code deletion of 13 orphaned JSON schema files and 2 fully-skipped wasm-dpp test files. No correctness issues. Both reviewers converge on one valid follow-up: an inline copy of the deleted identity.json survives as IDENTITY_JSON_STRING/identity_json() in schema/identity/v0/identity.rs with no real callers, preserving the same drift risk the PR set out to eliminate (it hard-codes publicKeys.maxItems=32 while live validators use max_public_keys_in_creation=6).

Reviewed commit: 8db4b77

🟡 1 suggestion(s)

1 additional finding

🟡 suggestion: Inline copy of deleted identity.json is orphaned and already drifts from live validators

packages/rs-dpp/src/schema/identity/v0/identity.rs (lines 1-47)

packages/rs-dpp/src/schema/identity/v0/identity.rs embeds the just-deleted identity.json verbatim as IDENTITY_JSON_STRING and exposes it via pub fn identity_json(), re-exported from packages/rs-dpp/src/schema/identity/v0/mod.rs:1 (pub use identity::identity_json;). A repo-wide grep on the current head finds no live callers — the only matches outside the definition site are a commented-out block in packages/wasm-dpp/src/identity/identity_facade.rs:122-126, an unrelated local variable in packages/wasm-drive-verify/src/utils/serialization.rs:28, and a test function name in packages/rs-dpp/src/voting/vote_choices/resource_vote_choice/mod.rs:60. More importantly, the embedded schema already disagrees with the active Rust validators: it hard-codes publicKeys.maxItems = 32, while validation now reads platform_version.dpp.state_transitions.identities.max_public_keys_in_creation, which is 6 in v1.rs, v2.rs, and v3.rs of packages/rs-platform-version/src/version/dpp_versions/dpp_state_transition_versions/. Leaving this helper in place preserves the exact schema-drift hazard the PR description cites as the reason for deleting the file-based schemas. To complete the stated goal, delete schema/identity/v0/identity.rs, the pub use identity::identity_json; line, and the mod identity; declaration in schema/identity/v0/mod.rs. Not a blocker — leaving it in just preserves dead code the PR otherwise removes.

🤖 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/schema/identity/v0/identity.rs`:
- [SUGGESTION] lines 1-47: Inline copy of deleted identity.json is orphaned and already drifts from live validators
  `packages/rs-dpp/src/schema/identity/v0/identity.rs` embeds the just-deleted `identity.json` verbatim as `IDENTITY_JSON_STRING` and exposes it via `pub fn identity_json()`, re-exported from `packages/rs-dpp/src/schema/identity/v0/mod.rs:1` (`pub use identity::identity_json;`). A repo-wide grep on the current head finds no live callers — the only matches outside the definition site are a commented-out block in `packages/wasm-dpp/src/identity/identity_facade.rs:122-126`, an unrelated local variable in `packages/wasm-drive-verify/src/utils/serialization.rs:28`, and a test function name in `packages/rs-dpp/src/voting/vote_choices/resource_vote_choice/mod.rs:60`. More importantly, the embedded schema already disagrees with the active Rust validators: it hard-codes `publicKeys.maxItems = 32`, while validation now reads `platform_version.dpp.state_transitions.identities.max_public_keys_in_creation`, which is `6` in `v1.rs`, `v2.rs`, and `v3.rs` of `packages/rs-platform-version/src/version/dpp_versions/dpp_state_transition_versions/`. Leaving this helper in place preserves the exact schema-drift hazard the PR description cites as the reason for deleting the file-based schemas. To complete the stated goal, delete `schema/identity/v0/identity.rs`, the `pub use identity::identity_json;` line, and the `mod identity;` declaration in `schema/identity/v0/mod.rs`. Not a blocker — leaving it in just preserves dead code the PR otherwise removes.

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