Skip to content

Add ClickStack cloud commands (closes #118)#144

Draft
sdairs wants to merge 4 commits into
mainfrom
issue-118-clickstack-cloud-commands
Draft

Add ClickStack cloud commands (closes #118)#144
sdairs wants to merge 4 commits into
mainfrom
issue-118-clickstack-cloud-commands

Conversation

@sdairs
Copy link
Copy Markdown
Collaborator

@sdairs sdairs commented May 12, 2026

Summary

  • Adds cloud clickstack {dashboard|alert|source|webhook} covering all 12 ClickStack endpoints.
  • Dashboard create/update take --from-file <path> JSON (also accepts - for stdin) with optional --name / --tag overrides — tile layout is too nested for flags.
  • Alert create/update are flag-based; --channel-type selects email (requires --email) or webhook (requires --webhook-id).
  • New live-API integration test cloud_clickstack_crud_lifecycle (gated by #[ignore]) provisions a service, runs full dashboard + alert CRUD, lists sources/webhooks, and tears down via the existing CleanupRegistry. Wired into .github/workflows/cloud-integration.yml.
  • 7 new model round-trip tests cover the trickier untagged enums (ClickStackAlertChannel email/webhook variants, dashboard create with markdown tile, ClickStackSource/ClickStackWebhook variant dispatch).
  • 14 new CLI handler tests cover alert builder logic (channel type branching, source validation, interval/severity parsing) and the dashboard JSON loader.

Notes for reviewers

  • Library was already complete. All 12 endpoints + 51 ClickStack models were already in clickhouse-cloud-api from a prior spec refresh; this PR is CLI + tests only. spec_coverage_test confirms no drift.
  • Spec is intentionally not refreshed in this PR. The live spec has 9 unrelated new endpoints (org roles, ClickHouse settings) that would balloon scope; the daily drift workflow will surface those separately.
  • Test the API before merging the CLI: the new integration test runs ahead of CLI sign-off so a library defect (e.g. mis-tagged channel enum, optionality drift) blocks merging the CLI work. Confirm cargo test -p clickhouse-cloud-api --test integration_clickstack_test -- --ignored --nocapture passes in CI before approving.
  • One open verification. Phase 2.3 calls out that ClickStack availability per region/tier is unconfirmed. If the live integration step 404s on first call against a freshly provisioned service, we'll either need to gate behind an env var or run against a long-lived service — see the comment in integration_clickstack_test.rs.

Test plan

  • cargo build --workspace — green locally
  • cargo test --workspace — 261 CLI tests + 93 model tests + spec_coverage all green locally
  • cargo clippy -p clickhousectl -- -D warnings and -p clickhouse-cloud-api -- -D warnings — both green locally (matches CI)
  • Live integration: cargo test -p clickhouse-cloud-api --test integration_clickstack_test -- --ignored --nocapture runs in CI on this PR via the existing cloud-integration.yml workflow (paths-trigger covers crates/clickhouse-cloud-api/tests/**)
  • Manual smoke once a test service is available: cloud clickstack source list <svc-id>, dashboard create/list/delete with a fixture JSON, alert create with both email and webhook channels

🤖 Generated with Claude Code

@sdairs sdairs requested a review from iskakaushik as a code owner May 12, 2026 11:28
@sdairs sdairs had a problem deploying to cloud-integration May 12, 2026 11:28 — with GitHub Actions Failure
sdairs and others added 2 commits May 12, 2026 14:51
Wires up `cloud clickstack {dashboard|alert|source|webhook}` with full CRUD on
top of the existing typed library client, which already covered all 12
endpoints. Dashboard create/update take --from-file JSON (tile layout is too
nested for flags); alert create/update are flag-based with --channel-type
selecting email or webhook. Adds untagged-enum round-trip tests for the
trickier model shapes and a live-API integration test that provisions a
service and exercises CRUD before tearing down.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Spec drift commit b3e6b64 (merged to main after this branch forked) added a
required `threshold_max: Option<f64>` field to both ClickStackCreateAlertRequest
and ClickStackUpdateAlertRequest. The full field-init (no ..Default::default())
in clickstack.rs broke after rebase. Expose as --threshold-max so the surface
stays complete.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sdairs sdairs force-pushed the issue-118-clickstack-cloud-commands branch from 2772123 to ca2c830 Compare May 12, 2026 14:12
@sdairs sdairs had a problem deploying to cloud-integration May 12, 2026 14:12 — with GitHub Actions Failure
sdairs and others added 2 commits May 12, 2026 15:16
Clippy 1.95 (CI default) flags the nested if-in-match pattern as
collapsible_match. Local clippy 1.93 was too lenient to catch it.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7.5.0 used Linux-only \`__errno_location\` and broke \`cargo build\` on Darwin
(local dev + CI Install Test on macos-14/15). 7.5.2 fixes the libc call.
Constraint tightened to "7.5.2" so cargo can't pick the broken release again.

Closes #145.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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