fix(set_style): repoint hex paint to the layer's real value column (#259) - #260
Merged
Conversation
) The agent builds set_style data-driven expressions without a reliable signal of a dynamic hex layer's value column, so it defaults to ["get","count"]. On a layer whose property is e.g. species_richness that get resolves to null on every feature and the ramp silently yields no color — the recolor is a no-op. - store valueColumn on hex layer state - rewriteValueColumn() (pure, in hex-layer-helpers) repoints any value-bearing get to the real column, leaving `res` and already-correct expressions untouched; setStyle applies it and reports a note - surface valueColumn in get_map_state so the agent can discover it - note the dynamic-column rule in the set_style tool description Tests: rewriteValueColumn unit coverage + setStyle hex rewrite path.
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Fixes #259.
Problem
When a user asks to recolor a dynamic hex layer, the agent calls
set_stylewith a plausible data-driven expression — but hardcodes the value property as["get","count"].countis only the real column foragg="COUNT"tilesets. On a layer whose property is e.g.species_richness,["get","count"]resolves to null on every feature, theinterpolateyields no color, and the recolor is a silent no-op.Observed in padus logs (2026-06-20 ~05:16): "show san diego county gbif richness as hex" → "change the colormap" produced
set_styleagainst["get","count"]while the tileset property wasspecies_richness.Fix (client-side, deterministic)
valueColumnon the hex layer's state ataddHexTileLayer.rewriteValueColumn(expr, valueColumn)inhex-layer-helpers.jsrecursively repoints any value-bearing["get", X]to the real column. It leaves the per-resolutionreskey and already-correct expressions untouched, and reports which properties it repointed.setStyleapplies the rewrite for hex layers (those carryingvalueColumn) and returns a transparentnoteso the correction isn't silent.get_map_statenow exposesvalueColumnfor hex layers so the agent can discover the right column.set_styletool description gains a short note that forhex-…layers the value column is the one passed toadd_hex_tile_layer, notcount.Non-hex layers are unaffected (no
valueColumnin state → no rewrite).Tests
rewriteValueColumn: repoint, no-op on correct column,resleft alone, distinct-replacement reporting, literal pass-through, longergetforms left alone.setStyle: hex rewrite applies corrected paint + emits note; correct expression unchanged; non-hex layer not rewritten.Full suite green (312 tests).