Skip to content

Core test coverage to 100%, zero lint warnings, clearer Drive setup, 4 bug fixes - #12

Draft
harshabala wants to merge 9 commits into
mainfrom
harsha/lucid-ride-vwzc7t
Draft

harshabala wants to merge 9 commits into
mainfrom
harsha/lucid-ride-vwzc7t

Conversation

@harshabala

Copy link
Copy Markdown
Owner

Summary

  • Coverage: the measured core (background handlers, storage, LLM, events, recommendations, message router, content scanner; 18 files, ~2,950 statements) goes from 49% to 100% statements, branches, functions and lines. vitest.config.ts now sets 100% thresholds, and CI plus npm run ci run test:coverage, so any drop fails the build. There are 941 tests, up from 674.
  • Lint: all 103 ESLint warnings are fixed. lint:eslint runs with --max-warnings 0 in npm run ci and as a CI step.
  • Drive setup:
    • store/WHAT_YOU_STILL_DO.md §3 now has click-by-click Google Auth Platform steps. The app's two scopes (drive.appdata, userinfo.email) are non-sensitive, so publishing needs no Google review. The steps also cover registering the store item's redirect URI between upload and submit.
    • Settings shows readers a plain message when Drive sign-in fails because of setup; the technical detail goes to Diagnostics.

Bugs found and fixed while writing tests

  1. Dropped poster scans (src/content/scanner.ts): each DOM mutation batch restarted the poster-scan debounce with only its own nodes, so posters from earlier batches in the same 500 ms window were never scanned. Image roots now accumulate until the scan runs.
  2. Inflated "titles added" (mergeSeedCatalog): every refreshed catalogue title counted as added, so "Merge highlight catalogue" always reported ~150 new titles and RESTORE_DEMO_LIBRARY always said it seeded. Only new titles count now. Two existing test expectations are updated with the reason.
  3. Duplicate bridges (grouped recommendations): the same cross-medium bridge could be listed twice under one seed.
  4. Wasted startup work (App.tsx): the whole people list was fetched at startup and on every filmmaker update to fill counters that were never shown. Those fetches are removed.

Other changes

  • Removed about 20 conditions that could never be taken instead of writing tests for them. Each one has a comment or commit note explaining why it was dead (e.g. a length check the regex already enforces, an oldVersion < 4 inside an upgrade that only runs below v4).
  • Replaced any with real types: TMDb person/credit rows, logger args, scanner responses, settings validator, UI message payloads. Rethrown errors now carry cause.

Scope note

The 100% applies to the existing coverage.include set. The Preact UI (src/ui/**) and the content-script renderers (hoverCard.tsx, posterBadge.tsx) stay outside it, as before.

Verification

  • npm run release-check passes: typecheck, lint (0 warnings), 941 tests with 100% core coverage, build, package check.
  • The coverage gate fails as intended when a suite is removed (checked by excluding the scanner suite).
  • Loaded the unzipped store subsume.zip in headless Chromium:
    • popup renders;
    • Settings Drive connect/disconnect works;
    • the content script mounts on a movie page;
    • no page errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e


Generated by Claude Code

- Remove unused imports (legacy `h` from the pre-automatic JSX runtime,
  unused types) and a dead Open Library helper.
- Replace `any` with real shapes: TMDb person/credit rows, logger args,
  scanner poster responses, settings validator, UI message payloads.
- Attach `cause` to rethrown errors in llm.ts and keyCrypto.ts.
- App.tsx: drop never-rendered stats/people counters and the people fetches
  that only fed them (startup does less work; demo-library bootstrap kept).
- lint:eslint now uses --max-warnings 0, runs in `npm run ci` and in CI.

Also: Settings shows a plain message when Drive sign-in fails for setup
reasons (detail and redirect URI go to Diagnostics), and the owner checklist
has click-by-click Google Auth Platform steps for publishing Drive backup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
…cle events

- New suites bring handlers/people.ts, handlers/recommendations.ts,
  handlers/sync.ts, handlers/alerts.ts, events.ts and recommendations.ts to
  100% lines/statements/functions.
- Fix: grouped recommendations could list the same cross-medium bridge twice
  when the generator returned a duplicate for one seed (the seen-id set was
  never updated while merging).
- events.ts: drop the never-used `updateBadge` option on
  notifyWatchAlertMatches (its only caller owns the badge).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
…acks)

Simplify two branches that could never be taken (year parse after a
four-digit regex, eviction key on a non-empty map).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
…reflections handlers

Remove two guards that could never fire (non-object merged prefs; a
sanctuaryIntent fallback that re-read the same nullish value).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
…oodreads import)

Drop an ISBN fallback that could never succeed: toIsbn13 already returns
null exactly when the ISBN is invalid.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
…rator

Tighten buildPrompt/buildPersonalizedPrompt parameters that every caller
already passes, and drop a '|| 0' on ratings already filtered to >= 8.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
- Fix: mergeSeedCatalog counted every refreshed catalogue title as "added",
  so Settings' "Merge highlight catalogue" always reported ~150 new titles
  and RESTORE_DEMO_LIBRARY always said it seeded. Only genuinely new titles
  count now; refreshed metadata is still written.
- Remove checks that could never fail (library-empty re-check inside the
  seeder, oldVersion < 4 inside an upgrade that only runs below v4, and the
  undecryptable-key preservation guards whose values always come from the
  raw record).
- Export the dual-write merge helpers so their generic branches are tested
  directly.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e
- Fix: the page observer restarted its poster-scan debounce with only the
  newest batch's nodes, so posters from earlier batches in the same 500 ms
  window were never scanned (common on sites that stream cards in bursts).
  Image roots now accumulate until the debounced scan runs.
- Remove scanner branches that could never be taken (title-length check the
  regex already enforces, IMG tested against a skip list without IMG, a null
  response after every path assigned one, a TMDb-URL check inside a
  TMDb-only helper).
- vitest thresholds: 100% statements/branches/functions/lines for the core
  scope; CI and `npm run ci` now run `test:coverage`, so a drop fails the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHFhkzNyPBLTv6hU2PeX3e

This branch has not been deployed

No deployments
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.

2 participants