Skip to content

fix: bug fixes, build improvements, and Sentry removal#59

Merged
SYM01 merged 9 commits intodevelopfrom
fix/bugs-and-optimizations-clean
Apr 15, 2026
Merged

fix: bug fixes, build improvements, and Sentry removal#59
SYM01 merged 9 commits intodevelopfrom
fix/bugs-and-optimizations-clean

Conversation

@SYM01
Copy link
Copy Markdown
Collaborator

@SYM01 SYM01 commented Apr 15, 2026

Summary

  • Fix multiple bugs: in operator on array → .includes(), URL parsing crash guard, safe DOM access, .map().forEach() for side effects, popup window.open target fix, typo in i18n
  • Build & tooling: Fix Vite 8 build panic, upgrade tsconfig, fix scriptHelper URI scheme bug, remove Sentry integration entirely
  • Tests: Add tests for scriptHelper, pacSimulator, stats service, and utils; expand profile2config tests
  • Docs: Add CLAUDE.md with codebase guidance
  • Revert: deepClone back to JSON round-trip (structuredClone throws on Vue Proxy objects)

Commits

  • 655b11d fix the object clone issue, close Error occurred: Error: DataCloneError: Proxy object could not be cloned. #49
  • 6a95d24 fix: resolve multiple bugs and code quality issues
  • 2571e1d revert: deepClone back to JSON round-trip from structuredClone()
  • ee9ab6d docs: add CLAUDE.md with codebase guidance for Claude Code
  • 3f5c587 fix an basic authentication issue
  • 47c4d46 fix: Vite 8 build panic, scriptHelper scheme bug, and add tests
  • df89d37 remove: completely remove Sentry integration

Test plan

  • All 44 tests pass (npm run coverage)
  • Manual test: Chrome extension loads and proxy profiles work
  • Manual test: Firefox build (npm run build:firefox) produces valid extension
  • Verify Sentry references are fully removed (no leftover imports/config)

🤖 Generated with Claude Code

SYM01 and others added 7 commits April 16, 2026 00:33
- Fix critical `in` operator bug in refreshProxy() — `proxyType in ["system", "direct"]`
  always returned false; replaced with `["system", "direct"].includes(proxyType)`
- Fix service worker crash: wrap `new URL(details.url)` in try/catch in background.ts
- Fix document.body null access in preference.ts using optional chaining
- Replace deepClone() JSON.parse/JSON.stringify with structuredClone() for correctness
- Fix window.open() called with import.meta.url as target name; use '_blank' instead
- Replace .map() with .forEach() for side-effect-only iterations (profile.ts, auth.ts)
- Remove leftover debug console.log calls from ThemeSwitcher, AutoSwitchInput, background, PopupPage
- Fix i18n typo: "Advance Config" → "Advanced Config"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
structuredClone() throws a DataCloneError on JavaScript Proxy objects,
including Vue reactive() and ref() wrappers. The JSON.parse/JSON.stringify
approach correctly serializes through the Proxy traps, producing a plain
object safe for chrome.storage.

Extend the comment to document why structuredClone() is intentionally
avoided here, to prevent this mistake in future.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Provides build/test commands, architecture overview (adapter layer,
PAC-via-AST proxy engine, profile system), and critical gotchas like
the deepClone JSON round-trip requirement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Work around Rolldown panic on nested member expressions of JSON imports
by using createRequire for manifest.json. Fix newProxyString using the
unnormalized cfg.scheme instead of the defaulted scheme variable. Clean
up dead code (commented-out mocks, redundant comments, unused getter,
console.debug). Add tests for deepClone, LRUCache, shExpMatch,
isPlainHostName, newProxyString, and strengthen findProfile assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove @sentry/vue and @sentry/vite-plugin dependencies, Sentry.init()
from main.ts, the vite plugin config, env variables, CI workflow refs,
and the .env.sentry-build-plugin file. Reduces main.js bundle by ~32%.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes Sentry integration, updates core dependencies (including Vite 8 and TypeScript 6), and significantly expands the test suite. Key improvements include safer URL handling in the background script, refactored proxy profile logic, and a restructured Vite configuration to resolve build-time issues. Feedback was provided regarding the shExpMatch implementation, which currently fails to escape several regex special characters, potentially leading to incorrect matching or errors when processing certain URL patterns.

Comment on lines +7 to +11
const re = new RegExp(
"^" +
pattern.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".") +
"$",
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The shExpMatch implementation only escapes dots and converts wildcards, but it fails to escape other regular expression special characters such as +, (, ), [, ], {, }, ^, $, and |. This can lead to incorrect matching behavior when these characters appear in URLs (e.g., + in query parameters) or cause the RegExp constructor to throw an error for invalid patterns like *+.

  const re = new RegExp(
    "^" +
      pattern
        .replace(/[.+^${}()|[\\\\]|]/g, "\\\\$&")
        .replace(/\\*/g, ".*")
        .replace(/\\?/g, ".") +
      "$",
  );

SYM01 and others added 2 commits April 16, 2026 00:51
`npm ci` on CI (Ubuntu) fails because `@emnapi/core@1.9.2` and
`@emnapi/runtime@1.9.2` (transitive deps of the optional
`@rolldown/binding-wasm32-wasi` package) were not resolved in the
lockfile. This happened because macOS skips the wasm32-wasi optional
package entirely during resolution. Regenerating the lockfile from
scratch ensures all transitive dependencies are present.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- actions/checkout v4 → v6
- actions/setup-node v4 → v6
- actions/upload-artifact v4 → v7
- actions/download-artifact v4 → v8
- softprops/action-gh-release v2 → v3

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@SYM01 SYM01 merged commit 5f4d816 into develop Apr 15, 2026
6 checks passed
@SYM01 SYM01 deleted the fix/bugs-and-optimizations-clean branch April 16, 2026 15:06
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