Skip to content

feat: new flag --list-rule#1815

Open
clarson2022 wants to merge 8 commits intofirecow:masterfrom
clarson2022:report-rule-match
Open

feat: new flag --list-rule#1815
clarson2022 wants to merge 8 commits intofirecow:masterfrom
clarson2022:report-rule-match

Conversation

@clarson2022
Copy link
Copy Markdown

@clarson2022 clarson2022 commented Mar 25, 2026

Context

In my use cases, we have complex pipeline configurations and having the ability to see what rule is being matched is helpful for debugging when jobs unexpectedly are or aren't being added to the pipeline.

Proposed Solution

This new flag would result in similar output to --list but would display the rule that a job matched on, i.e. the one that was triggered by rules conditions that result in it being added to the "list".

Changes

  • main changes are to runList(): in the case that listRule is set and a job has rules, rather than displaying the 'needs' of the job, display the rule it matched on.
  • other changes are to support capturing the matching rule when getRulesResult determines it
  • test case list-rule-case added with 2 tests

Summary by cubic

Adds a new --list-rule flag to list jobs and show which rule condition(s) matched (if/exists/changes), replacing the needs column in this mode. Works with --evaluate-rule-changes to surface matched changes patterns.

  • New Features

    • New CLI flag --list-rule (+ help text) that switches list view to a “rule” column.
    • Prints matched condition(s) from Utils.getRulesResult into Job.matchedRule; rules with only when do not print.
    • README updated with examples; added integration tests for if, exists, changes, combined cases, and when-only behavior.
  • Bug Fixes

    • Updated rules.test.ts to assert matchedRule outputs; fixed ESLint and yamllint issues.

Written for commit 93766de. Summary will update on new commits.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 10 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/utils.ts">

<violation number="1" location="src/utils.ts:210">
P2: `matchedRule` is populated only from `rule.if`, so rules that match via `exists`/`changes` without `if` are not shown by `--list-rule`, making the output misleading for valid rules.</violation>
</file>

Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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.

1 participant