fix(trigger-coolify-deploy): accept nanoid-style deployment_uuid - #11
Conversation
Coolify's deployments API now returns nanoid-style ids (e.g. j9rlp1cg3qdsuqi8sqsvykpo) instead of canonical UUIDs for deployment_uuid. The format-validation regex in cancel_phantom_builds() only accepted UUIDs, so it warned and skipped every phantom build, leaving the still-running native build uncancelled and occupying the VPS's single build slot — the exact failure mode PR #144's fix was meant to prevent (confirmed in the-music-deck-admin PR #208 logs, both preview deploys timed out at 1800s). Widen the regex to accept both formats, bounded to 20-30 alphanumeric chars to preserve the shape check before the value is interpolated into a Coolify API URL and an SSH docker stop command. Add a standalone regression test for the regex plus a CI workflow to run it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
There was a problem hiding this comment.
🟡 Changes recommended
The current grep-based validation can be line-bypassed via newlines; switching to a bash-regex whole-string match (and aligning the test) is needed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the trigger-coolify-deploy composite action to correctly handle Coolify’s newer nanoid-style deployment_uuid values so phantom native builds can be detected and cancelled again, and adds a small CI-backed regression test to prevent reintroducing the UUID-only assumption.
Changes:
- Broadened the
deployment_uuid/phantom_uuidformat validation to accept both legacy UUIDs and bounded nanoid-style IDs. - Added a standalone shell regression test script covering accept/reject cases for the ID format.
- Introduced a new GitHub Actions workflow to run the shell test on PRs and pushes.
File summaries
| File | Description |
|---|---|
| .github/workflows/test-actions.yml | Adds a CI job to run the new shell regression test. |
| .github/actions/trigger-coolify-deploy/tests/deployment_uuid_format.sh | Adds a regression test suite for the deployment UUID shape validation. |
| .github/actions/trigger-coolify-deploy/action.yml | Expands the ID validation regex used before interpolating into URL/SSH commands. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
grep -qiE matches per-line, so a newline embedded in phantom_uuid could let a later line slip past the ^...$ anchors even though the value is interpolated into a Coolify API URL and an SSH docker stop command. Switch to bash's [[ =~ ]] so the anchors apply to the whole string. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Use bash's [[ =~ ]] instead of grep -qiE to match the fix in action.yml, and declare `actual` local so the test function stays self-contained under set -u. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
There was a problem hiding this comment.
🟡 Changes recommended
The new CI workflow may fail depending on the test script’s executable bit, and the updated logging/comment text in cancel_phantom_builds() is inconsistent with the actual variable being validated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
Running it as a bare file path depends on the executable bit surviving checkout; invoking via bash is robust regardless of file mode. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
…uid, in comment/log The comment and warning message named deployment_uuid, but the variable actually being validated and logged is phantom_uuid — fix the naming to avoid confusion when debugging cancellations. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, uses a stricter whole-string bash regex check, and includes CI-backed regression coverage for the updated ID validation behavior.
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0 new
- Review effort level: Lite
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv
Summary
/api/v1/deployments/applications/{uuid}endpoint now returns nanoid-styledeployment_uuidvalues (e.g.j9rlp1cg3qdsuqi8sqsvykpo) instead of canonical UUIDs.cancel_phantom_builds()only matched UUIDs, so it warned and skipped every phantom native build detected — meaning the build was never actually cancelled/stopped.the-music-deck-adminPR #208: both preview deploys loggedWARNING: unexpected deployment_uuid format ... skipping, then sat queued/in_progress until timing out at 1800s because the uncancelled native build occupied the VPS's single build slot. This is the exact regression PR #144's fix was meant to prevent.[0-9a-z]{20,30}nanoid-style id, preserving the shape check since this value is interpolated into a Coolify API URL and anssh ... docker stopcommand.deployment_uuid/phantom_uuid— none found.tests/deployment_uuid_format.sh) covering UUID, nanoid, and rejected garbage/length-boundary cases, wired into a newtest-actions.ymlCI workflow.Follow-up
v4.3.0) since consumers pinuses:to tags — a fix onmainalone won't reach them until they bump.Test plan
tests/deployment_uuid_format.shlocally — all 9 cases passtest-actions.yml) passes on this PR🤖 Generated with Claude Code
https://claude.ai/code/session_01LzDQzX3Uqv3qChoZyXx5hv