Registry Mirror
Skip to content

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: #6422 added a typed form of a document type's schema, DocumentTypeDefinition. A definition could be read and written, but a document type could only be built from a JSON schema. This adds DocumentType::try_from_definition, which builds from a definition the document type its schema builds. It is the first of several PRs: here the entry point exists and works end to end, five type-level keywords are read from the definition's typed fields, and everything else is still read from the schema the definition writes back.

Value: It is the route by which JSON schema leaves registration in 5.2. Each following PR moves one section of the grammar (the rest of the type-level keywords, properties, indexes, references, the rule language) from "read from the written-back schema" to "read from the typed fields", and the tests added here hold every such move to the existing parser. When the last section has moved, the schema is no longer on the path, and a contract format that carries definitions can register through it.

Risks: Low. Nothing carries a definition, so no state transition is validated differently. The one change to code that shipped protocol versions run is an extra optional argument on the generation-3 and generation-4 parses, which is None for every schema (see "In-place changes to shipped generations").

Issue being fixed or feature implemented

Part of removing JSON schema from the protocol in 5.2, after #6422. Follow-ups to the definition itself are tracked in #6427 and #6426. Delta contract updates (#4730) wait on the contract format that will carry definitions, which needs this entry point complete.

What was done?

  • DocumentType::try_from_definition (document_type/class_methods/try_from_definition/), with the arguments of try_from_schema and a DocumentTypeDefinition and optional SchemaDefinitions in place of the schema and $defs. Selected by try_from_definition: Some(0) in a new CONTRACT_VERSIONS_V8, which protocol version 16 selects; None in every earlier table, where the method answers "not supported".
  • What a definition is held to: what registration holds the schema it writes back to. That schema holds byte arrays written out, so the rules on a property type shorthand as such (a bytes size within the most a field may hold) are not applied to a definition: they are rules on reading a shorthand.
  • Generation 0 writes the definition back to its schema and runs generation 4 of the schema parser on it, handing over the definition as well. A stage that has a typed reader takes its keyword from the definition; a stage that has none reads the written-back schema as before. One sequence of stages serves both, so the two can not drift in the order they apply their rules.
  • Typed readers so far (try_from_schema/typed_keywords.rs): indexOnly, entryPayload, ttl, canBeErased, and whether canBeDeleted is "onlyWhenConsumed". A reader of the schema checks the shape of what it reads; the definition already holds each keyword at its type, so a typed reader checks nothing and can not fail.
  • The entry point is behind the json-conversion feature for now, because writing a definition back to a schema is. validation implies that feature, so every node build has it. The gate goes when the written-back schema leaves the path.

Not in this PR: the remaining type-level keywords (aggregates, moderatorAbilities, immutable, actionFees, private, the flags, token costs, key requirements), properties, indexes, references, the rule language, the schema check and the fee for a definition's size. Each is a later PR on the same pattern.

In-place changes to shipped generations

try_from_schema/v3/mod.rs and v4/mod.rs are selected by protocol versions 14 and 15, which have shipped.

  • parse_generation_3 and try_from_schema_generation_4 take one more argument, definition: Option<&DocumentTypeDefinitionV0>. try_from_schema_generation_3 and try_from_schema_v4, the entry points every schema goes through, keep their signatures and pass None.
  • Five reads became match definition { Some(d) => typed reader, None => the call that was there }. With None each makes the same call with the same arguments at the same place, so the values read, the errors returned and the order they are returned in are unchanged.

No other line of the shipped parsers changed. The 1,090 existing tests under class_methods:: pass unchanged.

How Has This Been Tested?

  • cargo test -p dpp --test contract_corpus: 11 passed, 1 new. should_build_every_corpus_document_type_from_its_definition_as_from_its_schema builds each of the 1,503 document types registered on mainnet and testnet both ways, as a contract holds it and under today's rules of registration: the same compiled document type, or the same error.
  • cargo test -p dpp --lib native_schema::tests: 1 new, should_build_a_document_type_from_its_definition_as_from_its_schema. It builds both ways the hand-written document types that use every keyword, 300 generated changes of each, the corpus with generated changes, and each written type made erasable and made deletable only when consumed. Both build the same compiled document type or both refuse. It also requires that, for each of the five typed keywords, some document type that builds declares it.
  • Mutation check, not committed: each typed reader changed in turn (indexOnly and canBeErased read as false, the first entryPayload name dropped, ttl off by one, "onlyWhenConsumed" missed). The test above failed all five times.
  • cargo test -p dpp --lib try_from_definition::tests: 3 passed, new. The entry point is not supported at protocol version 15, where the schema still registers, and builds at 16 what the schema builds; a bytes shorthand longer than a field may hold is refused by registration while the byte array it stands for registers from a schema and from a definition alike; a definition too deep to write as a schema is refused with a consensus error.
  • cargo test -p dpp --lib class_methods::: 1,093 passed.
  • cargo clippy -p dpp -p platform-version --all-targets --all-features --locked -- --no-deps -D warnings, cargo check -p dpp --lib with default features and with none, cargo fmt --all: clean.

