cast/test
dan-claude-bot 5a1ec74e04 fix: persist the manifest conversion before the install poll can lose it
All three reviewers, independently: `createGithubApp` held the one-shot
conversion payload in memory across `awaitInstallationId` — a ~5 minute
poll — and `persistCredentials` ran only inside `registerGithubApp`. A
timeout, a dropped network or a Ctrl-C during that wait destroyed a
private key and client secret GitHub never re-shows, and left the App
orphaned on GitHub. The timeout message then claimed the credentials
were "already there" under `<state>/github-apps/`, which was false on
exactly the path that printed it.

The payload now goes to disk the instant the exchange returns, complete
but for the installation id — the one field GitHub will answer again as
often as it is asked. It is written as `installation_id: null` and
backfilled on success; `writeCredentialsRecord` allows precisely that
one transition and refuses every other difference, so nothing
irreplaceable is ever overwritten silently. The timeout path now names
the two files it wrote and prints the `register` command that finishes
the job, and says not to re-run `create`.

claude-bot's addition: persisting post-conversion could still throw in
`writeExclusive` against a stale `<name>.pem`, losing the fresh key just
the same — and that refusal's remedy ("pass --force and re-run") would
mean minting a second App. So the collision is pre-flighted before the
browser flow starts, when nothing exists and nothing can be lost. The
post-conversion persist now only ever meets a clean slot or an exact
match, and `writeExclusive`'s wording stays honest for `register`.

grok #2: re-running `register` to re-check a failed repo-visibility
assertion used to re-POST the key and the App first. Coolify does not
de-dupe by name — `GithubController@create` validates
`'name' => 'required|string|max:255'` with no `unique` rule and calls a
plain `GithubApp::create()`, and the vendored OpenAPI documents no
conflict response — so following that advice created a second Source
every time. Both verbs now read `GET /github-apps` first and verify an
existing record of that name instead of creating another; a name held by
a different App, or already duplicated, is a hard error. An unreadable
list warns and proceeds rather than blocking a bootstrap command.

grok #3: `name` becomes `<name>.pem`/`<name>.json`, so separators, dot
references, empties and control characters are rejected where the name
is resolved and again where it becomes a filename.

grok #4: every GitHub request now sends `User-Agent: cast/<version>`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-21 13:11:15 +00:00
..
fixtures feat(service): set and diff per-container service hostnames via urls (#72) 2026-07-16 15:14:29 +00:00
apply.test.ts style: biome formatting for the basic-auth completion tests 2026-07-21 12:56:00 +00:00
backup-cli.test.ts feat: diff and apply a database's backup schedule (#51) 2026-07-14 23:07:54 +00:00
basic-auth-cli.test.ts feat: an application can declare HTTP basic auth, and apply sets it 2026-07-21 12:38:03 +00:00
bindings.test.ts fix: smoke resolves its target inside the project it was declared under (#29) 2026-07-13 20:08:35 +00:00
capture-cli.test.ts feat(capture): --generated-only, the bootstrap's missing pass 2 2026-07-14 22:32:07 +00:00
capture.test.ts Merge pull request #58 from claude-hdb/feat/capture-generated-only 2026-07-14 23:49:49 +01:00
cli.test.ts fix: smoke resolves its target inside the project it was declared under (#29) 2026-07-13 20:08:35 +00:00
config.test.ts feat: select the Coolify instance by name instead of editing .coolify.env (#14) 2026-07-13 16:42:45 +00:00
coolify.test.ts fix(draft): read backup schedules and emit backup blocks (#75) 2026-07-16 18:25:34 +00:00
destroy.test.ts feat(destroy): a scoped teardown verb, gated in state (#43) 2026-07-14 22:52:17 +00:00
diff.test.ts feat: an application can declare HTTP basic auth, and apply sets it 2026-07-21 12:38:03 +00:00
domain-preflight.test.ts feat(service): set and diff per-container service hostnames via urls (#72) 2026-07-16 15:14:29 +00:00
draft-cli.test.ts feat(draft): capture service hostnames via per-service GET (#83) 2026-07-16 18:30:49 +00:00
draft.test.ts Merge pull request #95 from dan-claude-bot/feat/draft-service-domains 2026-07-18 21:25:37 +01:00
envtemplate.test.ts feat(resolve): derive base-URL env vars from manifest domains via ${domain:...} (#66) 2026-07-15 12:02:33 +00:00
fleet-cli.test.ts fix: a manifest with no ${…} refs applies without a store (#104) 2026-07-19 13:06:34 +00:00
fleet.test.ts feat: --all — every project in an environment, and a report that says so (#26) 2026-07-13 20:23:23 +00:00
github-app-cli.test.ts fix: resolve the GitHub App only when the manifest declares applications (#103) 2026-07-19 12:26:35 +00:00
github-app-register-cli.test.ts fix: persist the manifest conversion before the install poll can lose it 2026-07-21 13:11:15 +00:00
github-app.test.ts fix: persist the manifest conversion before the install poll can lose it 2026-07-21 13:11:15 +00:00
greenfield-cli.test.ts fix: a manifest with no ${…} refs applies without a store (#104) 2026-07-19 13:06:34 +00:00
install-sh.test.ts feat: release flow — tagged releases with a prebuilt dist asset (#96) 2026-07-18 22:27:55 +00:00
inventory.test.ts feat: read-side coordinates (#17, #18) + cast inventory (#19) 2026-07-13 18:20:53 +00:00
labels-reconcile.sh fix(labels): a missing state label skips the edit, not the whole PR 2026-07-20 18:09:16 +00:00
layout-cli.test.ts refactor: rescope to versioned installations — the release flow moves out 2026-07-18 21:17:59 +00:00
live-lookup.test.ts feat(draft): capture service hostnames via per-service GET (#83) 2026-07-16 18:30:49 +00:00
manifest.test.ts feat: an application can declare HTTP basic auth, and apply sets it 2026-07-21 12:38:03 +00:00
placement-cli.test.ts fix: the first apply against a fresh multi-destination box (#40, #41) 2026-07-14 17:25:29 +00:00
read-side-cli.test.ts feat: --resource, the third name a hand-built box does not share with you 2026-07-13 18:50:06 +00:00
release.test.ts style: apply biome formatting to the step-block extractor 2026-07-20 21:04:17 +00:00
reserved.test.ts fix(diff): Coolify's own generated vars are not orphans (#87) 2026-07-16 16:56:34 +00:00
resolve.test.ts feat(service): set and diff per-container service hostnames via urls (#72) 2026-07-16 15:14:29 +00:00
secrets.test.ts fix: CAST_AGE_KEY_FILE_<ENV> maps to a name a shell can set (#102) 2026-07-19 13:09:17 +00:00
smoke-cli.test.ts fix: smoke resolves its target inside the project it was declared under (#29) 2026-07-13 20:08:35 +00:00
smoke.test.ts feat: cast — the Coolify executor, extracted from the infra state repo 2026-07-11 12:25:44 +00:00
sweep-cli.test.ts feat: inventory sweeps the instance — a discovery verb that needed you to have discovered 2026-07-13 19:07:17 +00:00
team.test.ts feat: assert the token's team before touching Coolify (fail-closed) 2026-07-12 20:55:04 +00:00
version-cli.test.ts refactor: rescope to versioned installations — the release flow moves out 2026-07-18 21:17:59 +00:00
wire.test.ts fix: complete the basic-auth triple on username-only drift, at both guards 2026-07-21 12:43:04 +00:00