Skip to content

chore: harden v3.0.1 — dedupe library filters, +19 tests, fix AA contrast#21

Merged
New1Direction merged 1 commit into
mainfrom
chore/harden-v3.0.1
Jun 15, 2026
Merged

chore: harden v3.0.1 — dedupe library filters, +19 tests, fix AA contrast#21
New1Direction merged 1 commit into
mainfrom
chore/harden-v3.0.1

Conversation

@New1Direction

Copy link
Copy Markdown
Owner

Summary

The audit's highest-leverage follow-through items, in one pass.

1. Dedupe the library filter pipeline (the "active bug")

render() and getVisibleRows() were ~50 lines of copy-pasted filter/sort logic. Extracted into a pure, tested library-filters.js → applyFilters() that both now call.

Adversarial note: the audit claimed the export path "returns wrong rows" (dropped eval sort + membership filters). Reading both functions, that was over-stated — the eval/collection/decision filters were present in both. The real divergence was narrower: the export filtered by the NL-filter ids but dropped the AI ranking order. Now fixed (canonical = render's ordered version), with a regression test.

2. Tests for untested, security-relevant pure logic (+19, 713 → 732)

  • computeScore (evaluations.js) — weighted rubric average, null/empty/out-of-range guards, missing-weight default.
  • oauth-pkcebase64url (padding/URL-safety) and that createPkcePair emits a real S256 challenge = base64url(SHA-256(verifier)), correct sizes, and randomness.
  • applyFilters — every branch, incl. the NL-order regression.

3. Fix WCAG-AA contrast on 5 themes

--text-muted failed AA (< 4.5:1) on 5 of 13 themes — including the default midnight (4.15:1) and worst rosepine (3.42:1). Hue-preserving lightness bumps; all 13 now ≥ 4.5:1, verified by a computed-ratio script (the other 8 were already passing and untouched).

Test plan

  • npx vitest run732 passing (was 713)
  • node --check on library.js + library-filters.js
  • Computed WCAG ratios: all 13 themes' --text-muted now pass AA
  • Smoke-test the library grid (filters/sorts/exports) after reload — behavior preserved

Note

Extension-only (no website/ change → no deploy). CI lands green (732 tests).

🤖 Generated with Claude Code

…rast

Audit follow-through (the highest-leverage items).

- Extract applyFilters() into a pure library-filters.js. render() and
  getVisibleRows() were ~50 lines of copy-pasted filter/sort logic that had
  diverged — the export path filtered by the NL-filter ids but dropped the AI
  ranking order. Both now call one tested function. (Adversarial read showed
  this was smaller than the audit feared: same row set, only the NL order
  differed — now fixed.)
- Tests for the untested, security-relevant pure logic: computeScore (weighted
  rubric average + null/range guards), oauth-pkce (base64url + the real S256
  challenge), and applyFilters itself (incl. an NL-order regression test).
  +19 tests (713 → 732).
- Fix the 5 themes whose --text-muted failed WCAG AA — incl. the DEFAULT
  midnight (4.15:1) and worst rosepine (3.42:1). Hue-preserving lightness
  bumps; all 13 themes now >=4.5:1 (verified by computed contrast ratio).
@New1Direction New1Direction merged commit b991314 into main Jun 15, 2026
1 check passed
@New1Direction New1Direction deleted the chore/harden-v3.0.1 branch June 15, 2026 02:55
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