Not run: the full dpp suite and the other crates.

Public interface changes

  • DocumentType::try_from_definition, new, behind the json-conversion feature. It takes the arguments of try_from_schema with a &DocumentTypeDefinition and an Option<&SchemaDefinitions> in place of the schema and the $defs. Asked for full_validation in a build without the validation feature, it answers ProtocolError::NotSupported; before protocol version 16 it answers the same.
  • platform_version::...::DocumentTypeClassMethodVersions gains the field try_from_definition: OptionalFeatureVersion.
  • DPPContractVersions: new table CONTRACT_VERSIONS_V8, selected by protocol version 16.

Breaking Changes

None for the protocol: the entry point is new and nothing calls it.

Rust source: code that builds a DocumentTypeClassMethodVersions with a full struct literal, or destructures one exhaustively, must name the new field. A version before 16 sets try_from_definition: None.

Checklist:

  • I have performed a self-review of my own code
  • My Rust, FFI, WASM, Swift or Kotlin changes follow the coding conventions
  • 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
  • If I added or changed a system contract's document schemas, I checked the contract 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 · c99df76

  • Bots — thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Build running
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • New Features
    • Document types can now be constructed from typed definitions in protocol version 16, with validation behavior aligned with schema-based construction.
    • Typed definitions support document settings for indexing, payload fields, time-to-live, erasure, and deletion conditions.
  • Reliability
    • Added checks comparing schema-based and definition-based construction across contract examples, including validation outcomes and resulting document types.

QuantumExplorer and others added 2 commits December 2, 2026 01:28
`DocumentType::try_from_definition` builds from a `DocumentTypeDefinition` the
document type its schema builds through `try_from_schema`. Generation 0, which
protocol version 16 selects (`CONTRACT_VERSIONS_V8`), parses the schema the
definition writes back with generation 4 of the schema parser; the sections of
the grammar move from there to the definition's typed fields one at a time.

Nothing carries a definition yet, so no state transition is validated
differently.

A corpus test builds each of the 1,503 document types registered on mainnet
and testnet both ways, as a contract holds it and under the rules of
registration, and holds the two to the same document type or the same refusal.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Building a document type from its definition reads `indexOnly`, `entryPayload`,
`ttl`, `canBeErased` and whether `canBeDeleted` is `"onlyWhenConsumed"` from the
definition's typed fields (`try_from_schema/typed_keywords.rs`), where it read
them from the schema the definition writes back.

The generation-3 and generation-4 parses take the definition as an optional
argument. It is `None` for every document type registered or loaded from a
schema, and each stage then makes the call it made before, in the same place.

A test builds the written document types, the corpus and schemas generated
from both from their definitions and from their schemas, and holds each typed
reader to the reader of the schema it stands for: with any of the five changed,
it fails.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@QuantumExplorer QuantumExplorer added this to the v5.2.0 milestone Dec 1, 2026
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The PR adds versioned construction of document types from typed definitions. It converts definitions to schemas, then passes the typed definition through the generation-4 and generation-3 builders. Tests compare typed-definition and schema-based construction.

Changes: Typed document type construction

