Skip to content

feat(layers): unify TreeLayer array and streamed inventory APIs - #806

Open
charlieforward9 wants to merge 9 commits into
codex/native-tree-labfrom
codex/tree-forest-performance
Open

charlieforward9 wants to merge 9 commits into
codex/native-tree-labfrom
codex/tree-forest-performance

Conversation

@charlieforward9

@charlieforward9 charlieforward9 commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Use one public TreeLayer for supplied rows or geographic getTileData inventory streaming with the same top-level accessors. An internal tile component owns traversal, cache/request limits and covered replacement. WorldTreeLayer remains a deprecated wrapper for existing treeProps callers.

Retain parent coverage until children are ready and preserve original owner picking across merged batches. Distant-crown picks include tile/source-tile metadata. Public streamingStats distinguish inventory residency from canopy/shadow submissions. Shared parent quotas retain each child's local caps.

Reject simultaneous nonempty data and getTileData; mode changes rebuild the renderer without recursive traversal or duplicate IDs. Interrupted replacements retime connected coverage contributors while independent neighboring fades finish on schedule. Numeric coverage accessors invalidate tree attributes without manual triggers. Strict playground schemas expose the same flat public inventory API.

Base: #794. Coit depends directly on #814 and does not require this PR. Geographic inventory traversal and Cartesian RAD hierarchy selection keep their own source contracts.

Final integration validation: immutable install, lint, package build, strict public/example types, production example bundles and website build pass. All 1,128 Node tests and 22 renderer browser contracts pass. All 28 Tree Lab, Citrus, forest and world application cases pass across the full-suite and focused final-fixture reruns. Renderer tests require software WebGPU and exercise both sorted backends.

The inventory browser fixture waits for the destination camera pages before asserting that coverage-only edits retain row-array identity.

Stack graph:

flowchart TD
  M[master] --> A["#807 prepared Composite SplatLayer"]
  A --> B["#814 shared static/RAD scenes"]
  B --> C["#794 native TreeLayer"]
  C --> D["#806 unified inventories"]
  D --> E["#808 tree examples"]
  E --> F["#809 migration / three removal"]
  B --> G["#815 independent Coit"]
  L["luma 9.4-release"] --> H["luma #3398 host/RAD support"]
  H -. compatible release .-> B
Loading

Full stack record.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Coverage

Stmts: 40.21% ▲+6.76% | Branch: 31.30% ▲+7.10% | Funcs: 33.52% ▲+5.48% | Lines: 39.71% ▲+6.33%

Test Files 136 passed (136)

@charlieforward9
charlieforward9 removed the request for review from chrisgervang October 6, 2026 23:53
@greptile-apps

greptile-apps Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 2/5

[Medium risk] Adds geographic streaming mode to the tree rendering layer.

The PR still needs fixes for the registry completeness check, lower child caps, and inherited shared budgets before merging.

Findings

  1. P1 Playground rejects streamed trees ▶
  2. P1 Child budgets are ignored ▶
  3. P1 Streamed trees escape shared limits ▶
  4. P2 Distant crowns ignore focus settings ▶

Summary

TreeLayer supports supplied rows and geographic streaming through one public API. WorldTreeLayer remains a deprecated wrapper.

  • Adds bounded tile requests, page fades, shared rendering budgets, and streaming counters.
  • Adds flat streaming props to playground schemas and documents the source contract.
  • Since the last review, only the browser test changed. It now waits for destination pages before checking coverage-only edits.
  • No new findings were accepted.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[TreeLayer] --> B{Input}
  B -->|data| C[Tree renderer]
  B -->|getTileData| D[TreeTileLayer]
  E[WorldTreeLayer compatibility wrapper] --> D
  D --> F[Bounded geographic tiles]
  F --> G[Page coverage fades]
  G --> C
  G --> H[Distant crown splats]
Loading

Reviews (18) · Last reviewed commit: "test(layers): wait for destination tree ..." · Reviewed by Greptile

