Skip to content

Refactor extension internals and add repo-wide quality checks#1

Open
MaximilianMauroner wants to merge 1 commit into
mainfrom
feat/codebase-first-extension-improvements
Open

Refactor extension internals and add repo-wide quality checks#1
MaximilianMauroner wants to merge 1 commit into
mainfrom
feat/codebase-first-extension-improvements

Conversation

@MaximilianMauroner

Copy link
Copy Markdown
Owner

Summary

Refactor the extension into focused content/shared modules, centralize settings and cache contracts, and add lint/test coverage with fixture-backed DOM parsing tests.
Align product metadata and popup wording with actual behavior, and update CI to run the broader repository validation flow.

Why

  • Reduce maintenance risk from the monolithic content script and duplicated settings logic
  • Add automated checks for brittle parsing and row-detection behavior before future changes
  • Keep repo, manifest, popup, and release docs consistent with the extension's actual scope

Testing

  • bun run check
  • Verified typecheck, ESLint, Vitest, build, Firefox lint, release validation, and packaging locally

Future improvements

  • Add browser-level integration coverage against real GitHub markup snapshots to catch DOM regressions earlier
  • Tighten latest-activity extraction to use a more explicit signal if GitHub exposes one reliably
  • Consider pruning repeated build work in CI/release scripts to reduce validation time

Confidence

Component Score Notes
Content script refactor 4 Behavior preserved through module extraction and local validation
Shared settings/cache contracts 5 Logic is centralized and covered by unit tests
Test and lint tooling 4 New checks pass locally and are wired into CI
Docs and release metadata 5 Scope and wording now match the implemented extension

Copilot AI review requested due to automatic review settings March 18, 2026 12:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the extension’s content-script internals into focused content/ and shared/ modules, centralizes settings/cache contracts, and adds repo-wide quality checks (ESLint + Vitest with fixture-backed DOM parsing tests) that are now run in CI/release workflows.

Changes:

  • Split the monolithic content script into modular content/shared files (DOM parsing, rendering, fetching, storage, cache, settings).
  • Add Vitest (jsdom) tests with HTML fixtures covering settings/cache behavior and GitHub DOM parsing/extraction helpers.
  • Add ESLint flat config and expand CI/release workflows to run bun run check (typecheck + lint + test + release validations).

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
vitest.config.ts Adds Vitest jsdom configuration for DOM-focused unit tests.
tsconfig.tests.json Introduces a dedicated TS config for test typechecking.
tests/.test.ts + tests/helpers/fixtures.ts + tests/fixtures/.html Adds fixture-backed parsing/extraction tests for settings, cache payloads, and GitHub DOM variations.
src/shared/types.ts Exports shared extension contracts (settings, cache payloads, row model, etc.).
src/shared/settings.ts Centralizes default settings + sanitization/merge behavior.
src/shared/cache.ts Centralizes cache versioning and persisted payload helpers.
src/popup.ts Switches popup logic to use shared settings/cache contracts.
src/content/* New modular content-script implementation (DOM selection/parsing, extractors, fetch queue, render, storage wrapper, app bootstrap).
src/content.ts Replaces the monolithic script with a thin bootstrap wrapper.
eslint.config.mjs Adds ESLint flat config for src/scripts/tests with TS support.
package.json Adds lint/test scripts and a repo-wide check script; expands typecheck to include tests.
scripts/check-release.ts Tightens typing for built manifest validation.
popup.html / README.md / manifest.json / docs/release-checklist.md Aligns wording/scope with current PR-list-only behavior and updates release/check instructions.
.github/workflows/ci.yml / release.yml Updates CI/release to run bun run check.
bun.lock Locks newly added lint/test dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread src/content/text.ts
return null;
}

const diffSeconds = Math.max(1, Math.round((now - target) / 1000));
Comment thread package.json
"lint:firefox": "bun run build:firefox && web-ext lint -s dist/firefox",
"check:release": "bun run typecheck && bun run build:chrome && bun run build:firefox && bun run lint:firefox && bun run scripts/check-release.ts && bun run pack:chrome && bun run pack:firefox"
"check:release": "bun run typecheck && bun run build:chrome && bun run build:firefox && bun run lint:firefox && bun run scripts/check-release.ts && bun run pack:chrome && bun run pack:firefox",
"check": "bun run typecheck && bun run lint && bun run test && bun run check:release"
Comment thread src/content/fetchQueue.ts
Comment on lines +31 to +37
this.activeFetches += 1;
next.taskFactory()
.then(next.resolve, next.reject)
.finally(() => {
this.activeFetches -= 1;
this.pump();
});
Comment thread src/content/storage.ts
Comment on lines +11 to +18
return new Promise((resolve) => {
getStorageArea(area).get(keys, (items) => resolve(items as Record<string, unknown>));
});
}

export function chromeStorageSet(area: StorageArea, value: Record<string, unknown>): Promise<void> {
return new Promise((resolve) => {
getStorageArea(area).set(value, () => resolve());
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