Skip to content

test(mcp-server-supabase): make the generatePassword symbols test deterministic - #501

Merged
barryroodt merged 2 commits into
mainfrom
barryroodt/fix-password-flake
Oct 29, 2026
Merged

barryroodt merged 2 commits into
mainfrom
barryroodt/fix-password-flake

Conversation

@barryroodt

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Test fix (flaky test). Test-only, one file, no package or changelog impact.

What is the current behavior?

should generate a password with symbols in packages/mcp-server-supabase/src/password.test.ts is flaky. It failed the Tests job on #500 and passed on rerun.

The test calls generatePassword({ symbols: true }) and asserts at least one symbol. That draws 10 characters uniformly from letters + symbols, and nothing guarantees a symbol appears. The regex also had /-= inside the character class, which is a range from / to =, so digits counted as symbols and a literal - didn't. Together that makes it fail about 1.4% of runs: (53/81)^10, where 53 is the 52 letters plus -.

What is the new behavior?

The test disables letters, like the existing with numbers test already does, and asserts no character is a letter or digit. It can't fail by chance any more, and it fails on every run if the symbols option adds nothing or adds letters or digits instead of symbols.

I fixed the test and left generatePassword alone. Its only production caller is createProject, which generates a 16-character db_pass from letters and numbers and never enables symbols. The Management API types give db_pass as a plain string with no character-class rule. So the options choose which sets to draw from without promising that each set appears, and changing the generator would change behavior that nothing depends on.

Verification

pnpm --filter @supabase/mcp-server-supabase exec vitest run src/password.test.ts passes, and repeat runs stay green. Mutating generatePassword so the symbols option adds nothing, or adds uppercase letters or digits instead of symbols, fails the test on every run.

@barryroodt
barryroodt requested a review from a team as a code owner October 29, 2026 09:53
@barryroodt barryroodt self-assigned this Oct 29, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 40853173030

Warning

No base build found for commit 5afc540 on main.
Coverage changes can't be calculated without a base build.
If a base build is processing, this comment will update automatically when it completes.

Coverage: 97.62%

Details

  • Patch coverage: No coverable lines changed in this PR.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

Requires a base build to compare against. How to fix this →


Coverage Stats

Coverage Status
Relevant Lines: 5769
Covered Lines: 5662
Line Coverage: 98.15%
Relevant Branches: 1122
Covered Branches: 1065
Branch Coverage: 94.92%
Branches in Coverage %: Yes
Coverage Strength: 169.18 hits per line

💛 - Coveralls

@barryroodt
barryroodt merged commit 663758b into main Oct 29, 2026
5 checks passed
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.

3 participants