Repository navigation
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The PR appears safe to merge; the previous view-refresh issue is fixed. SummaryAdds caller-owned projection engines to
Reviews (2) · Last reviewed commit: "Reinitialize application views when proj..." · Reviewed by Greptile |
athomct
left a comment
There was a problem hiding this comment.
Thank you. The per-engine caches and the generation guard for replaced engines look solid. The tests cover replacement and isolation well. The focused specs pass for me (45 tests). I found one bug and one API question.
-
Built-in
OSMTile512fails with an injected engine. Only the default engine's cache containsWGS84_CRS,GLOBE_CRSandOSM_TILE_CRS(utils/crs.ts:107). The aliasswitchdoes not handle'OSMTile512'.MVTLayeruses this string as itscoordinateSystem. In aCustomProjectionView, or in a second view, the string goes toengine.getCRS. Results from a headless probe at this head:- With the default engine,
resolveCRS('OSMTile512')returnsOSM_TILE_CRS. - With
createProjectionEngine({projections: [equalEarth]}), it rejects with "Unsupported CRS definition: OSMTile512; resolve it first". - With the same engine,
GLOBE_CRS.signaturerejects with "Projection plugin is not registered: geocent". - A
LayerManagerwith aCustomProjectionViewportand a layer withcoordinateSystem: 'OSMTile512'loads with the default engine. With the injected engine,onErrorgets "loading coordinateSystem: Unsupported CRS definition: OSMTile512; resolve it first", and the layer does not load.
This contradicts
deck.md: "Built-in geographic/Cartesian aliases ... retain their existing semantics." Please check the three built-ins before the per-engine cache, or seed each engine map with them. Please also add a test with an injected engine andcoordinateSystem: 'OSMTile512'. - With the default engine,
-
Deck now holds clones of the caller's views.
_setViewsclones eachCustomProjectionView, and it clones all views when the engine changes. In a probe,getView('main') === myViewisfalse. Deck initializes only the clone, somyView.makeViewport(...)returnsnull. Before this PR, Deck initialized the caller's object. Also,View.clone()callsnew constructor({...props}), so a subclass loses state that is not inprops. The clone isolates a view that two Deck instances share with different engines. That case is rare, but the cost applies to all users. CouldCustomProjectionViewkeep its state per engine, for example in aWeakMap<CRSEngine, ...>? Then Deck can keep the caller's object. If you prefer the clone, please document thatgetView()returns an internal copy.
Small items:
- A layer whose
coordinateSystemequals a prepared view descriptor's signature uses that descriptor and does not call the engine (layer-manager.ts:508). I think that this is correct. One sentence indeck.mdwould make it explicit. LayerContext.projectionEngineis required in an exported type. Code that builds aLayerContextby hand gets a type error. Consider making it optional, or note it inwhats-new.md.
| } | ||
| let resolvedCRS = engineCaches.get(engine); | ||
| if (!resolvedCRS) { | ||
| resolvedCRS = engine === defaultProjectionEngine ? defaultResolvedCRS : new Map(); |
There was a problem hiding this comment.
An injected engine starts with an empty map. So 'OSMTile512' (used by MVTLayer) and GLOBE_CRS.signature go to engine.getCRS and fail. Please check the built-ins first, or seed this map with the same three entries as defaultResolvedCRS.
| ? previous | ||
| : view; | ||
| : engineChanged || view instanceof CustomProjectionView | ||
| ? view.clone({}) |
There was a problem hiding this comment.
With this clone, deck.getView(id) returns a copy. The caller's view also stays uninitialized, so makeViewport() on it returns null. Could the view keep per-engine state instead?
|
|
||
| export type LayerContext = { | ||
| /** Caller-owned CRS and transform factory selected by Deck. */ | ||
| projectionEngine: CRSEngine; |
There was a problem hiding this comment.
projectionEngine is required in the exported LayerContext type. Code that builds a context by hand gets a type error. Please make it optional, or note it in whats-new.md.
| `getCRS` is not sufficient for geographic views. | ||
|
|
||
| Custom projection views and layer source `coordinateSystem` definitions use this | ||
| engine. Prepared view descriptors bypass resolution. Built-in geographic/Cartesian |
There was a problem hiding this comment.
Suggest: "Layers whose coordinateSystem equals a prepared descriptor's signature also use that descriptor."
|
This is a reminder about my review of 16 November. The four inline threads above have no answer yet:
|
Requires #11106
Background
Deck resolves custom-view and layer-source CRS definitions through a module-global math.gl engine. Applications cannot select their own registered algorithms, grids or backend consistently. Add
Deck({projectionEngine}), defaulting to the existing math.gl engine, so definitions resolve through a caller-owned factory while prepared descriptors remain an explicit bypass.The contract is math.gl's
CRSEngine(getCRS,createProjection,createProjectionAsync), because rendering requires descriptor metadata as well as point transforms. Keep engine configuration immutable while in use; replace the object to change execution.nullrestores the default. Deck never mutates or disposes the factory. Built-in coordinate aliases and MapView/GlobeView camera models retain their existing semantics.Change List
Verified: full package build, lint, 75 focused browser tests and 123 Node tests pass. Final-head CI passes coverage, WebGPU, website, Python and projection-example checks. Greptile and Bugbot pass; Codex review is unavailable due to account quota.
#11030 owns typed bitmap mesh inputs; #11031 owns image-to-position CRS mapping. This PR exposes
layer.context.projectionEngineand marksprojectionChangedwhen it changes. #11031 should consume that engine withcreateProjectionAsyncduring mesh preparation and rebuild generated UVs on replacement instead of importing the global engine. Its existing mesh/version guard can reject stale output. This core PR does not duplicate the still-unmerged BitmapLayer implementation. Merge order: #11106, this PR; integrate the context service into #11031 on top of #11030.