Layer / File(s) Summary
Configure definition construction
packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/*, packages/rs-platform-version/src/version/v16.rs
The contract-version configuration adds a try_from_definition selector. Earlier versions set it to None; contract version 8 sets it to Some(0), and platform version 16 selects contract version 8.
Parse typed definition fields
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/...
The generation-3 parser reads indexOnly, entryPayload, ttl, deletedOnlyWhenConsumed, and canBeErased from the typed definition when supplied. The schema path remains available. Tests compare both paths across native and corpus cases.
Add the definition-based entry point
packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs, packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/..., packages/rs-dpp/tests/contract_corpus.rs
DocumentType::try_from_definition dispatches through the configured version. Version 0 converts the definition and optional schema definitions to schemas, then delegates to generation 4. Corpus tests compare construction results and errors.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant DocumentType
  participant DefinitionConversion
  participant Generation4Builder
  participant Generation3Parser
  Caller->>DocumentType: try_from_definition
  DocumentType->>DefinitionConversion: Convert definition and schema definitions
  DefinitionConversion->>Generation4Builder: Pass converted schemas and typed definition
  Generation4Builder->>Generation3Parser: Build with typed definition
  Generation3Parser-->>DocumentType: Return parsed document type or error
  DocumentType-->>Caller: Return result
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: shumkov, thepastaclaw, pastapastapasta

Merge Risk: Minimal · up to 0489d

This adds a typed-definition way to build document types, enabled only from protocol version 16. Existing schema-based contract creation and update behave as before. No concrete merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(dpp): build a document type from its typed definition" matches the main change. The PR adds DocumentType::try_from_definition, which builds a document type from a DocumentTypeDefinitio…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "feat(dpp): build a document type from its typed definition" matches the main change. The PR adds DocumentType::try_from_definition, which builds a document type from a DocumentTypeDefinition and optional SchemaDefinitions. The changeset also adds protocol version 16 wiring (CONTRACT_VERSIONS_V8, the try_from_definition version selector), typed keyword readers, and corpus and native schema tests that compare both build paths. The title covers the primary change, and the details are expected to be omitted.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 14a0250 and 0489db3.

Files selected for processing: 18

  • packages/rs-dpp/src/data_contract/document_type/class_methods/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/v0/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/tests.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/typed_keywords.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v3/mod.rs
  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/v4/mod.rs
  • packages/rs-dpp/tests/contract_corpus.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/mod.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v1.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v2.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v3.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v4.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v5.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v6.rs
  • packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/v8.rs
  • packages/rs-platform-version/src/version/v16.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@thepastaclaw

thepastaclaw commented Dec 1, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit c99df76)

@QuantumExplorer
QuantumExplorer marked this pull request as ready for review December 1, 2026 19:33
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Dec 1, 2026

@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

Changes requested: 1 blocker

  • full_validation: true accepts registration-invalid definitions in JSON-only builds — packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs:30-45 (new)
    Impact: A caller compiling DPP with json-conversion but without validation can receive Ok for a definition such as a hyphenated document type name even though a node rejects it during registration.

This PR adds a protocol-v16-dispatched DocumentType::try_from_definition path that converts typed definitions through the generation-4 parser while preserving existing schema callers. No code checks are failing in the supplied CI snapshot; package detection, CodeRabbit, and PR Hygiene are still in progress, with other applicable checks skipped or successful.

🔴 1 blocking | 🟡 5 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 8: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 9: gpt-6.2-sol (agent: phase2-reviewer, role: platform-versioning); reviewer 10: gpt-6.2-sol (agent: phase2-reviewer, role: rust-quality); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a substantial Rust parsing and protocol-dispatch change, but the existing schema path is preserved and no currently used state-transition or consensus behavior changes.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — rust-quality (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs`:
- [BLOCKING] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs:30-45: `full_validation: true` accepts registration-invalid definitions in JSON-only builds
  Impact: A caller compiling DPP with `json-conversion` but without `validation` can receive `Ok` for a definition such as a hyphenated document type name even though a node rejects it during registration.
  The public API documents `full_validation` as applying registration rules, but the method is available with `json-conversion` alone. In that configuration, the shared generation-3/4 parser compiles out the hyphenated-name check, schema-depth accounting, and native schema validation, so the method silently performs only parse-level work and can report success for input that a validating node refuses. Fail closed when `full_validation` is requested without the `validation` feature, while retaining parse-only construction and the existing schema entry point behavior.
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs:49-60: The tests do not verify that typed construction remains unavailable at protocol 15
  Impact: A future version-table regression could expose typed construction at protocol 15 while the current equivalence tests continue to pass because they exercise only `PlatformVersion::latest()`.
  Both new public-API equivalence tests use the latest platform version, so they verify the active v16 path but never exercise the inactive side of the dispatch boundary. Add a test using a valid fixture that confirms schema construction still works at protocol 15, `try_from_definition` returns `NotSupported` at protocol 15, and the same definition builds at the latest version.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/v0/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/v0/mod.rs:40-45: An oversized `bytes` shorthand can pass full validation after typed import
  Impact: A definition imported from a schema containing an unindexed `bytes` property with `size` above `max_field_value_size` can build successfully even though registration rejects that source schema.
  The schema-to-definition conversion expands shorthands with `full_validation: false`, so a `bytes` shorthand such as `size: 5121` becomes a long-form byte array with `minItems` and `maxItems` set to 5121. This method then writes only that normalized long form back and invokes generation 4; the existing shorthand-specific `bytes_size` check is no longer reached, allowing the typed path to accept a source schema that registration rejects. Preserve or re-run the shorthand admission checks in registration mode before normalization so definition construction retains source-schema parity.
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/v0/mod.rs:40-45: Definitions beyond the schema depth limit return the wrong error class
  Impact: A caller using full validation with a typed definition whose rendered schema exceeds the protocol depth limit receives a bare `ProtocolError::DataContractError` instead of the registration-style consensus data-contract error and its normal validation accounting.
  `definition.to_schema` checks the rendered schema depth before generation 3 runs and returns `write_error`, which constructs a bare `ProtocolError::DataContractError`. The schema registration path instead routes the same depth failure through `validate_schema_depth_and_account_for_size`, which reports the contract refusal as a consensus error under validation and records the schema-size operation. Map definition-rendering depth failures through the existing registration error helper on the full-validation path, leaving unrelated conversion failures unchanged.

In `packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/mod.rs`:
- [SUGGESTION] packages/rs-platform-version/src/version/dpp_versions/dpp_contract_versions/mod.rs:77-83: Adding the public version-table field is a Rust source compatibility break
  Impact: Downstream Rust users that construct `DocumentTypeClassMethodVersions` with a complete struct literal or exhaustive pattern stop compiling when upgrading to this release, despite the PR declaring no breaking changes.
  `DocumentTypeClassMethodVersions` is a public, non-`non_exhaustive` two-field struct in the previous release. Adding `try_from_definition` makes existing complete literals and exhaustive destructuring fail to compile even though the protocol behavior is additive. Document this Rust API compatibility change in the PR's breaking-changes section and release notes, including that pre-v16 callers should initialize the field as `None`.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/tests.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/tests.rs:1469-1476: The generated parity test treats matching compilation failures as successful parity
  Impact: A generated case where both document types fail compilation with the same error can be counted as `both_built`, allowing the test to pass without comparing compiled document types and inflating keyword coverage.
  The `compiled` closure returns a `Result`, and the comparison at line 1480 compares those results directly. When both compilations fail identically, the results are equal and the surrounding branch still reports `both_built: true`; the test therefore does not enforce that either document type actually compiled. Make the closure panic on compilation failure, as the corpus test does, so only successfully compiled document types enter the parity comparison.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; 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 and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
…on feature

Review of the entry point that builds a document type from its definition:

- Asked for full validation in a build without the `validation` feature, it
  refuses as not supported. The rules of registration are compiled with that
  feature, and it answered `Ok` for rules it had not applied.
- A definition that does not write as a schema, nesting deeper than a schema
  registers, is refused as registration refuses a contract: a consensus error
  where the rules of registration are compiled.
- The documentation says what a definition is held to: what registration holds
  the schema it writes back to, which holds byte arrays written out. The rules
  on a property type shorthand as such (a `bytes` size within the most a field
  may hold) are rules on reading a shorthand, and a definition holds none.
- The test that builds document types both ways fails on a document type that
  does not compile, where it compared two equal failures as built.
- New tests: the entry point is not supported at protocol version 15 and builds
  at 16; a byte array longer than a field may hold registers written out, from
  a schema and from a definition, while its shorthand is refused; a definition
  too deep to write is refused with a consensus error.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 1, 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 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@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 labels Dec 1, 2026

@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.

Re-review — Final validation — Phase 1 + Phase 2

Updated after discussion: 1 finding(s) of this review were settled in the inline threads.

  • ✅ Withdrawn: 🟡 The tests do not exercise full-validation refusal in JSON-only builds

New on this head: This revision makes typed document-type construction refuse full validation when the validation feature is absent, maps schema-rendering failures to the registration error class, and adds coverage for the protocol-16 boundary and written-schema parity. Rust workspace tests, Rust WASM tests, and Kotlin SDK build and tests passed on this head; the Swift SDK and JS build checks are still pending, with no code-check failures reported.

🟡 1 0 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: muse-spark-1.3-contributor (agent: phase1-reviewer, role: rust-quality); reviewer 3: gpt-6.2-astra (agent: phase2-reviewer, role: general); reviewer 4: gpt-6.2-astra (agent: phase2-reviewer, role: architecture-layering); reviewer 5: gpt-6.2-astra (agent: phase2-reviewer, role: platform-versioning); reviewer 6: gpt-6.2-astra (agent: phase2-reviewer, role: rust-quality); reviewer 7: gpt-6.2-astra (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: critical by gpt-6.2-sol (effort low) — The substantial Rust diff changes consensus-critical document-type construction and validation across a new protocol-version dispatch path and shipped parser generations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer, muse-spark-1.3-contributor — rust-quality (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Single stage: Phase 1 and Phase 2 reviewed this head side by side, with no blocker gate between them (triage tier)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-astra — general (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — platform-versioning (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — rust-quality (completed, effort high); agent phase2-reviewer, gpt-6.2-astra — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs`:
- [SUGGESTION → WITHDRAWN in discussion; do not fix] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/mod.rs:61-68: The tests do not exercise full-validation refusal in JSON-only builds
  Impact: For callers who enable `json-conversion` without `validation`, the tests would miss a regression that silently accepts a full-validation request or rejects a valid parse-only request.
  The reported JSON-only `cargo check` verifies compilation, not which calls succeed. The new test module requires `validation`, and DPP's self dev-dependency enables that feature through `all_features_without_client`, so an ordinary DPP test under the opposite feature gate would not exercise this branch. Add an isolated consumer test that depends on DPP with default features disabled and only `json-conversion` enabled. With one valid definition at protocol 16, assert that `full_validation: true` returns `NotSupported` and `false` builds successfully.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 1, 2026
@QuantumExplorer

Copy link
Copy Markdown
Member Author

/self-reviewed

@QuantumExplorer
QuantumExplorer merged commit bb1182d into v5.2-dev Dec 1, 2026
41 of 42 checks passed
@QuantumExplorer
QuantumExplorer deleted the feat/document-type-from-definition branch December 1, 2026 21:48
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
…dsa-65-keys

v5.2-dev gained a third note in the protocol version 16 notes (a document
type from its typed definition, #6433), where this branch had its note on
ML_DSA_65 identity keys. The base's note keeps number 3, which a table
comment cites, and the ML_DSA_65 note becomes note 4. No code conflicts.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
…et-listings

#6433 took v16 note 3; the listings note is v16 note 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
#6433 took v16 note 3: the offers note is v16 note 5 and cites the
listings as note 4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
#6433 took v16 note 3: the history note is v16 note 6. Brings the offer
proof's signed limit check, which the open-offer branch of this PR's
restructured verifier now applies too.

Review round of 2026-12-01 on #5531:
- A closed offer, proved by its orderPlaced record, is refused when the
  escrow at the record's decimals passes the transition's
  max_total_price (should_not_prove_a_closed_offer_whose_signed_limit_
  is_below_its_escrow).
- The token history storage flags row of the direct upgrade is pinned
  to protocol version 16 (pv16()), not latest().
- The TokenEvent and token history v3 CHANGELOG entries move under
  Unreleased.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QuantumExplorer added a commit that referenced this pull request Dec 1, 2026
#6433 took v16 note 3: the frozen listings note is v16 note 7. The
CHANGELOG entries of this PR move under Unreleased with the history ones,
reworded for protocol version 16 (SYSTEM_LIMITS_V6, lower_document_operation;
the raw converter's balance write merging is no longer part of this PR).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shumkov added a commit that referenced this pull request Dec 2, 2026
Generation 4 on v5.2-dev takes the typed definition after schema_defs
(#6433), so generation 5's call to it no longer compiled after the merge.
Generation 5 now takes definition: Option<&DocumentTypeDefinitionV0> in
the same position and forwards it, so generation 4's typed readers serve
a build from a definition; try_from_schema_v5 passes None, as
try_from_schema_v4 does. permissions is still read from the schema.

No test: a build fix with no behaviour change; the type-checker is the
check (cargo check -p dpp --all-features --tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants