carlos / platform Public

CLI e2e tests read the real ~/.carlos/config when their temp dir sits under $HOME open

Found while fixing #285 on 2026-10-14.

The problem. The CLI looks for .carlos/config in every directory above its working directory (pick() / destination resolution). Several CLI e2e tests run the built binary with cmd.Dir = t.TempDir(). When the test's TMPDIR sits under a home that has a real .carlos/config (for example Claude sessions on DOCS-T1, where TMPDIR is under /home/paulca/.cache/tmp), the child picks up the developer's real config and default console, here https://console.carloku.com.

What happened. In one run TestAccountsCreateUsesTheLoggedInIdentity tried the real console and stopped only because the machine wasn't logged in there, so no request was sent. With a real login on that console, a test could act against production.

Fix ideas:

  • Have the e2e helpers (carlosTestEnv / buildCarlos) run children from a temp root outside $HOME, or set an env var that stops the walk upwards (a CARLOS_CONFIG_STOP or similar), set by every e2e helper.
  • Alternatively, add a test that fails if any CLI e2e test's child env leaves the walk able to reach $HOME.

Related: #285 also fixed five tests that inherited CARLOS_DEPLOYMENT_BUCKET from the shell. Unclaimed.