Comment thread modules/layers/src/tree-layer/tree-wood-layer.ts Outdated
Comment thread modules/layers/src/splat-layer/splat-layer.ts Outdated
Comment thread modules/layers/src/tree-layer/tree-layer.ts
Comment thread modules/layers/src/tree-layer/world-tree-layer.ts Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/layers/src/splat-layer/splat-layer.ts
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from ba091e9 to b45becb Compare October 7, 2026 00:51
@charlieforward9 charlieforward9 changed the title Add bounded world trees and stable canopy refinement Add tree demos and retire the three workspace Oct 7, 2026
@charlieforward9
charlieforward9 changed the base branch from codex/citrus-tree-lab to codex/native-tree-lab October 7, 2026 00:51

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread examples/layers/tree-lab/citrus.ts Outdated
Comment thread examples/layers/tree-lab/forest.ts Outdated
Comment thread examples/layers/tree-lab/forest.ts Outdated
Comment thread website/src/examples/layers/tree-lab.mdx Outdated
Comment thread examples/layers/tree-lab/world.ts Outdated
Comment thread examples/layers/tree-lab/world.ts Outdated
Comment thread examples/layers/tree-lab/tree-profiler.ts Outdated
Comment thread examples/layers/tree-lab/benchmark.ts Outdated
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from b45becb to e2318e8 Compare October 7, 2026 01:30
@charlieforward9 charlieforward9 changed the title Add tree demos and retire the three workspace Add bounded WorldTreeLayer streaming Oct 7, 2026
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from e2318e8 to 5f8b7c4 Compare October 7, 2026 01:46
Comment thread modules/layers/src/tree-layer/world-tree-layer.ts Outdated

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/layers/src/tree-layer/world-tree-layer.ts Outdated
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from 5f8b7c4 to 4216f6e Compare October 7, 2026 02:31

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread modules/layers/src/tree-layer/tree-tileset.ts
Comment thread modules/layers/src/tree-layer/world-tree-layer.ts Outdated
Comment thread modules/layers/src/tree-layer/tree-coverage-transition.ts
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from 4216f6e to 0485485 Compare October 7, 2026 18:27
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from eb378bc to 4b06275 Compare October 7, 2026 21:04
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from 4b06275 to 34b2bd2 Compare October 7, 2026 21:55
@charlieforward9 charlieforward9 changed the title Add bounded WorldTreeLayer with shared canopy selection feat(layers): unify TreeLayer array and streamed inventory APIs Oct 7, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 34b2bd2. Configure here.

Comment thread modules/layers/src/tree-layer/tree-coverage-transition.ts
Comment on lines +331 to +334
...TreeTileLayer.defaultProps,
data: {type: 'data', value: []},
getTileData: {type: 'function', value: null, optional: true},
getDistantCanopyColor: {type: 'accessor', value: (canopy: TreeCanopyCluster) => canopy.color},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Playground rejects streamed trees

TreeLayer now accepts getTileData and inherits streaming defaults, but TreeLayerPropsSchema still lists only row-mode props. Playground rejects documents using the recommended streaming API because defineLayer makes the schema strict. The registry completeness test also fails on new defaults such as transitionDuration and maxVisibleTiles.

Add the public streaming props to TreeLayerPropsSchema and exclude internal-only defaults from the completeness check.

Knowledge Base Used: Playground and template workflow

@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from 34b2bd2 to 704a1c2 Compare October 7, 2026 22:30
Comment thread modules/layers/src/tree-layer/tree-coverage-transition.ts
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from 7687eed to d93fa81 Compare October 8, 2026 02:06
@charlieforward9
charlieforward9 force-pushed the codex/native-tree-lab branch 2 times, most recently from 2fdbd69 to 5c8e157 Compare October 8, 2026 02:34
@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from d93fa81 to 8ee4d66 Compare October 8, 2026 02:34
Comment on lines +356 to +361
maxCanopyPixels: pixelBudget,
maxCanopySplats: canopyBudget,
_splatBudgetGroup: this.state.splatBudgetGroup,
maxShadowSplats: Math.floor(
(this.props.maxShadowSplats ?? 50000) * this.state.frameBudget.scale
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Child budgets are ignored

When a host supplies lower limits through _subLayerProps.trees, getSubLayerProps applies them first. These later assignments replace maxCanopySplats, maxShadowSplats, and maxCanopyPixels with the inventory-wide values. Nearby trees therefore ignore the host's lower limits, despite the documented promise that nested tree caps remain effective.

Keep the shared parent budget, but preserve a lower child cap.

@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch 2 times, most recently from 48d811d to ac3e9f1 Compare October 8, 2026 03:30
Comment on lines +277 to +280
this.state.splatBudgetGroup.maxSplats = canopyBudget;
this.state.splatBudgetGroup.maxShadowSplats = Math.floor(
(this.props.maxShadowSplats ?? 50000) * this.state.frameBudget.scale
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Streamed trees escape shared limits

When a host supplies _splatBudgetGroup to share a rendering limit across sibling layers, a streamed TreeLayer stops honoring that limit. The public layer forwards the group, but TreeTileLayer creates its own group without connecting its parent. Near trees and distant crowns can therefore spend their own allowance on top of the siblings' work.

Set the inventory group's parent from the inherited group, and refresh that link when props change.

@charlieforward9
charlieforward9 force-pushed the codex/tree-forest-performance branch from ac3e9f1 to 40f776c Compare October 8, 2026 04:57
transparency: 'weighted',
_splatBudgetGroup: this.state.splatBudgetGroup,
pixelError: 2.5,
foveationStrength: 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Distant crowns ignore focus settings

TreeLayer exposes foveationStrength in streaming mode, but distant crowns always receive 1. Setting it to 0 disables the preference for central detail on nearby trees but not distant crowns. Forward the authored value so hosts can control detail consistently across both representations.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant