fix(plugins): a panel tree holds 20,000 nodes and says when it cuts (#1546) #1738
All Vouch review confidence checks passed
Residual risk 0.37 = Change Risk (0.52) × (1 − Review Confidence (0.28)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 43% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #1738"
general
weight: 0.35
github-actions[bot]
Closes #1546
A plugin panel tree (#1050, #1080) kept at most 5,000 nodes. That is too few for a country's administrative units: Brazil's 5,570 municipalities with the IBGE levels above them make 6,298 nodes, and Spain, Italy and Germany pass the limit with the municipalities alone. The BrasilData plugin, whose panel picks the work area from the IBGE boundaries, has had to send one region at a time, so a search for a municipality in a region not yet chosen finds nothing.
What changes
1.
MAX_TREE_NODESis 20,000. That covers Brazil with its whole hierarchy, and Spain (~8,100), Italy (~7,900) and Germany (~10,800).2. A cut tree is said, by name. When a tree's nodes go past the limit, the warning on the plugin's answer names the tree, how many nodes it was given and the limit:
<plugin>: tree catalogue was given 20001 nodes: only the first 20000 are kept, the most a tree holds. The panel shows a note under the tree ("Only the first 20000 of the 20001 nodes the plugin gave are shown: a tree holds at most 20000."), also when a search finds nothing, since what it looks for may be among those left out.plugin.panelanswers the tree's item with"cut": <nodes given>.3. Each label is folded once.
tree_nodeskeeps the folded label (lower case, NFD, marks dropped) inTreeNodewhen the nodes arrive, and a search compares against it (TreeNode::holds_words). Before,tree_rowsfolded every node's label at every frame while a search was typed.What #1667 already covered
#1667 (Plugins: report lossy panel updates) already counted nodes left out of an answer in one warning:
N option(s) or tree node(s) left out (no id, one repeated or too long, too deep, or past the limit). That stays for the other reasons. What it didn't say is which tree was cut at the limit, from how many nodes, and nothing showed in the panel. Nodes past the limit are now counted apart from that generic count, so a cut isn't said twice.Choices
tree_nodesadds the rest of a level, with what it holds, to apastcounter when it stops at the limit; the levels above count their own rest. Nodes left out for other reasons (no id, repeated, too deep) stay inDropped::nodes.foldmoved to thepluginscrate asTreeNode::fold, with theunicode-normalizationdependency (fromui-egui, which no longer uses it elsewhere). The front end folds the query with the same function, so the two can't drift.TreeNode::newbuilds a node with its folded label; the field ispub(crate)so a node can't be made outside the crate with a stale one.Measurement
A throwaway test (not in the PR) over 20,000 nodes with municipality-like labels ("São José do Rio Preto 123", "Mãe d'Água 456"…), searching "sao jose", in the workspace's test profile (optimized + debuginfo), Windows, three runs:
| | per search frame |
|---|---|
| before: fold every label, then compare | 29.6 / 30.9 / 51.3 ms |
| after: compare the stored folded label | 1.6 / 1.2 / 2.1 ms |
Folding is now paid once per answer that sends the nodes: building the 20,000 nodes took 34 ms (63 ms in the noisy third run), the
format!of the test labels included. Before, a 20,000-node search would have spent about 30 ms of every frame on folding alone, past a 60 fps frame's 16 ms.Tests
a_tree_cut_at_its_limit_says_so(plugins): 20,000 nodes are all kept with nothing said; 20,001 keep 20,000 and say the cut once, naming the tree and the count, not again in the generic count; a nested tree cut inside a branch counts the branches after it with what they hold, and a node without an id is still counted apart; fewer nodes again clearcut.a_tree_search_reads_the_label_folded_once(plugins): labels with accents (composed and decomposed), and ids standing for a missing label, are folded when kept;holds_wordsreads the stored folded label (changing it changes what is found).tree_rows_follow_open_branches_and_searches(ui-egui) runs as before onTreeNode::new.Locally (Windows):
cargo fmt --check,cargo clippy -p rustgis-plugins -p rustgis-engine -p rustgis-ui-egui --all-targets -- -D warningsandcargo xtask layerspass; the tests ofrustgis-pluginsandrustgis-ui-eguipass. Inrustgis-enginetwo tests fail on this PC on unrelated code:gdal_formats_open_when_gdal_is_installed(the GDAL here is older than the 3.8 it asks for) andportable_projects::reload::wrong_geometry_missing_file_and_missing_chosen_table_leave_the_layer_unchanged, which expects "file" in the operating system's error and gets it in Portuguese here. Twoarchive_render_revisiontests failed once under load and passed when run again.unicode-normalizationis already in bothTHIRD-PARTY-LICENSES.txtfiles, through other crates, so the notices don't change.Limits
🤖 Generated with Claude Code