Repository navigation
test(fixtures): accept elapsed_ms in the packed platform consumer check - #500
Conversation
Coverage Report for CI Build 40859234270Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.002%) to 97.62%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions3 previously-covered lines in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
…erministic (#501) ## 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.
Rodriguespn
left a comment
There was a problem hiding this comment.
LGTM, thanks @barryroodt. I was able to reproduced it locally.
A small nit: none of our workflows run test:packed-platform-consumer, which is how #483 got past us. Could we add it as a step in tests.yml after Build libs? Then a change to the public surface would fail the PR that causes it, instead of leaving the privacy assertions skipped on main until someone happens to run the script. Wdyt?
Good call, fixed. |
## What kind of change does this PR introduce? CI fix. Two small follow-ups from reviewing the `Packed platform consumer check` step added in #500. - The step sets `env: ANTHROPIC_API_KEY: ''`, so the step and its child processes see an empty key. Prevents possible leak to an env which does not use the key. - The fixture pins `@modelcontextprotocol/node` to the same SDK version constant. This removes the `ERESOLVE`, and the fixture now tests the SDK set the package is built against.
What kind of change does this PR introduce?
Bug fix, test fixture only.
What is the current behavior?
pnpm test:packed-platform-consumerhas been failing on main since #483. That PR addedelapsed_msto theinput_responseobservation fact, and the fixture's exact-shapedeepEqualon the destructive-SQL resume facts doesn't expect the key, so it throws there. Everything after that line gets skipped for the packaged artifact, including the privacy checks (noPRIVATE_value and no destructive-SQLrequestStatetoken in the recorded observation scopes). CI doesn't run this check, which is why nothing flagged it.What is the new behavior?
scripts/fixtures/packed-platform-consumer/modern-call.mjsacceptselapsed_mson that fact the same way it already acceptsdurationMson thereturnedoperation fact. The shape check stays exact and the value has to be a finite number >= 0, so a missingelapsed_msor any other extra key still fails.Verification
The script builds both packages itself. With this change it prints
[PASS] modern-mcp-calland exits 0. On main it fails at the resume-factsdeepStrictEqual, with a diff showing the extraelapsed_mskey.