Skip to content

fix(setup): correct PowerShell secret generation and broaden .env ignore#157

Merged
solomon2773 merged 1 commit into
masterfrom
migrate/setup-script-compat
May 7, 2026
Merged

fix(setup): correct PowerShell secret generation and broaden .env ignore#157
solomon2773 merged 1 commit into
masterfrom
migrate/setup-script-compat

Conversation

@solomon2773
Copy link
Copy Markdown
Owner

Summary

Migrated from #156 by @mrn55. Two salvageable fixes — the third (PowerShell 7 version check) was already added to master separately.

  • setup.ps1 / New-HexSecret — PowerShell variable names are case-insensitive, so the $Bytes parameter and $bytes local collided and broke secret generation on PS7. Rename the local to $secretBytes and the parameter to $ByteCount with a -Bytes alias so existing call sites (New-HexSecret -Bytes 24 at line 914) keep working.
  • .gitignore — broaden .env ignore to cover the .env.backup-YYYYMMDD-HHMMSSZ files that setup.ps1/setup.sh generate, with explicit allowlist for the three tracked templates (.env.example, .env.test, e2e/.env.real.example).

Verified git ls-files | grep '\.env' still surfaces all three tracked templates after the change.

Test plan

  • Run setup.ps1 on PowerShell 7 — confirm secrets generate without the case-collision error
  • Confirm git status does not surface .env.backup-* after a setup run
  • Confirm tracked .env.example, .env.test, e2e/.env.real.example still show in git ls-files

🤖 Generated with Claude Code

Fix New-HexSecret on PowerShell 7 — case-insensitive variable lookup made
the $Bytes parameter and $bytes local collide, breaking secret generation.
Rename the local to $secretBytes (and the parameter to $ByteCount with a
back-compat -Bytes alias) so existing callers like `New-HexSecret -Bytes 24`
keep working.

Broaden the .env ignore rule to cover generated `.env.backup-*` files while
explicitly allowlisting the three tracked templates (`.env.example`,
`.env.test`, `e2e/.env.real.example`).

Migrated from #156 by @mrn55. The PowerShell 7 version check from that PR
was already merged separately.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@solomon2773 solomon2773 merged commit c3cccf4 into master May 7, 2026
17 checks passed
@solomon2773 solomon2773 mentioned this pull request May 7, 2026
2 tasks
@solomon2773 solomon2773 deleted the migrate/setup-script-compat branch May 7, 2026 19:24
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