Skip to content

Warn when selector contains unaccompanied graph operator#12776

Open
viniciusnunest wants to merge 2 commits into
dbt-labs:mainfrom
viniciusnunest:fix/10388-warn-unaccompanied-graph-operators
Open

Warn when selector contains unaccompanied graph operator#12776
viniciusnunest wants to merge 2 commits into
dbt-labs:mainfrom
viniciusnunest:fix/10388-warn-unaccompanied-graph-operators

Conversation

@viniciusnunest
Copy link
Copy Markdown

Resolves #10388

Problem

If you run something like dbt list --select + or dbt list --select 1+1,
dbt just accepts it silently and gives you unexpected results. Usually nothing,
sometimes everything downstream. No warning, no hint that the selector is wrong.

The original report was from someone who put an accidental space in an intersection
selector: model+,+ other_model. That space caused + other_model to be parsed
as just +.

Solution

Added detection for these "unaccompanied" graph operators in
SelectionCriteria.from_single_spec. When one is found, it fires a
NoNodesForSelectionCriteria warning, the same warning dbt already uses when
a selector matches zero nodes. Felt like the right fit instead of creating a
whole new event type.

A graph operator counts as unaccompanied when:

  • It has + or @ but no actual value (+, @, 1+)
  • The value is purely numeric, so it looks like a depth modifier instead of
    a model name (1+1, +2, 2+3)

Anything with letters, paths, or colons in the value passes through without
warning. So +mymodel, tag:my_tag, even +1abc are all fine.

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

Detect bare graph operators (+, @, 1+1) at parse time and emit a
NoNodesForSelectionCriteria warning instead of silently accepting them.

Fixes dbt-labs#10388
@viniciusnunest viniciusnunest requested a review from a team as a code owner April 5, 2026 12:18
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 5, 2026

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: vinicius.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@viniciusnunest viniciusnunest force-pushed the fix/10388-warn-unaccompanied-graph-operators branch from 1c28b61 to 27542d7 Compare April 5, 2026 12:24
@cla-bot
Copy link
Copy Markdown

cla-bot Bot commented Apr 5, 2026

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @viniciusnunest

@cla-bot cla-bot Bot added the cla:yes label Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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