Skip to content

feat(dpp): read the type-level keywords of a document type from its typed definition - #6437

Merged
QuantumExplorer merged 7 commits into
v5.2-devfrom
feat/definition-type-level-keywords
Dec 1, 2026
Merged

QuantumExplorer merged 7 commits into
v5.2-devfrom
feat/definition-type-level-keywords

Conversation

@QuantumExplorer

@QuantumExplorer QuantumExplorer commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Basic explanation

What this does: #6433 added DocumentType::try_from_definition, which builds a document type from its typed definition, with five keywords read from the definition's typed fields and everything else read from the schema the definition writes back. This PR moves the rest of the type-level keywords to the typed fields: the flags, the key requirements, the aggregates, moderatorAbilities, immutable, actionFees, tokenCost and private. Properties, indexes, references and the rule language are still read from the written-back schema and follow in later PRs.

Value: One more section of the grammar no longer goes through JSON on the way from a definition to a document type. Where a schema reader carried rules as well as shape checks, the rules now live in one function that both sources call, so a definition is held to the same code as a schema, not to a copy.

Risks: Low. Nothing carries a definition, so no state transition is validated differently. Four shipped readers were split so that their rules could be shared; each split keeps every read and every refusal at the place and in the order it had (see "In-place changes to shipped generations").

Follows #6433, which is merged: this branch is rebased on v5.2-dev and holds only its own commits.

Issue being fixed or feature implemented

Part of removing JSON schema from the protocol in 5.2, after #6422 and #6433.

What was done?

Typed readers in try_from_schema/typed_keywords.rs, each standing where the schema reader it replaces stands in the parse:

Keywords Typed reader Rules it applies
documentsKeepHistory, keepsTransferHistory, keepsPurchaseHistory, keepsPricingHistory, documentsMutable, canBeDeleted, transferable, tradeMode, creationRestrictionMode flags the contract's defaults, as before
signatureSecurityLevelRequirement, the two bounded key requirements security_level_requirement, bounded_key_requirement none
documentsCountable, rangeCountable, documentsSummable, rangeSummable, documentsAverageable, rangeAverageable aggregates the desugaring of the averageable shorthands, shared (desugar_doctype_aggregates)
moderatorAbilities moderator_abilities the defaults of deleteSettled, shared (settled_deletion_rule); an empty object or list refused
immutable immutable a property listed twice refused
actionFees DocumentActionFees::try_from_definition the three rules of the schema reader, shared
tokenCost token_costs_from_definition the four rules of registration, shared (token_cost_rules)
private declares_private_document, private_document the keywords a private type may declare; an entry size of zero refused

Two things are deliberately partial:

  • A condition of immutable is still handed on as written, taken from the written-back schema at the entry's place in the list. The stage that applies it parses the rule language from a schema, and the rule language moves in its own PR.
  • keywords! gains declared_keywords (crate-visible), the keywords a group of a definition declares. The rule on a private type's keywords reads it where the schema reader reads the keys of the schema.

In-place changes to shipped generations

All in code protocol versions up to 15 select. In each, a schema is read by the same calls in the same order, and refused by the same code at the same point.

  • parse_document_type_core (every generation) takes definition: Option<&DocumentTypeDefinitionV0> and keeps it in its context. Generation 1 passes None; generation 3 passes what it was given, None for a schema.
  • Reads that became match definition { Some(d) => typed reader, None => the call that was there }: the aggregates, moderatorAbilities, immutable, actionFees, the entry size of private, the three key requirements. parse_document_type_flags and parse_token_costs return the typed reader's answer first when there is a definition and are otherwise unchanged.
  • parse_doctype_aggregate_keywords is split where it already divided: its six reads, then desugar_doctype_aggregates on what they read. The one difference in the text: the desugaring used to read documentsCountable a second time to tell "left out" from false; it now uses the first read's answer, which is the same value from the same call.
  • parse_moderator_abilities_keyword reads the three values of a deleteSettled in the order it did and hands them to settled_deletion_rule, which fills in the defaults it filled in.
  • declares_private_document takes the definition as an optional argument and, in the generation the version selects, calls the reader of a schema as before when there is none.
  • DocumentActionFees::try_from_document_schema: its three rules (a part over the maximum, an action that charges nothing or adds up past the maximum, no action priced) move to functions of their own, each called where the rule stood.
  • parse_token_costs: its four rules move to token_cost_rules, called where they stood, after an action's cost is read and before who pays its gas is. The function is marked rustfmt::skip so that its remaining lines read as they did: rustfmt had left it unformatted because one of its lines, now among those moved, was too long to break.

