QUA-1765: Update CLI according to the latest changes#48
Conversation
- Rename --inference-threshold flag to --ai-effort (keep old as deprecated alias) - Change ai_effort type from int to str to accept labeled scale (off, low, medium, high, xhigh, max) - Add _normalize_ai_effort() to convert legacy numeric strings (0-5) for backward compat - Update docs and help text to use "AI managed checks" terminology - Add tests for normalization and legacy numeric input handling
Greptile SummaryThis PR aligns the CLI vocabulary with the UI's AI-driven profiling refresh and rounds out several API additions:
Confidence Score: 4/5Safe to merge after fixing the scan payload to omit The scan service unconditionally includes
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["CLI: --ai-effort / --inference-threshold"] --> B{Flag used?}
B -->|"--inference-threshold N"| C[Emit deprecation warning\nassign to ai_effort]
B -->|"--ai-effort LABEL"| D[Lowercase + validate\nagainst _VALID_AI_EFFORT]
C --> D
D --> E["run_profile(ai_effort=...)"]
E --> F["_normalize_ai_effort()\n'3' → 'high', labels pass through"]
F --> G[POST /operations\nai_effort: 'high']
H["CLI: --auto-resolve-passed-anomalies\n/ --no-... / omit"] --> I{Value?}
I -->|True| J["payload['auto_resolve_passed_anomalies'] = True"]
I -->|False| K["payload['auto_resolve_passed_anomalies'] = False"]
I -->|"None (omit)"| L["BUG: key still sent as null\nshould be omitted"]
J --> M[POST /operations]
K --> M
L --> M
N["CLI: --authentication-type IAM_ROLE\n--role-arn ARN"] --> O{role_arn present?}
O -->|No| P[ValueError → Exit 1]
O -->|Yes| Q["Nest under payload.parameters\n{authentication_type, role_arn, external_id}"]
Q --> R[POST /datastores or PATCH /datastores/id]
Reviews (3): Last reviewed commit: "Conver latest release + docs" | Re-trigger Greptile |
|
@greptile review |
|
@greptile review |
Linear
Ref QUA-1765
Ref QUA-1735
Ref QUA-1652
Ref QUA-1646
Ref QUA-1408
Overview
Aligns the CLI with the UI vocabulary refresh around AI-driven profiling and rounds out CLI coverage for several other recent controlplane API additions. Everything is additive — no breaking changes, no removed flags. Existing scripts continue to work.
Key Changes
Profile operations: AI effort levels
New
--ai-effortflag onqualytics operations profile, accepting labeled values (off,low,medium,high,xhigh,max) instead of an opaque 0–5 integer:--inference-thresholdkept as a deprecated alias (hidden=True, so it no longer clutters--helpoutput). Existing CI/CD pipelines keep working — they just emit a one-line deprecation warning:qualytics operations profile --datastore-id 1 --inference-threshold 3 # ⚠ --inference-threshold is deprecated; use --ai-effort instead.Client-side numeric normalization via
_normalize_ai_effort()maps legacy integers (0–5) to their label equivalents (off,low,medium,high,xhigh,max) before the request leaves the CLI. The wire format is always the new labeled value, so the CLI keeps working even if the server eventually drops its own backfill alias.Case-insensitive validation —
--ai-effort HIGH,--ai-effort high, and--ai-effort Highbehave identically. Invalid values fail fast with a clear error.Terminology refresh — help text and docs updated from "inferred checks" to "AI managed checks" to match the UI.
0off1low2medium3high4xhigh5maxScan operations: auto-resolve passed anomalies
When a scan completes, open anomalies whose fingerprints no longer fail can now be auto-resolved.
Tri-state: when omitted, the server default (currently on) takes effect. Auto-resolution is silently skipped for incremental scans server-side regardless of the flag.
Connections: IAM Role authentication for S3, Athena, and Redshift
Authenticate AWS-backed datastores with an IAM Role instead of static access keys.
Default authentication is
SHARED_KEYfor S3,BASICfor Athena/Redshift — no change for existing users. The CLI fails fast with a clear error if--authentication-type IAM_ROLEis used without--role-arn, so you don't wait on a server round-trip to find out.Quality checks: ownership and default assignees
Each quality check can now have an owner and a default anomaly assignee.
User IDs come from
qualytics users list. Ownership is environment-specific and intentionally not carried inchecks exportYAML — apply it at import time per environment.Anomalies: assignees on update
Set or clear assignees on individual or batches of anomalies.
Anomalies: filter by source-record enrichment
Tri-state — omit the flag for no filter.
Configurable request timeout
The CLI's request timeout was hard-coded at 30 seconds, which wasn't enough for some long-running list endpoints on slow networks.
qualytics auth statusnow displays the resolved timeout so you can confirm what's in effect:Cleaner network-error messages
Network errors no longer dump a stack trace. You now get a one-line message:
Covers timeouts, connection failures, and SSL handshake errors.