Skip to content

fix(ssh): tighten ValidateAppName to DNS-1123 label (closes #110, #119)#124

Merged
crowdy merged 2 commits into
mainfrom
fix/validate-appname-dns1123
Apr 22, 2026
Merged

fix(ssh): tighten ValidateAppName to DNS-1123 label (closes #110, #119)#124
crowdy merged 2 commits into
mainfrom
fix/validate-appname-dns1123

Conversation

@crowdy

@crowdy crowdy commented Apr 22, 2026

Copy link
Copy Markdown
Owner

Summary

Breaking change

  • App names containing uppercase letters or underscores now fail `app init` / `app deploy` / `app logs` / etc. with:

    invalid app name "MyApp": must be a DNS-1123 label (lowercase alphanumerics and hyphens, must start and end with alphanumeric)

  • Rename path: `conoha app destroy ` the old-named app, then `conoha app init` with a new DNS-1123 name.

Test plan

  • `go test ./internal/ssh/...` — added "invalid uppercase" (MyApp), "invalid with underscore", "ends with dash", "valid leading digit", "max length 63" / "too long" boundary tests.
  • `go test ./...` full suite passes.
  • `go build ./...` clean.

t-kim-planitai and others added 2 commits April 22, 2026 17:25
…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>
@crowdy crowdy merged commit d29366d into main Apr 22, 2026
3 checks passed
@crowdy crowdy deleted the fix/validate-appname-dns1123 branch April 22, 2026 09:16
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.

2 participants