fix(cli): refuse to regenerate POSTGRES_PASSWORD when a data volume already exists - #496
Open
santhiprakash wants to merge 1 commit into
Open
fix(cli): refuse to regenerate POSTGRES_PASSWORD when a data volume already exists#496santhiprakash wants to merge 1 commit into
santhiprakash wants to merge 1 commit into
Conversation
…lready exists Generating a new POSTGRES_PASSWORD while <project>_postgres_data already holds an initialized database leaves the volume on the old password and the API on the new one, causing the API to crash-loop with "password authentication failed for user 'openship'" (28P01). The dry run now reports this unsafe case instead of claiming the secret is preserved, and a real run throws a clear recovery message rather than silently minting a new password. Closes oblien#488
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
openship up --composeno longer silently mints a newPOSTGRES_PASSWORDwhen an existing<project>_postgres_datavolume is present and the current.envis missing the key. The dry-run plan now reports this unsafe case, and a real run throws a clear recovery message instead of overwriting the secret.Motivation
Fixes #488. Re-running
openship upover an existing install could showPOSTGRES_PASSWORD=<preserved>in the dry-run plan while the.envit wrote contained a newly generated value. Postgres only appliesPOSTGRES_PASSWORDatinitdbtime, so the volume kept the old password while the API used the new one, failing withpassword authentication failed for user "openship"(28P01).Related issue
Closes #488
Changes
apps/cli/src/lib/compose.tskeepPostgresPassword: carry the existing.envvalue, generate only on a genuine fresh install, and refuse (real run) or warn (dry run) when an initialized data volume exists butPOSTGRES_PASSWORDis missing.dryRunflag throughrenderEnvso the preview renders a placeholder while the real run enforces the guard.warningstoComposePlanand emit the volume-warning message incomposePlaninstead of claiming the secret is preserved.apps/cli/src/lib/up-plan.ts: print compose plan warnings in the dry-run summary.apps/cli/test/unit/compose-env-preserve.test.ts: add tests for preservation, refusal, and dry-run warning.apps/cli/test/e2e/up-dry-run.test.ts: update thecomposePlanmock to includewarnings.Verification
Note on
bun format: running the rootbun formatscript rewrites pre-existing prettier drift in files I did not change (e.g.apps/cli/src/lib/compose.tshas unrelated long-line formatting drift). I left that untouched and hand-formatted the changed lines to the repo's existing style, matching the approach in #385.Checklist
bun run testandbun run --cwd apps/cli lintpass locally