fix(ssh): tighten ValidateAppName to DNS-1123 label (closes #110, #119)#124
Merged
Conversation
…110) App names flow through multiple layers that normalize or constrain them differently: docker compose project names (lowercase), proxy service names (DNS-label), and on-disk work dirs at /opt/conoha/<name>. The previous loose regex ([a-zA-Z0-9][a-zA-Z0-9_-]*) allowed underscores and uppercase, which caused silent divergence: /opt/conoha/MyApp vs compose project 'myapp', and a name like 'nextjs-go-google_ucp' sanitized to 'nextjs-go-google-ucp' inside conoha.yml but used raw in destroy — the two addressed different dirs (see closed #119). Mirror internal/config.dnsLabelRe exactly: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$ with max length 63. Existing users whose app names use uppercase or underscore must rename (niche enough to accept the break). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ardown paths
The DNS-1123 tightening in the previous commit made connectToApp reject
legacy v0.1.x-era app names that contain uppercase or underscores. That
closes the conoha.yml-vs-CLI mismatch for new deploys, but also traps
users with existing deployments: logs/stop/restart/status/rollback AND
destroy all flow through connectToApp, so the strict validator blocks
the cleanup path.
Split the validation:
- ValidateAppName (strict DNS-1123) — init, deploy — the write paths.
- ValidateAppNameExisting (loose, legacy-tolerant) — connectToApp — the
read/ops/teardown paths.
New deployments are still gated on the strict rule. Existing legacy-named
apps can be inspected and destroyed without manual SSH cleanup. After
destroy, a new init is forced through the strict path, so the migration
converges naturally on DNS-1123 over time.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Breaking change
Test plan