Repository navigation
Closed
Labels
Description
Part of #4839 (split from it in task TALE-176).
Problem
#4839 defect 1. Paths are under tools/cli/src/.
| # | Defect | Code | What the operator sees |
|---|---|---|---|
| 1 | A project whose folder name starts with a digit can't be deployed or rolled back. tale init derives the project ID from the folder name and allows a leading digit. tale deploy and tale rollback check the same ID against a rule that requires a letter first |
lib/project/generate-project-id.ts:7 const VALID_ID_PATTERN = /^[a-z0-9][a-z0-9-]*$/;. sanitizePrefix (:16-24) keeps a leading digit, and generateProjectId (:31-45) builds <prefix>-<6 hex> from it (:36). It is called at lib/actions/init.ts:254 and, for a legacy tale.json without an ID, at lib/project/project-context.ts:81 on tale dev and tale deploy. The deploy rule is lib/deployment/tag-automation-protocol.ts:58-61: requireRuntime(/^[a-z][a-z0-9-]{0,62}$/.test(project), 'Invalid deployment project.') in tagDeploymentProtocol. That runs at lib/actions/deploy.ts:233-236 and :367, and at lib/actions/rollback.ts:171 and :280. requireRuntime throws preconditionError(message) with no next step (lib/deployment/runtime-model.ts:182) |
For ~/2024-site, tale dev works, but every deploy, the first included, stops with "Invalid deployment project." and exit code 3. tale rollback stops the same way. The message names neither the rule nor the fix |
Notes, all at 29e9445:
- The refusal comes late.
lib/actions/run-deploy.tshas already runensureDocker(:68),ensureEnv(:73),ensureProductionDomain(:95), the preflight (:101) and the cutover check (:116). Atdeploy.ts:233the check runs inside the deploy lock (withLock,:226). - Relaxing only
tag-automation-protocol.ts:59is not enough. Once the project has a database (:67-68),bundledBackendIdentitychecks the project and its-blue/-greennames (:69-70,:81-82) against a second rule:lib/deployment/automation-protocol.ts:171projects.every((project) => /^[a-z][a-z0-9-]{0,68}$/.test(project)),, refusing with "Invalid backend custody projects." (:172). The same check runs fromlib/deployment/tag-automation-cutover.ts:105. - Found while verifying, not in bug(cli): digit-led project names can never deploy, --host rewrites .env even on --dry-run, and the Windows installer closes the session on error #4839: managed deployments have the same split.
lib/deployment/model.ts:60const project = z.string().regex(/^[a-z0-9][a-z0-9-]{0,39}(?![\s\S])/);allows a leading digit forcomposeProject(:132), andlib/deployment/runtime-apply.ts:279accepts it. Once the project has state (:1071),checkInstalledProtocolpasses it tobundledBackendIdentity(:1077-1080,:1092), which refuses it. generate-project-id.tshas no test file.
Expected
- Generate IDs that satisfy the deploy rule (prefix a letter when the folder starts with a digit), or accept the init pattern at deploy. Either way, the refusal names the rule and the fix.
- Note for the implementer, not a decision: an existing digit-led project already has
tale devcontainers and volumes under its ID, so renaming IDs would orphan them.lib/actions/init.ts:243-244keeps an existing ID on reinit for that reason: "preserve the existing project id and createdAt so Docker volumes/containers keyed on the id remain valid."
Regression: a deploy-path unit test with project ID 2024-site-abc123. Extend lib/deployment/automation-protocol.test.ts, which already calls tagDeploymentProtocol('tale', false, noState) at :188, with a fresh case and a case with an existing database, so that the second rule at automation-protocol.ts:171 runs too. lib/actions/rollback.test.ts drives deploy() and rollback() with setProjectId('tale') (:25) and can take the same ID. At 29e9445 both cases throw "Invalid deployment project." at tag-automation-protocol.ts:59.
Severity and owner
- Severity: medium, from bug(cli): digit-led project names can never deploy, --host rewrites .env even on --dry-run, and the Windows installer closes the session on error #4839: "(1) blocks deployment outright for affected projects".
- Owner: CLI (project IDs, deploy and rollback).
- Evidence: static reading at
train29e9445, same atfeature-train12625af; nothing was run. The cited paths are unchanged attrain1ae4a95 andfeature-train2334ceb. - Related: none named in bug(cli): digit-led project names can never deploy, --host rewrites .env even on --dry-run, and the Windows installer closes the session on error #4839 for this defect.
Activity
fix(cli): refuse an invalid project ID once, as a precondition
fix(cli): accept digit-led project IDs at deploy and rollback
fix(cli): refuse an invalid project ID once, as a precondition
fix(cli): accept digit-led project IDs at deploy and rollback