How Has This Been Tested?

  • cargo test -p dpp --lib native_schema::tests: should_build_a_document_type_from_its_definition_as_from_its_schema builds document types from their definitions and from their schemas and holds the two to the same compiled document type or to a refusal both ways. It now requires 46 keywords and shapes of keywords to be declared by a document type that builds, and adds the cases no written document type had: each kind of history kept alone, a range count, the averageable shorthands, every moderator ability (a settled deletion under an elected team), two conditional immutable entries, every action priced in credits and in tokens with each payer of gas, a private type, and a private type with a keyword only the private rule refuses.
  • Mutation checks, not committed: 42 single changes to the typed readers (a field dropped, read as its default, read for its neighbour, off by one), each run against the test above. All 42 fail it. Six did not at first, and they showed five missing cases, now added: deleteKeepsRecord only at its default, a condition taken from the wrong entry, one action's fee read for another, one kind of history read for another (twice), and the private keyword rule hidden by a later refusal.
  • cargo test -p dpp --lib class_methods::: 1,093 passed. cargo test -p dpp --lib action_fees: 21 passed. cargo test -p dpp --lib definition::: 47 passed. cargo test -p dpp --test contract_corpus: 11 passed.
  • cargo clippy -p dpp --all-targets --all-features --locked -- --no-deps -D warnings, cargo check -p dpp --lib with no features, cargo fmt --all: clean.

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

Breaking Changes

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 · b4275e7

  • Bots — thepastaclaw not yet — /skip-bots proceeds without the ones not yet reported
  • 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 type definitions support settings for action fees, token costs, aggregates, moderation abilities, history, and private-document requirements.
    • Omitted fee pricing and settled-deletion approval settings receive defined defaults.
  • Bug Fixes
    • Invalid or conflicting declarations, including empty abilities, duplicate immutable fields, and contradictory aggregate settings, are rejected.
    • Validation is applied consistently to schema-based and typed document definitions.

@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

Document-type construction now reads additional keywords from typed definitions. Shared parsing applies validation and defaults across typed-definition and schema inputs. Expanded tests cover typed-definition construction and keyword coverage.

Changes: Typed keyword parsing

Layer / File(s) Summary
Typed keyword readers and validation
packages/rs-dpp/src/data_contract/document_type/definition/v0/keywords.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/action_fees/mod.rs
Adds typed-definition readers for document-type keywords and action fees. The readers apply defaults and validate declared values. The keyword macro lists declared keywords in grammar order.
Parser integration and shared rules
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.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/v1/mod.rs, packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_definition/v0/mod.rs
Generation 3 passes an optional typed definition to shared parsing. Typed keyword readers supply values when present; schema parsing remains the fallback. Shared rules validate token costs and resolve aggregate and settled-deletion defaults.
Typed-definition parity tests
packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/native_schema/tests.rs
Adds construction and keyword-coverage cases for typed definitions, including aggregates, action fees, token costs, history flags, private types, immutable entries, and moderator abilities.

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

Change: Refactor

Sequence Diagram(s)

sequenceDiagram
  participant Definition as DocumentTypeDefinitionV0
  participant Parser as Generation 3 parser
  participant Readers as typed_keywords
  participant Core as parse_document_type_core
  Definition->>Parser: provide typed keyword values
  Parser->>Readers: read typed aggregates, fees, abilities, and immutable fields
  Parser->>Core: pass optional typed definition
  Core->>Readers: read flags, key requirements, and token costs
  Core-->>Parser: return parsed document-type data
Loading

Possibly related issues

  • dashpay/platform#6427: Tracks typed-definition follow-ups. This change reads additional keywords from that typed definition, while the issue’s registration-rule items remain outside these changes.

Possibly related PRs

  • dashpay/platform#6422: Defines the typed document-definition grammar and schema translation used by the typed keyword readers.
  • dashpay/platform#6433: Adds the typed-definition construction path that this change extends with additional keyword readers.

Suggested reviewers: thepastaclaw, shumkov

Merge Risk: Minimal · up to b4275

