Skip to content

feat: add suite_status filter for cloud drift tests#210

Merged
sohil-kshirsagar merged 2 commits intomainfrom
feat/suite-status-filter
Mar 25, 2026
Merged

feat: add suite_status filter for cloud drift tests#210
sohil-kshirsagar merged 2 commits intomainfrom
feat/suite-status-filter

Conversation

@sohil-kshirsagar
Copy link
Copy Markdown
Contributor

@sohil-kshirsagar sohil-kshirsagar commented Mar 25, 2026

Add a suite_status filter that lets users fetch and run cloud tests by their suite status (draft or in_suite), e.g. tusk drift run --cloud -f 'suite_status=draft'.

Why

Today, draft tests are only fetchable through the validation endpoint. There's no way to run just draft tests to sanity-check them before they get promoted to the suite. This unblocks that workflow without requiring --validate-suite.

How it works

When the CLI detects suite_status= in the filter, it pre-parses the value and passes it as status_filter to the backend's GetAllTraceTests endpoint (new field from drift-schemas v0.1.32). This bypasses the ID-based cache path since that only fetches IN_SUITE test IDs. When no suite_status filter is set, behavior is unchanged.

Dependencies

Add a suite_status filter field that allows users to fetch and run
draft tests from the cloud without going through validation mode.

When --filter suite_status=draft is set, the CLI bypasses the cache
and passes the status filter directly to GetAllTraceTests on the
backend. This works for both `drift run` and `drift list`.

Also bumps tusk-drift-schemas to v0.1.32 for the new status_filter
field on GetAllTraceTestsRequest.
@sohil-kshirsagar sohil-kshirsagar requested a review from jy-tan March 25, 2026 05:50
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

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.

2 issues found across 12 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="internal/runner/filter.go">

<violation number="1" location="internal/runner/filter.go:160">
P1: `ParseTraceTestStatusFilter` normalizes to lowercase via `strings.ToLower` for the backend fetch, but the same user-provided value (e.g., `DRAFT`) is kept as-is in the filter string passed to `FilterTests`. Since `SuiteStatus` on the `Test` struct is always lowercase (`"draft"`, `"in_suite"` from `protoTraceTestStatusToString`), and Go regex is case-sensitive, a filter like `suite_status=DRAFT` will correctly fetch draft tests from the server but then filter them all out on the client side, returning zero results.

Either normalize the `suite_status` filter value to lowercase before client-side filtering, or use a case-insensitive regex (e.g., `(?i)` prefix) for the `suite_status` field.</violation>
</file>

<file name="cmd/list.go">

<violation number="1" location="cmd/list.go:99">
P2: `suite_status` regex values silently fall back to the cache path, which only returns IN_SUITE tests, so valid filter forms (for example `suite_status=^draft$`) can miss draft tests.</violation>
</file>

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

Convert if-else chain to switch in loadCloudTests (gocritic lint).

Make suite_status filter case-insensitive so that suite_status=DRAFT
correctly matches the lowercase "draft" value on tests after the
server-side fetch. Without this, uppercase filter values would fetch
the right tests from the backend but then filter them all out
client-side.
@sohil-kshirsagar sohil-kshirsagar merged commit f7a55d8 into main Mar 25, 2026
14 checks passed
@sohil-kshirsagar sohil-kshirsagar deleted the feat/suite-status-filter branch March 25, 2026 18:52
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.

2 participants