feat: show a document type's GroveDB layout, computed by Drive - #3
Merged
Merged
Conversation
@dashevo/evo-sdk is built without dpp's validation feature, so DataContract.fromJSON(json, true, 14) runs the contract parser but not the document meta-schema or the parser checks gated behind that feature. The README, the examples registry and the validation script claimed more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A "GroveDB layout" button in the inspector opens every tree and element Drive writes for the selected document type: the documents by id (and revisions), and for each index the property and value trees down to the [0] where it ends, with each layer's element (count, sum, ranked, ...), its zero-contribution wrapper, the indexes that use it, conditions (the null fallback of a unique index, skipIfAbsent, preallocated, time window overlap) and a link to that kind of layer in the GroveDB structure viewer. The layout comes from documentTypeLayout in @dashevo/evo-sdk (dashpay/platform#5153), so it follows Drive's own rules. It is feature-detected: with an SDK that predates it, the panel says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 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 |
dashpay/platform#5153 merged with a review fix: a unique index's null fallback no longer repeats the terminal's indexes and notes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Sep 28, 2026
Brings in the inspector's JSON view (#5). The conflicts were both-sides additions: EntityView takes both onShowLayout and version, the README lists both layout.ts and jsonTokens.ts, and styles.css keeps both blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
QuantumExplorer
added a commit
that referenced
this pull request
Sep 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basic explanation
What this does: Select a document type and click GroveDB layout in the inspector. A panel opens with every tree and element Drive writes for that type: the documents by id, and for each index the tree per indexed property and per value, down to where the index ends. Each layer shows what kind of tree it is (plain, counting, summing, ranked), the indexes that use it, and a ↗ link to that kind of layer in the GroveDB structure viewer.
Value: You can see what an index costs in storage and what it can prove, for your own contract, without reading Drive. The structure viewer describes every document type at once, with templates ("an index property: one of 8 tree kinds"). This panel gives the concrete answer for one type and links back to the general description.
Where the layout comes from: Drive computes it, with the same rules it uses when it inserts documents (
documentTypeLayout, added by dashpay/platform#5153). A Drive test compares it with what Drive really writes. The visualizer only draws it, so it cannot drift from Drive.Needs an SDK release: dashpay/platform#5153 is merged (c795f81ce9), after 4.2.0-beta.6 was cut, so
documentTypeLayoutarrives with the next 4.2 release. It is not in@dashevo/evo-sdk4.2.0-beta.4, which this repo pins. The panel checks whether the function exists. Until the dependency is bumped to a release that includes #5153, it says so instead of showing a layout. So this can merge before that release, and it starts working with a plain version bump.Before and after
The marketplace example's
listingtype.byShop,byCategoryPrice,newListings, ...) and their keywords. How they are stored is in the insert code only.A ranked, summed indexOnly type (Yappr likes
tip) showsProvableCountProvableSumIndexedTree ranked by count, sum. A unique index (DPNSdomain) shows its[0]as aReference, with "or, when an indexed value of the document is null:" and the tree Drive writes instead.With the SDK this repo pins today (4.2.0-beta.4), the panel says:
What was done?
src/components/LayoutPanel.tsx(new): the panel. It draws a tree you can collapse. Each row shows:src/sdk/layout.ts(new): loads the SDK chunk on first use and callsdocumentTypeLayout, if the SDK has it. It turns a pasted bare map of schemas into a contract the SDK accepts, with placeholder id and owner (the layout does not depend on them).src/model/layout.ts(new): the layout types, the key text (‹shopId value›,‹$createdAt window: 1d every 1h›), the kind colours, the structure viewer links and the summary line.src/App.tsx,src/components/InspectorPanel.tsx:?url=link, a paste, or both sides of a compare.How Has This Been Tested?
npx vitest run: 87 passed. The newsrc/model/layout.test.tsruns against layouts that the SDK built from the merged #5153 (c795f81ce9) computed for three examples (src/model/fixtures/document-type-layouts.json): marketplacelisting, Yappr likestip, DPNSdomain.tscclean,npm run buildclean.node_moduleslocally, not committed), the panel draws marketplacelistingand Yapprtip, and each ↗ opens the matching node in the structure viewer.🤖 Generated with Claude Code