Skip to content

feat(tg): write TG_METADATA_DB_USER/PASSWORD into the compose file - #99

Merged
aarthy-dk merged 1 commit into
mainfrom
feat/testgen-metadata-db-creds
Sep 22, 2026
Merged

aarthy-dk merged 1 commit into
mainfrom
feat/testgen-metadata-db-creds

Conversation

@rboni-dk

@rboni-dk rboni-dk commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fresh tg install --docker now writes TG_METADATA_DB_USER/PASSWORD into the generated compose file, as a copy of the bootstrap TESTGEN_USERNAME/PASSWORD account — no new Postgres role is created.
  • tg upgrade backfills these vars into existing compose files, since TestGen's app-side settings are dropping the silent fallback from TG_METADATA_DB_USER/PASSWORD to TESTGEN_USERNAME/PASSWORD (hard cutover, no default).
  • The upgrade backfill validates the bootstrap credentials are actually present/extractable before writing anything (aborts with a clear message otherwise), and only inserts whichever half (user/password) is actually missing, so a partially-migrated or hand-edited file doesn't get corrupted or duplicated.

Release-order dependency

This needs to ship (and reach users) before the TestGen app image that requires TG_METADATA_DB_USER/PASSWORD with no fallback gets published — otherwise existing Docker installs that pull that image via tg upgrade's --policy always lose their metadata-DB credentials entirely. Coordinating with the TestGen app team, who are holding their release until this is confirmed merged.

Test plan

  • ruff check / ruff format --check clean
  • Full pytest suite green (269 passed), including 2 new regression tests for the upgrade-backfill edge cases (partial-key repair, abort on missing bootstrap creds)
  • Manually verified against real Docker/Postgres (not mocks): fresh-install compose passes docker compose config and its TG_METADATA_DB_USER/PASSWORD authenticate via psql; upgrade backfill on a legacy file recovers the account already initialized in an existing Postgres volume; abort path leaves a corrupted file untouched

🤖 Generated with Claude Code

TestGen's app-side settings are dropping the silent fallback from
TG_METADATA_DB_USER/PASSWORD to TESTGEN_USERNAME/PASSWORD (hard cutover,
no default). The installer now writes TG_METADATA_DB_USER/PASSWORD
explicitly on fresh installs, and backfills it into existing compose
files on upgrade, both as copies of the bootstrap TESTGEN_USERNAME/
PASSWORD account (no new Postgres role is created).

The upgrade backfill validates the bootstrap credentials are actually
present before writing anything, and only inserts whichever half
(user/password) is actually missing, to avoid corrupting a hand-edited
or partially-migrated compose file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@aarthy-dk
aarthy-dk merged commit 3687534 into main Sep 22, 2026
4 checks passed
@aarthy-dk
aarthy-dk deleted the feat/testgen-metadata-db-creds branch September 22, 2026 22:01
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