Skip to content

chore: add read-only diagnostic to list stale acceptance-test projects - #725

Draft
dbtagarovat wants to merge 6 commits into
mainfrom
chore/list-stale-test-account-projects
Draft

chore: add read-only diagnostic to list stale acceptance-test projects#725
dbtagarovat wants to merge 6 commits into
mainfrom
chore/list-stale-test-account-projects

Conversation

@dbtagarovat

Copy link
Copy Markdown

Summary

While investigating CI acceptance-test flakiness (see #723), found the live test account's /projects/ list paginating past offset=690 during a normal test run — the account has accumulated a large number of orphaned projects from acceptance-test runs whose destroy step failed (a transient API timeout leaves the project dangling). That bloat looks like a real contributor to the timeout-driven failures on project/credential-resource tests (Athena, BigQuery, Project resource/data source, Salesforce credential), on top of the causes already fixed in #723.

This adds a read-only, workflow_dispatch-only diagnostic:

  • tools/list-stale-projects: a small Go program (reuses the existing GetAllProjects client method) that lists every project in the account with its age, bucketed, plus a candidate list of anything older than -min-age (default 1h — a real CI run creates and destroys a project within ~20 minutes).
  • .github/workflows/list-stale-test-projects.yml: manual-trigger-only workflow using the existing TEST_DBT_CLOUD_* secrets to run it.

No delete call exists anywhere in this change. GET requests only. The intent is to produce a candidate list to review (and get sign-off on) before any actual cleanup, not to perform cleanup automatically.

Test plan

  • go build ./tools/...
  • After merge: trigger the workflow, review the candidate list output in the job summary, share with the team for approval before any manual deletion

The live acceptance-test account has accumulated a large number of
orphaned projects from acceptance-test runs whose destroy step failed
(a transient API timeout leaves the project dangling). That bloat is
itself now making list/create/read calls against /projects/ slow
enough to trip client timeouts, which is a likely contributor to the
project/credential-resource acceptance test failures seen in CI.

Adds a workflow_dispatch-only GitHub Actions job and a small Go tool
that lists projects in the account with their age. GET requests only,
no delete call exists anywhere in this change. Intended to produce a
candidate list for review/approval before any manual cleanup.
@dbtagarovat
dbtagarovat requested a review from a team as a code owner August 4, 2026 17:06
@dbtagarovat
dbtagarovat marked this pull request as draft August 4, 2026 17:11
…flow_dispatch

workflow_dispatch can't be invoked until this file exists on the default
branch, but this is meant to run from this throwaway diagnostic PR without
merging. pull_request runs the workflow as it exists on the PR branch
itself, and secrets are still available since this branch is pushed
directly to the repo rather than from a fork.
TEST_DBT_CLOUD_HOST_URL isn't actually configured as a secret anywhere in
this repo (checked repo secrets and the cloud-tests environment) - the
existing acceptance-test workflows have been passing an empty value and
relying on acctest_helper.SharedClient()'s fallback default all along.
Match that behavior here instead of hard-requiring the env var.
All 695 projects failed to parse created_at with the previous layouts
(likely a fractional-seconds-with-Z format like RFC3339Nano needs).
Try a broader set of layouts and surface a sample raw value on failure
instead of silently reporting everything as unparsed.

Also set pipefail in the workflow step - `cmd | tee file` was reporting
the exit status of tee, not the underlying tool, so a real failure
would have shown as a green run.
Someone reviewing the candidate list asked which account/environment
this actually is. Print the account name, plan, and state (from the
same /v2/accounts/ auth-check endpoint NewClient already uses) so the
report is self-explanatory instead of just an opaque account ID.
Someone asked whether this is effectively a specific person's individual
account rather than a dedicated CI account. Print the actual user list
(same /v3/accounts/{id}/users/ endpoint the provider's user data source
uses) so that can be answered with data instead of assumption.
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