π Before claiming this issue
Two quick steps before you open a PR:
- β Star the repository β low-friction signal that you'll follow through
- π¬ Comment
I'll take this (or similar) below β prevents two contributors racing on the same issue
Full policy: CONTRIBUTING.md β How to claim. If a claim is older than 7 days with no PR, you can reclaim it politely.
What
vitest.config.ts line 13 restricts coverage to src/panel/**. The most important pure-logic modules in the codebase are excluded from coverage and have zero tests:
| File |
Public API |
Test coverage |
src/services/snapshot-builder.ts |
buildSnapshot, hashSnapshot, snapshotToPromptText |
0 |
src/services/token-optimizer.ts |
TokenOptimizer class (5 methods) |
0 |
src/services/ai-client.ts |
analyzeSnapshot, response parsing |
0 |
src/utils/messaging.ts |
6 utility functions |
covered by 1 test (messaging.test.ts) |
src/utils/sanitize.ts |
2 exported functions |
covered |
Why it matters
- These services are pure logic β easy to test, no Chrome mocking needed
hashSnapshot uses crypto.subtle β a regression could break deduplication silently
checkRateLimit is a sliding window β off-by-one would let users exceed quotas
- AI client error paths are completely untested
What to do
This is a help wanted issue because it's M-sized (~6h). Suitable for someone who:
- Wants a bigger contribution than a 1-line fix
- Likes writing tests
- Has time to learn the codebase's testing conventions (
src/__tests__/setup.ts)
Suggested deliverables
src/__tests__/snapshot-builder.test.ts with β₯6 tests
src/__tests__/token-optimizer.test.ts with β₯6 tests
- (Optional)
src/__tests__/ai-client.test.ts with happy-path + error tests using fetch mocks
- Update
vitest.config.ts to include src/services/** and src/utils/** in coverage
Test ideas β snapshot-builder
buildSnapshot with empty TabState β all arrays empty, memory: null
buildSnapshot with 51 issues β top 50 retained (MAX_ISSUES enforcement)
snapshotToPromptText with full snapshot β contains section headers
hashSnapshot deterministic: same input β same hash
hashSnapshot different snapshots β different hashes
Test ideas β token-optimizer
checkRateLimit with 0 calls β allowed: true, remainingCalls: 3
- After 3
recordCall() β allowed: false
getCachedResult with expired entry β returns null
setCachedResult at MAX_CACHE_ENTRIES β evicts oldest
validateSubscriptionKey with valid/invalid format
Acceptance criteria
Scope: M (3 new test files + config) | Effort: ~4-6h | Risk: Lane Tiny | Label: help wanted
What
vitest.config.tsline 13 restricts coverage tosrc/panel/**. The most important pure-logic modules in the codebase are excluded from coverage and have zero tests:src/services/snapshot-builder.tsbuildSnapshot,hashSnapshot,snapshotToPromptTextsrc/services/token-optimizer.tsTokenOptimizerclass (5 methods)src/services/ai-client.tsanalyzeSnapshot, response parsingsrc/utils/messaging.tsmessaging.test.ts)src/utils/sanitize.tsWhy it matters
hashSnapshotuses crypto.subtle β a regression could break deduplication silentlycheckRateLimitis a sliding window β off-by-one would let users exceed quotasWhat to do
This is a
help wantedissue because it's M-sized (~6h). Suitable for someone who:src/__tests__/setup.ts)Suggested deliverables
src/__tests__/snapshot-builder.test.tswith β₯6 testssrc/__tests__/token-optimizer.test.tswith β₯6 testssrc/__tests__/ai-client.test.tswith happy-path + error tests usingfetchmocksvitest.config.tsto includesrc/services/**andsrc/utils/**in coverageTest ideas β snapshot-builder
buildSnapshotwith emptyTabStateβ all arrays empty,memory: nullbuildSnapshotwith 51 issues β top 50 retained (MAX_ISSUES enforcement)snapshotToPromptTextwith full snapshot β contains section headershashSnapshotdeterministic: same input β same hashhashSnapshotdifferent snapshots β different hashesTest ideas β token-optimizer
checkRateLimitwith 0 calls βallowed: true, remainingCalls: 3recordCall()βallowed: falsegetCachedResultwith expired entry β returnsnullsetCachedResultat MAX_CACHE_ENTRIES β evicts oldestvalidateSubscriptionKeywith valid/invalid formatAcceptance criteria
vitest.config.tscoverageincludewidened to services + utilsnpm run test:coverageshows β₯60% coverage ofsrc/services/Scope: M (3 new test files + config) | Effort: ~4-6h | Risk: Lane Tiny | Label: help wanted