Skip to content

fix: raise clear error for unaccompanied graph operators in selectors#1

Open
claygeo wants to merge 1 commit into
mainfrom
fix/selector-unaccompanied-graph-operator
Open

fix: raise clear error for unaccompanied graph operators in selectors#1
claygeo wants to merge 1 commit into
mainfrom
fix/selector-unaccompanied-graph-operator

Conversation

@claygeo
Copy link
Copy Markdown
Owner

@claygeo claygeo commented Mar 30, 2026

Summary

Fixes dbt-labs#10388

Selectors like +, @, 2+, or + model_name (with a space between the operator and model name) previously produced confusing or silent failures — they would either resolve to an empty node set or behave unpredictably. This PR raises a DbtRuntimeError with an actionable message pointing users to the correct syntax.

  • Extracted _validate_graph_operator_spec() helper so validation applies to both the CLI path (from_single_spec) and the YAML selector path (dict_from_single_spec)
  • Direction-aware error messages: + my_model suggests +my_model; my_model + suggests my_model+
  • 19 new unit tests covering all invalid forms and regression-guarding all valid forms

Test plan

  • python -m pytest tests/unit/graph/test_selector_spec.py -v — 32 tests pass
  • dbt run --select "+" should now raise a clear error message
  • dbt run --select "+my_model" should continue to work as before

Selectors like '+', '@', '2+', or '+ model_name' (with a space) now raise
a DbtRuntimeError with an actionable message instead of silently resolving
to an empty node set or producing confusing results. Validation is applied
in both from_single_spec() (CLI path) and dict_from_single_spec() (YAML
selector path) via a shared _validate_graph_operator_spec() helper.

Closes dbt-labs#10388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Warn or error when intersection selection syntax includes a hanging +

1 participant