This change moves more document-type keyword parsing onto typed definitions while keeping the schema-based fallback and the existing defaults and validation. No concrete defect was found in the supplied changes, and the parity tests cover the new keywords. The full test suite was not run, so normal CI should confirm before merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "feat(dpp): read the type-level keywords of a document type from its typed definition" matches the main change. The PR moves document type-level keywords (flags, key requirements, aggregates…
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.
Full details: Title check

Explanation

The title "feat(dpp): read the type-level keywords of a document type from its typed definition" matches the main change. The PR moves document type-level keywords (flags, key requirements, aggregates, moderator abilities, immutable, actionFees, tokenCost, private) from schema parsing to typed definition fields, and adds a declared_keywords helper. The title is specific and concise. It does not name every keyword, which is expected.

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 e44b8d6 and b4275e7.

Files selected for processing: 1

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs
Files skipped from review as they are similar to previous changes: 1

  • packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.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

🔍 Review in progress (commit b4275e7) · live progress · priority

@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

This change routes the remaining type-level document keywords through typed-definition readers while preserving schema-based parsing and adds broad equivalence and mutation coverage. The CI snapshot shows no failed checks; the Kotlin SDK build and review check are still in progress.

🟡 4 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) — This is a large, intricate change to consensus-critical document-type parsing and validation across shipped protocol generations, including flags, key requirements, aggregates, privacy, fees, and token-cost rules.
  • 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_schema/common/mod.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs:2287-2293: An oversized token position reports a different error code when read from a definition
  Impact: With validation enabled and full validation disabled, callers parsing tokenPosition 65536 receive code 10228 from a typed definition but code 10103 from the equivalent schema.
  The typed-definition path rejects the same out-of-range value as the schema path but constructs DataContractError::ValueWrongType, while the schema reader's get_integer::<TokenContractPosition> returns platform_value::Error::IntegerSizeError. Generation 3 maps these to different public error codes. Map the narrowing failure to IntegerSizeError so the existing generation-level conversion preserves parity.

In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/typed_keywords.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/typed_keywords.rs:142-149: The two readers independently decide whose approval counts for a settled deletion
  Impact: A future change to moderation defaults in only one reader can make the same document type use different authorization rules depending on whether it was parsed from a schema or a typed definition.
  Both paths currently default approvals to one and approversPredateDocument to approvals > 1, but the typed reader repeats the rule implemented in parse_moderator_abilities_keyword. This is authorization behavior rather than merely input-shape validation. Extract a shared SettledDeletionRule constructor that accepts the decoded optional values, and retain each reader's existing shape checks and error ordering.
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/typed_keywords.rs:348-381: A new private-document parser generation must be added to two independent dispatchers
  Impact: If a later protocol version adds parse_private_document generation 1 to the schema dispatcher but not this typed dispatcher, every typed-definition parse at that version fails with UnknownVersionMismatch, including non-private document types.
  The schema path dispatches parse_private_document through common::declares_private_document, while the typed path independently matches the same version table before checking whether private is present. The duplicated version gate can drift and can reject definitions even when no private declaration exists. Centralize the version dispatch and pass the schema or definition keyword source into the selected generation.

In `packages/rs-dpp/src/data_contract/document_type/definition/v0/keywords.rs`:
- [SUGGESTION] packages/rs-dpp/src/data_contract/document_type/definition/v0/keywords.rs:59-70: The new declared_keywords helper exposes public API on every keyword group
  Impact: Downstream users can depend on a Vec-returning method and its ordering on all public keyword-group structs, expanding the API that rs-dpp must preserve even though only the internal private-document check uses it.
  The macro adds a public declared_keywords method to every generated keyword group, including nested ability, fee, property, rule, and reference types. The only repository caller is the internal typed private-document reader, so this visibility is broader than required. Restrict the generated helper to crate visibility.

Base automatically changed from feat/document-type-from-definition to v5.2-dev December 1, 2026 21:48
QuantumExplorer and others added 6 commits December 2, 2026 04:48
…e typed definition

Building a document type from its definition reads `documentsCountable`,
`rangeCountable`, `documentsSummable`, `rangeSummable`, the two averageable
shorthands and `moderatorAbilities` from the definition's typed fields.

The reader of the aggregate keywords is split where it already divided: its
six reads of the schema, then the desugaring of the shorthands, which now takes
what was read as a `DeclaredDoctypeAggregates`. A schema is read by the same
calls in the same order and desugared by the same code, and a definition hands
its fields to that desugaring, so the rules are written once.

The test that builds document types both ways requires each of these keywords
to be declared by a document type that builds, with cases added for the ones no
written document type declared. With any field of the two typed readers
dropped, it fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Building a document type from its definition reads `immutable` and
`actionFees` from the definition's typed fields.

- `immutable`: the properties listed by name and those listed with a
  condition, a property listed twice refused. A condition is still handed on
  as written, taken from the schema the definition writes back at the entry's
  place, since the stage that applies it parses the rule language from a
  schema.
