docs(platform): say why in-place edits to shipped generations are inert - #5054
Conversation
Several shipped generations were edited in place during 4.2 without a comment at the edited lines saying why the edit cannot change consensus, and a few unversioned helpers became load-bearing for shipped generations without saying so. Comments only: - masternode vote balance pre-check v0 (#4904): both outcomes stay out of every block - parse_token_costs (#4828): meta-schemas v0-v2 refuse the optional key - parse_indices TTL agreement loop (#4581): only generation 3 admits timeRange - finalize_block_proposal v0 (#4741): the read only sets a Tenderdash hint - terminal_member_tree_type, property_name_tree_type_and_ranked_axes and its per-level form, equal_underlying_data: shipped generations call them, so a change belongs in a versioned method Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reachedNext included review available in 21 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Repository: dashpay/platform/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (6)
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. Comment |
|
🔍 Review in progress — actively reviewing now (commit d56f313) · triage: trivial |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final review — Phase 1 only (trivial change)
The exact-head diff changes comments only; no runtime behavior or version tables change. Two documentation inaccuracies are confirmed: the shared-parser notes incorrectly include generation 0, and the terminal-tree helper warning incorrectly says every protocol version selects remove_reference v0. Both are non-blocking wording corrections; the stated inertness conclusions remain intact.
💬 2 nitpick(s)
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: architecture-layering); reviewer 3: glm-5.3-flash (agent: phase1-reviewer, role: platform-versioning); final verifier: gpt-6-astra (agent: astra-gate-verifier, role: final-verifier)
- Triage:
trivialbygpt-6-astra(effort low) — The diff only adds or clarifies comments explaining consensus-inert edits and versioning constraints, with no changes to executable code or behavior. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort high); agentphase1-reviewer,glm-5.3-flash— architecture-layering (completed, effort high); agentphase1-reviewer,glm-5.3-flash— platform-versioning (completed, effort high); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 93% left, weekly 33% left; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 13% left, 5h 100% left) - Fresh verifier:
gpt-6-astra— final-verifier; agentastra-gate-verifier - Phase 2 reviewers: not run (triage rated this change trivial); this review comments and never approves
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs`:
- [NITPICK] packages/rs-dpp/src/data_contract/document_type/class_methods/try_from_schema/common/mod.rs:1200-1202: Attribute the shared-parser inertness proofs to generations 1–2
This note and the corresponding parse_token_costs note at lines 1469–1472 say generation 0 runs the shared code, but its driver parses indices inline through `.as_slice().try_into()` in v0/mod.rs and never calls parse_document_type_core or parse_token_costs. Generation 1 calls the shared core, and generation 2 delegates to generation 1. Update both notes to identify generations 1–2 (protocol versions 9–13) as the callers and, if retaining coverage of protocol versions 1–8, explain that generation 0 never reaches these edits. This preserves the correct inertness conclusion while stating the actual reason for each generation.
In `packages/rs-drive/src/drive/document/index_level_tree_types.rs`:
- [NITPICK] packages/rs-drive/src/drive/document/index_level_tree_types.rs:228-234: Correct the remove_reference generation selected by protocol version 14
The statement that every protocol version selects remove_reference_for_index_level_for_contract_operations v0 is false for protocol version 14. Its DRIVE_VERSION_V9 uses DRIVE_DOCUMENT_METHOD_VERSIONS_V4, which selects remove_reference v1; that implementation also calls terminal_member_tree_type at lines 131 and 251. Distinguish the v0 callers selected by protocol versions 1–13 from the v1 caller selected by protocol version 14. The frozen-helper warning remains valid; only its version-selection explanation needs correcting.
|
Your move: thepastaclaw left review threads unresolved; resolve them. |
…code Review follow-up: the shared parser code is reached by document type generations 1-2 (protocol versions 9-13); generation 0 parses inline. remove_reference v0 serves protocol versions 1-13 and v1 serves 14, both calling terminal_member_tree_type. The insert/update contract v0 operations are composed by every later generation, so every protocol version reaches the ranked tree-type helper. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Basic explanation
What this does: adds code comments only. Node code that already ran on the live network (the "shipped" versions of a function) must keep behaving exactly the same, forever, so a node syncing from the start computes the same state as everyone else. Our rule is that such code may only be edited when the edit provably cannot change anything, and the edited lines must say why. A few 4.2 edits were safe but did not say why, and a few shared helpers that old code now depends on carry no warning. This PR writes those explanations and warnings down.
Value: the next person editing these places sees why the current code is safe and that changing it would change what old protocol versions compute. That turns a silent trap into a documented one.
Risks: None. No code changes.
Issue being fixed or feature implemented
book/src/contributing/coding-conventions.md("Shipped generations are frozen unless the change cannot modify consensus") asks for a comment at every in-place edit to a shipped generation naming why it is inert for every protocol version that selects it. A review of the 4.1 and 4.2 changes found edits that are inert but uncommented, and unversioned helpers that shipped generations call without any note saying so.What was done?
masternode_vote/balance/v0(edited by fix(drive-abci): refuse a masternode vote on an unfunded poll as an unpaid consensus error #4904): a vote refused unpaid here, or one that failed inside execution before, never reaches a block, so the edit changes no block.try_from_schema/common::parse_token_costs(feat(platform)!: optional document token costs paid in credits when the token payment is left out #4828): document meta-schemas v0-v2 setadditionalProperties: falseondocumentActionTokenCost, so protocol versions 1-13 readoptionalasfalse, as before.try_from_schema/common::parse_indicesTTL agreement loop (feat(drive): time-range index TTL — O(1) flat-drop drainage and ephemeral-bytes fees #4581): only the generation 3 grammar admitstimeRange, so generations 0-2 never enter it.finalize_block_proposalv0 (feat(drive-abci): ask Tenderdash for the next block right away when withdrawal work is queued #4741): the pending-withdrawal read is unbilled and only sets the Tenderdash hint.terminal_member_tree_type(add/remove reference v0),property_name_tree_type_and_ranked_axesand its per-level form (insert/update contract v0),Value::equal_underlying_data(replace transformer v0 and proof verification v0). Any change to what they return for inputs old versions can produce belongs in a new versioned method.How Has This Been Tested?
cargo check -p drive -p drive-abci,cargo fmt --all. Comments only.Breaking Changes
None.
Checklist:
structure.rs, regeneratedgrovedb-structure.json, and checked the structure viewer link posted on this pull requestFor repository code-owners and collaborators only
🤖 Generated with Claude Code
PR Hygiene ·
d56f313/skip-botsproceeds without the ones not yet reported/self-reviewedonce the bots are doneWhen every box is checked the
PR Hygienecheck passes and this can merge.