Skip to content

Fix #2462: allow MATCH Input when Output has no MATCH#3756

Merged
T4rk1n merged 8 commits into
devfrom
fix-2462-match-semantics
Apr 22, 2026
Merged

Fix #2462: allow MATCH Input when Output has no MATCH#3756
T4rk1n merged 8 commits into
devfrom
fix-2462-match-semantics

Conversation

@bpostlethwaite

Copy link
Copy Markdown
Member

Fixes #2462.

Two years of comments on that issue all land in the same place: people want to use MATCH in an Input/State without repeating the same MATCH keys on the Output. This PR does exactly that.

Behavior change

You can now pair a MATCH input with a fixed-id Output, no Output, or a wildcard Output that only uses ALL:

@callback(
    Output("notifications", "children"),
    Input({"type": "grid", "id": MATCH}, "cellValueChanged"),
)
def on_edit(event):
    return f"edited: {ctx.triggered_id}"

Rules kept intact:

  • All Outputs of a callback must still share the same MATCH keys.
  • ALLSMALLER still requires a corresponding MATCH in an Output — it has no reference otherwise.

What's in the diff

  1. Validation (dependencies.js::findMismatchedWildcards) — skip the Input/State MATCH-subset check when the Output has no MATCH keys.
  2. Resolution (dependencies.js::addAllResolvedFromOutputs + dependencies_ts.ts::getCallbacksByInput) — when the Output lacks MATCH, the triggering Input's MATCH values become the callback's anyVals so simultaneous MATCH triggers each get a distinct resolvedId and don't collapse into one firing during deduplication.

Tests run locally

  • tests/unit/ — 377 passed, 4 skipped (2 browser-smoke failures are chromedriver/env, unrelated)
  • tests/compliance/ — 13 passed
  • dash-renderer Karma — 25 passed (includes 9 new cases for validation + resolvedId uniquification)
  • New Selenium: test_cbwc009_match_input_fixed_output, test_cbwc010_match_input_no_output, test_dvcv017_match_input_permitted_no_output_match — passed
  • Regression check: test_cbwc002_fibonacci_app, test_cbwc003_same_keys, test_cbwc008_running_match, test_dvcv006_inconsistent_wildcards — all still pass

Test plan

  • CI green
  • Spot-check a user app that hit the original error
bpostlethwaite and others added 7 commits April 21, 2026 10:37
Allow Input/State MATCH wildcards that aren't covered by the Output's
MATCH keys when the callback has a fixed-id Output, no Output, or only
ALL-wildcard Outputs. ALLSMALLER still requires a MATCH reference.

Fixes #2462.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When a callback's Outputs have no MATCH keys, multiple simultaneous
MATCH-triggered firings would collapse to the same resolvedId and
dedupe into a single invocation, losing all but the first trigger's
resolver. Thread the triggering Input's MATCH values through as the
callback's anyVals so each MATCH firing is addressable separately.

Refs #2462.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- findMismatchedWildcards permits MATCH in Input/State when the Output
  is a fixed-id, no-output, or ALL-only wildcard.
- ALLSMALLER and cross-Output MATCH mismatches still error.
- getAnyVals returns the trigger's MATCH values.
- getCallbacksByInput yields distinct resolvedIds per MATCH trigger
  when the Output has no MATCH keys.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds three integration tests covering the relaxed semantics from #2462:
- MATCH Input + fixed-id Output + State MATCH returns the right id.
- MATCH Input + no Output uses set_props against a fixed-id target.
- Repeated MATCH clicks resolve State to the current trigger, not a
  stale first one (verifies per-trigger resolvedId uniqueness).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds test_dvcv017 to confirm that callbacks with fixed-id, no-output,
or ALL-only wildcard outputs accept MATCH inputs without dispatching
validation errors, and test_dvcv018 to confirm ALLSMALLER still needs
a matching MATCH in the Output(s).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the extra MATCH-repeated-clicks integration test and the
ALLSMALLER-still-errors devtools test; keep only the two new-case
tests (MATCH → fixed Output, MATCH → no Output) plus the validation
smoke test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Black: collapse two click() chains that fit on one line and drop a
trailing blank line.
Prettier: reformat the new Mocha test file to match renderer style.
Flake8 W391 clears once the trailing blank lines go.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

@T4rk1n T4rk1n left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good 💃

@T4rk1n T4rk1n merged commit adad025 into dev Apr 22, 2026
67 of 69 checks passed
@T4rk1n T4rk1n deleted the fix-2462-match-semantics branch April 22, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants