Repository navigation
Report set_style and set_filter changes that never reach the map (#409) - #429
Merged
Merged
Conversation
setStyle now parses a JSON-string style and rejects an empty string, an empty object or an array instead of returning success with no updates or iterating a string's characters. Paint values and filters that MapLibre rejects through its error event, rather than by throwing, are now reported as failures with MapLibre's message, and a rejected filter is not recorded as the layer's filter. The set_style schema lists the common paint properties, so constrained decoders have something to generate.
Tested on ca-30x30 with DeepSeek V4 Flash, which sent "fill-opacity": "1" as a string when the set_style properties were untyped. Opacity, width and radius are now typed number or expression, and the same prompt sends 1. MapLibre 5.22 throws on a filter whose types don't check, such as a match returning "true"/"false", instead of firing its error event, so the agent got a generic tool error. That throw is now reported the same way: the filter is rejected and the layer is unchanged.
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.
Closes #409.
Some models send
set_styleastyleof""or a whitespace string.setStylereported success with no updates for an empty string, and for any other string it iterated the characters as property names. Separately, MapLibre reports an invalid paint value or filter through the map'serrorevent rather than by throwing, soset_styleandset_filterreported success for changes that never reached the map.setStyleparses a JSON-string style and rejects an empty string, an empty object or an array with an error that shows the expected shape.setStyleandsetFilterlisten forerrorevents during the MapLibre call. A rejected value is reported with MapLibre's message (for examplefilter[2]: Expected number but found string instead). A rejected filter is not recorded as the layer's filter.set_styleschema lists the common paint properties, withadditionalProperties: true, so constrained decoders have something to generate.The schema properties have no
type, because a paint value may be a string, a number or an expression. That is valid JSON Schema, but it's worth one run on a downstream app with DeepSeek V4 Flash, the model that hit this, before release.Tests:
test/map-manager.map-errors.test.js.