fix(tools): widen ESRI Image attr_key resolution to fire for popup_options too - #17
Merged
Merged
Conversation
…tions too Debug audit 2026-05-21 secondary finding: add_esri_image_layer's attr_key resolution (PR #12) was gated on `if attribute_variables:`. The popup_options-alone case fell through with the display-name fallback, causing silent click-time misses in the popup-table render path. Server side (mcp_server.py:2061): `if attribute_variables:` triggered the _resolve_esri_layer_name call. popup_options provided WITHOUT attribute_variables left attr_key = name (display name). React side (utilities.js getImageArcGISRestLayerAttributes): keys alias maps by the service-side layer.name fetched from ?f=json — same as the attribute_variables path. So popup_options.{aliases,omit} keyed by display name would silently miss at lookup time. PR #11's outer-key normalization rewrites popup_options.{aliases,omit} to attr_key. With attr_key=display_name, that rewrote to the wrong key. Widen the guard from `if attribute_variables:` to `if attribute_variables or popup_options:`. The resolver is a soft-fail (returns None on network failure → fallback to display name preserved). Inline comment expanded to explain both code paths and the React popup-render contract. No new helper or behavior change for the attribute_variables case — just makes the existing resolution machinery fire for one more condition. 5 new in TestAddEsriImagePopupOptionsAttrKeyResolution: - test_popup_options_aliases_alone_uses_resolved_sublayer_name: the motivating case — popup_options.aliases alone, outer key rewritten to resolved sublayer name, not display name - test_popup_options_omit_alone_uses_resolved_sublayer_name: same for the omit field - test_both_attribute_variables_and_popup_options_same_attr_key: defensive — both fields keyed by the same resolved sublayer name - test_popup_options_alone_resolver_fails_falls_back_to_display_name: soft-fail path preserved - test_neither_attribute_variables_nor_popup_options_no_resolver_call: regression — when neither field is provided, resolver doesn't fire (no wasted network call) Full suite: 949 passed (944 baseline + 5 new). This is the 8th PR in the 2026-05-21 debug arc. Class A surface for ESRI Image now fully covered — the original PR #12 fix for attribute_variables + this PR for popup_options. Combined with PR #16 (WMS attr_key from wms_layers), all known Class A bugs are addressed. ESRI Feature / GeoJSON / KML / tile types / GeoTIFF / static image remain not-affected (caller-supplied layerName matches across server + React, or are not queryable at the attribute level).
romer8
force-pushed
the
fix/esri-image-popup-options-attr-key
branch
from
May 22, 2026 02:31
307f6af to
a5e6312
Compare
romer8
added a commit
that referenced
this pull request
May 22, 2026
Eight PRs from the 2026-05-21 popup-modal arc, grouped into Added / Changed / Fixed / Tests / Documentation per Keep a Changelog. New tool + slash-prompt for configure_popup_modal_layer (PR #10), case-fold args normalization for popup gridItems + render_plugin + add_dynamic_map_layer (PRs #14 + #15), ESRI sublayer-ID extraction from LAYERDEFS + ESRI Image guard widening (PRs #12 + #17), WMS attr_key from wms_layers (PR #16), popup_options outer-key normalization across all 11 add_*_layer tools (PR #11), tool description tightening for case-sensitive arg_names + 100-col grid (PR #13). Suite grew 930 → 961.
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.
Summary
Closes the flagged secondary Class A bug from the 2026-05-21 debug arc audit.
add_esri_image_layer'sattr_keyresolution (PR #12) was gated onif attribute_variables:— sopopup_options.aliasesprovided WITHOUTattribute_variablesgot the display-name fallback. React's popup-table render path (getImageArcGISRestLayerAttributes) keys by the service-side sublayer name fetched from?f=json, identical to theattribute_variablespath. Mismatch → silent click-time lookup miss.Root cause (verified)
Server (
mcp_server.py:2061):if attribute_variables:triggered_resolve_esri_layer_name. Withpopup_optionsalone,attr_keystayed =name. PR #11's outer-key normalization rewrotepopup_options.{aliases,omit}toattr_key— which was the wrong key.React (
utilities.js getImageArcGISRestLayerAttributes): keys results bylayer.namefrom the ESRI service's?f=jsonresponse — same as theattribute_variablespath.Fix
Widen the guard:
The resolver is already a soft-fail (returns
Noneon network failure → fallback to display name preserved). Inline comment expanded to explain both code paths and the React popup-render contract.No new helper. No behavior change for the existing
attribute_variablescase. Just makes the existing resolution machinery fire for one more condition.Tests
5 new in
TestAddEsriImagePopupOptionsAttrKeyResolution:test_popup_options_aliases_alone_uses_resolved_sublayer_name— motivating casetest_popup_options_omit_alone_uses_resolved_sublayer_name— same for omittest_both_attribute_variables_and_popup_options_same_attr_key— both fields keyed by same resolved nametest_popup_options_alone_resolver_fails_falls_back_to_display_name— soft-fail preservedtest_neither_attribute_variables_nor_popup_options_no_resolver_call— regression: no wasted network callFull suite: 949 passed (944 baseline + 5 new).
Debug arc completion
This is the 8th PR in the 2026-05-21 debug arc. Class A surface is now fully covered:
attribute_variablespopup_optionsCombined with PR #15 (render_plugin + add_dynamic_map_layer args case-fold) and PR #14 (configure_popup_modal_layer args case-fold), all known Class A + Class B surfaces are addressed.
Manual smoke after merge
Restart MCP server (with
TETHYSDASH_BASE_URLset). Try a prompt like:Expected: server log resolves to "Flow Forecast" (or whatever the actual sublayer name is); persisted
attributeAliaseskeyed by the resolved name; popup table column header shows "River ID" at runtime.