Skip to content

fix(dx): harden cicd-diagnostics scripts with preflight checks and error handling#34866

Open
spbolton wants to merge 1 commit intomainfrom
issue-34865-harden-cicd-diagnostics
Open

fix(dx): harden cicd-diagnostics scripts with preflight checks and error handling#34866
spbolton wants to merge 1 commit intomainfrom
issue-34865-harden-cicd-diagnostics

Conversation

@spbolton
Copy link
Contributor

@spbolton spbolton commented Mar 4, 2026

Summary

Closes #34865

  • Add DiagnosticError exception class replacing cryptic subprocess failures with actionable error messages
  • Add preflight_check() function validating Python 3.8+, gh CLI installed, gh authenticated, and can reach dotCMS/core
  • Add _run_gh() wrapper centralizing gh CLI execution with error classification (401→auth, 403→rate limit, 404→not found)
  • Convert all 14 API functions from raw subprocess.run(..., check=True) to _run_gh()
  • Fix dead-code bug: if not workspace:if not workspace.exists(): (Path objects are always truthy)

Test plan

  • preflight_check() returns "All checks passed" when prerequisites met
  • init-diagnostic.py shows proper usage error for missing args
  • fetch-metadata.py / fetch-jobs.py reject nonexistent workspace directories
  • _run_gh() with invalid run ID returns proper DiagnosticError with 404 details
  • Full end-to-end test with real run ID succeeds

🤖 Generated with Claude Code

…ror handling (#34865)

Add DiagnosticError, preflight_check(), and _run_gh() wrapper to replace
raw subprocess calls with actionable error messages. Fix dead-code bug
where Path objects were checked with truthiness instead of .exists().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@spbolton spbolton added the Area : CI/CD PR changes GitHub Actions/workflows label Mar 4, 2026
@github-actions github-actions bot removed the Area : CI/CD PR changes GitHub Actions/workflows label Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Harden cicd-diagnostics skill scripts with preflight checks and error handling

1 participant