Skip to content

fix(test,api-keys): Unit Tests job runs jest; near-unique API key prefixes (D-0100, D-0527) - #133

Merged
acamarata merged 2 commits into
mainfrom
debt/d0100-d0527-jest-apikeys
Oct 11, 2026
Merged

acamarata merged 2 commits into
mainfrom
debt/d0100-d0527-jest-apikeys

Conversation

@acamarata

Copy link
Copy Markdown
Collaborator

D-0100

The Test workflow's Unit Tests job ran pnpm test -- --coverage --ci --passWithNoTests. pnpm forwards the literal --, so jest got jest -- --coverage ..., read the flags as path patterns, matched nothing and printed No tests found, exiting with code 0 (main run 38156402775). It now runs pnpm run test:ci, the same command ci.yml and coverage.yml use (58 suites, 989 tests on main).

jest also ignores <rootDir>/.claude/: a run in the main checkout picked up every ticket worktree's copy of the suite (171 files instead of 56).

Not changed here (outside this change's file scope, filed as debt): release.yml has the same pnpm test -- ... line, and jest.config keeps passWithNoTests: true until release.yml is fixed, since flipping it alone would fail every release run.

D-0527

API keys used nself_ + 2 random letters (676 values) as the lookup prefix and validateApiKey checked only the first record with that prefix, so a second key sharing it never validated (and the rotation test flaked about 1 in 676).

  • New prefix: nself_ + 10 random base32 chars (a-z2-7, 50 bits, unbiased).
  • validateApiKey checks every record with the prefix by bcrypt hash.
  • Existing 2-letter keys keep working (same split rule).
  • Tests: two keys with a forced shared prefix both validate; a revoked key sharing a prefix does not block an active one; a legacy short-prefix key validates; a wrong secret under a shared prefix is rejected. Test secrets are synthetic.

review: claude-only, cross-family pending

… key prefixes (D-0100, D-0527)

test.yml ran 'pnpm test -- --coverage --ci --passWithNoTests'. pnpm forwards
the literal '--', so jest read the flags as path patterns, matched nothing and
exited 0. Run 'pnpm run test:ci' instead. jest now skips the ticket worktree
folder so a main-checkout run does not also run every worktree's suite copy.

API keys used nself_ + 2 letters as the lookup prefix and validated only the
first record with it, so a colliding key never validated. New keys get
10 random base32 chars; validation checks every record with the prefix by
hash, so legacy 2-letter keys keep working.
@github-actions

Copy link
Copy Markdown

Lighthouse Audit Results

Category Score Status
Performance 78 🟠
Accessibility 100 🟢
Best Practices 96 🟢
SEO 91 🟢

Score Guide

  • 🟢 90-100: Good
  • 🟠 50-89: Needs improvement
  • 🔴 0-49: Poor

View full Lighthouse report

@github-actions

Copy link
Copy Markdown

Lighthouse Audit Results

Category Score Status
Performance 77 🟠
Accessibility 100 🟢
Best Practices 96 🟢
SEO 91 🟢

Score Guide

  • 🟢 90-100: Good
  • 🟠 50-89: Needs improvement
  • 🔴 0-49: Poor

View full Lighthouse report

@acamarata
acamarata merged commit 0994e47 into main Oct 11, 2026
36 checks passed
@acamarata
acamarata deleted the debt/d0100-d0527-jest-apikeys branch October 11, 2026 23:36
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.

1 participant