fix(smoke): use regex to avoid false-positive on placeholder in key assertion #25
Reference in New Issue
Block a user
Delete Branch "claude/fix-smoke-key-assertion-20260617"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fixes a spurious smoke-suite failure that was blocking the production deploy gate for all six peptiderepo estates.
Why
The write-only security assertion in
tests/08-pr-vision-admin.spec.tschecked:The PR Vision Settings page password input renders
placeholder="sk-or-…"— an ellipsis format-hint displayed when the key is admin-managed. That placeholder contains the literal stringsk-or-, so the assertion tripped even thoughvalue=""(the key is not in the HTML).Fix
Replaced the naive
toContainwith a regex that matches a structurally valid OpenRouter key token:A real key follows the pattern
sk-or-v1-<20+ alphanumeric chars>. The placeholdersk-or-…(unicode ellipsis, nov1-segment, no token body) never matches the regex. The assertion still catches any real key accidentally rendered server-side.The
value=""assertion is unchanged and independently guards the core write-only invariant.Risk flags
Low. Single assertion line changed. No test logic altered, no skip guards touched. Playwright
--listconfirmed all 38 tests parse cleanly.Test plan
npx playwright test --list— 38 tests, no parse errors (verified locally)