- `actionFees`: `DocumentActionFees::try_from_definition`. The three rules of
  the schema reader (a part over the maximum, an action that charges nothing or
  adds up past the maximum, no action priced) move to functions of their own,
  called where each stood, so a schema is held to them at the same places and a
  definition is held to the same code.

The test that builds document types both ways requires both keywords to be
declared by document types that build, with cases for two conditions and for
every action priced. With a field of either reader changed, it fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Building a document type from its definition reads its flags
(`documentsKeepHistory`, the three kinds of kept history, `documentsMutable`,
`canBeDeleted`, `transferable`, `tradeMode`, `creationRestrictionMode`) and its
key requirements (`signatureSecurityLevelRequirement` and the two bounded key
requirements) from the definition's typed fields.

The core parse, which every generation shares, takes the definition as an
optional argument and keeps it in its context. Generation 1 passes `None`, as
generation 3 does for a schema, and the reads of the schema are then the ones
that were there, in the same order.

The test that builds document types both ways requires each of these keywords
to be declared by a document type that builds, with each kind of history kept
on its own. With any of them misread, it fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Building a document type from its definition reads `tokenCost` from the
definition's typed fields.

The four rules registration holds a token cost to (a position the contract
has, a non-transferable token burnt, no cost in this contract's token named by
its id, no burning of another contract's token) move out of the schema reader
into `token_cost_rules`, called where they stood: after an action's cost is
read and before who pays its gas is. A schema is held to them at the same
place, and a definition to the same code.

`parse_token_costs` keeps the formatting it had, marked `rustfmt::skip`: one of
its lines was too long for rustfmt to format the function, and is among those
moved.

The test that builds document types both ways requires a cost in another
contract's token and in a token of the contract, a burnt one, each payer of
gas, an optional cost and every action to be declared by document types that
build. With any field of the typed reader misread, it fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Building a document type from its definition reads `private` from the
definition's typed fields: whether the type is private, the keywords a private
type may declare, and the bytes each entry takes.

A group of keywords of a definition says which keywords it declares
(`declared_keywords`, written by `keywords!`), which the rule on a private
type's keywords reads in place of the keys of a schema.

The test that builds document types both ways builds a private type, and one
with a keyword only that rule refuses. With the typed readers changed, it
fails.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Review of the typed readers of the type-level keywords:

- The defaults of a `deleteSettled` (one approval, approvers predating the
  document from two) are filled in by one function, `settled_deletion_rule`,
  for a schema and for a definition. The schema reader reads its three values
  in the order it did and hands them over.
- `common::declares_private_document` dispatches on the version of the
  `private` keyword once, and calls the reader of a schema or of a definition
  in the generation it selects. The typed reader no longer matches the version
  table itself.
- A token position past a token position's range is refused from a definition
  with the error a schema's reader gives, `IntegerSizeError`.
- `declared_keywords` is visible in the crate only.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@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
@QuantumExplorer
QuantumExplorer force-pushed the feat/definition-type-level-keywords branch from 43e3f83 to e44b8d6 Compare December 1, 2026 21:50
@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.

@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

New on this head: This head contains the review-fix refactor that centralizes private-document dispatch, settled-deletion defaults, and typed/schema error handling while keeping the existing schema paths intact. The CI snapshot shows the relevant Rust, wasm32, JavaScript, and Kotlin checks still in progress; completed checks are successful and no failed code check is reported.

💬 1 nitpick(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) — This is a large, intricate change to consensus-critical document-type parsing that alters validation and interpretation of typed definitions, including key requirements, action fees, token costs, privacy, and protocol-versioned readers.
  • 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_schema/common/mod.rs`:
- [NITPICK] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs:3250-3254: The moderation validator's Rustdoc is attached to the defaults helper
  Impact: Maintainers reading either function receive misleading documentation: the defaults helper appears to enforce the full moderation contract, while apply_moderator_abilities is left without its intended Rustdoc.
  The Rustdoc immediately preceding `settled_deletion_rule` describes `apply_moderator_abilities`, including that it runs after immutable-field, index, reference, and generated-property processing, but Rust attaches that entire block to `settled_deletion_rule`, which is called during keyword parsing. Move `settled_deletion_rule` and its four-line rule-specific comment above the documentation beginning `Applies the moderatorAbilities object`, so the moderation contract remains attached to `apply_moderator_abilities` and the helper receives only its own documentation.

@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
`settled_deletion_rule` and `token_cost_rules` were added between
`apply_moderator_abilities` and `parse_token_costs` and their documentation,
which then described the new functions. Each helper now stands before the
documentation of the function it was added beside.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@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.

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