Skip to content

testserver: match cloud responses for trashed, purged and unknown alerts - #7509

Merged
denik merged 1 commit into
mainfrom
denik/testserver-alerts-not-found
Nov 12, 2026
Merged

denik merged 1 commit into
mainfrom
denik/testserver-alerts-not-found

Conversation

@denik

@denik denik commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Changes

libs/testserver now answers alert get/update/trash the way the cloud does for trashed, purged and unknown alerts:

state get update trash
trashed (not purged) 200, lifecycle_state: DELETED 400 INVALID_PARAMETER_VALUE Cannot move node '<file>' (ID: <id>) because it is in trash folder 400 BAD_REQUEST Alert <id> is already trashed (purge still succeeds)
purged 404 NOT_FOUND Tree node with id <id> does not exist same same
never existed 404 NOT_FOUND Alert with id <id> not found or has no folder node internal name same as get 404 NOT_FOUND Alert with id <id> not found

Before this, get returned 404 with the old Alert with ID '<id>' does not exist. message for both trashed and missing alerts, and update/trash returned a bare 404 with no body. Update and trash of a trashed alert succeeded.

New local test acceptance/cmd/workspace/alerts-v2-not-found records this matrix.

Why

Follow-up to #7492, where the review asked to fix the testserver as well. That PR left the old message in place.

Decisions:

  • The test is local-only. The expected output was recorded on AWS with the same script, with two known differences: on trash-again the cloud's message has a different UUID than the alert id, and on update the cloud's file name has a timestamp suffix (the file is renamed when trashed). Neither is worth modelling.
  • Purged ids are kept in a set so the testserver can tell "purged" from "never existed", which the cloud reports differently.
  • Body validation on create (e.g. the cloud requires a threshold for EQUAL) is out of scope.

Tests

  • go test ./acceptance -run TestAccept/cmd/workspace/alerts-v2-not-found passes locally.
  • Every local acceptance test that mentions alerts passes. The same bundle/migrate/*, bundle/state/* and bundle/user_agent/simple failures show up on a clean main in this environment, so they are unrelated.
  • Cloud (AWS): ran the same script with Cloud = true via testme-aws to capture the responses above.

Dashboard:

Follow-up to error/3324. It does not fix a failing test, because #7492 already made the cloud test pass:

link failure
error/3324 Error: Tree node with id [ALERT_ID] does not exist

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
@denik denik added the ai-auto PRs made by AI loops & factories, label Nov 11, 2026
@github-actions github-actions Bot added the test-only-fix PRs that update failing of flaky tests without changing CLI code. label Nov 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Commit: 3ba8824bc | Workflow run

Regression test report

Selected 1 changed tests (limit=20, 0 not selected)

1 tests: regression=0 unreleased=0 coverage=1 failing=0
test branch main (cec3f63) latest (v1.26.0)
TestAccept/cmd/workspace/alerts-v2-not-found ✅ ✅ ✅

@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 3ba8824

Run: 43092116811

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 270 16 6:37
💚​ aws-windows-latest-4core-16gb 1 272 14 4:01
💚​ azure linux-2core-8gb 1 269 16 6:21
💚​ azure-windows-latest-4core-16gb 1 271 14 4:37
💚​ gcp linux-2core-8gb 1 270 16 7:22
💚​ gcp-windows-latest-4core-16gb 1 272 14 4:05
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 6 slowest tests (at least 2 minutes):
duration env testname
4:18 azure-windows-latest-4core-16gb TestAccept
4:15 gcp linux-2core-8gb TestAccept
3:59 gcp-windows-latest-4core-16gb TestAccept
3:56 aws-windows-latest-4core-16gb TestAccept
3:38 azure linux-2core-8gb TestAccept
3:25 aws linux-2core-8gb TestAccept

@denik
denik marked this pull request as ready for review November 11, 2026 21:05
@denik
denik requested a review from a team as a code owner November 11, 2026 21:05
@denik
denik enabled auto-merge November 11, 2026 21:05
@andrewnester
andrewnester self-requested a review November 12, 2026 08:58

title "trashed alert is still readable"
trace $CLI alerts-v2 trash-alert $alert_id
trace $CLI alerts-v2 get-alert $alert_id | jq -r .lifecycle_state

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The golden shows a bare DELETED; projecting with jq '{lifecycle_state}' like alerts/with_file/script:31 labels the value. Worth matching?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed. #7546 switches it to jq '{lifecycle_state}', the same as alerts/with_file/script, so the golden now shows "lifecycle_state": "DELETED".

AI agent (harness_auto, isaac_claude, opus5.5)

@@ -0,0 +1,27 @@
# Alert get/update/trash responses for trashed, purged and unknown alerts.
# Expected output was recorded against AWS on 2026-11-11; the test is local-only
# because the messages are backend-owned and have changed before.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Against the cloud the output differs in two known places (trash-again UUID, timestamp suffix on the file name); can this comment name them so nobody flips Cloud = true blind?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in #7546. The header comment now lists both differences: trash-again reports a different UUID, and update on a trashed alert names the file myalert-<timestamp>.dbalert.json.

AI agent (harness_auto, isaac_claude, opus5.5)

@denik
denik added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 7ab4e7b Nov 12, 2026
28 checks passed
@denik
denik deleted the denik/testserver-alerts-not-found branch November 12, 2026 10:10
tedjt pushed a commit to tedjt/cli that referenced this pull request Nov 12, 2026
…es (databricks#7546)

## Changes

Follow-up to [databricks#7509](databricks#7509),
addressing review comments that arrived after it merged. Both are in
`acceptance/cmd/workspace/alerts-v2-not-found`:
- The trashed-alert `get-alert` now projects `jq '{lifecycle_state}'`,
matching `alerts/with_file/script`, so the golden labels the value
instead of printing a bare `DELETED`.
- The header comment now names the two known differences on the cloud:
trash-again reports a different UUID than the alert id, and update on a
trashed alert names the file with a timestamp suffix. That way nobody
flips `Cloud = true` without knowing about them.

## Why

Review feedback on [databricks#7509](databricks#7509).

## Tests

`go test ./acceptance -run TestAccept/cmd/workspace/alerts-v2-not-found`
passes locally.

## Dashboard:

Follow-up only. No failing test is fixed here. Related:
[error/3324](http://go/cli/dashboard/error/3324?main=1&pr=1&end=2026-11-11T17:00:00Z&last=2d)
(`Error: Tree node with id [ALERT_ID] does not exist`).

This pull request and its description were written by Isaac.

Co-authored-by: Isaac <no-reply@databricks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-auto PRs made by AI loops & factories, test-only-fix PRs that update failing of flaky tests without changing CLI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants