Skip to content

fix(injection): make MAIN-world functions self-contained across the executeScript boundary - #116

Merged
lamemustafa merged 3 commits into
masterfrom
tapish-codex/injected-scope-selfcontained
Aug 1, 2026
Merged

fix(injection): make MAIN-world functions self-contained across the executeScript boundary#116
lamemustafa merged 3 commits into
masterfrom
tapish-codex/injected-scope-selfcontained

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

Restores page-generated filed-return acquisition by making every MAIN-world injected function independent of module scope.

Root Cause / Decision Record

  • Chrome serializes only an injected function; the blob capture function referred to a module byte cap and a module target-check helper, so it threw before the portal action.
  • The byte cap is now a serialized argument and the target check is local to the injected function. An absent or rejected injection is reported as main-world-execution-failed, never as a portal generation timeout.
  • This is the smallest safe fix: target binding, download correlation, and artifact validation remain unchanged.

Scope

  • Runtime: self-contained MAIN-world blob capture; explicit injection-failure outcome; recovery retains unproven acquisition intent.
  • Tests: rebuild serialized injected functions without module bindings; cover absent/rejected injection and retained recovery intent.
  • Docs/governance: none.
  • Explicitly out of scope: live authenticated QA and any portal-flow redesign.

Pack Workflow Preflight

  • pnpm workflow:preflight was run before editing/push, or the skip reason is documented.
  • This PR was opened from a Pack branch, not master.
  • I checked latest master Pack AGENTS guidance or recorded the stale-guidance warning.
  • PR body keeps the required Pack privacy/review/verification checklist visible.

Sanchika Adoption Gate

  • This PR does not import ../sanchika, sanchika/packages/*/src, or parent source paths.

Privacy And Data-Flow Impact

  • No new browser permissions.
  • No new host permissions.
  • No new network calls.
  • No analytics, telemetry, ads, or session replay.
  • No credential, OTP, CAPTCHA, cookie, token, GST file, or taxpayer-data capture.
  • Public copy and privacy declarations are unchanged because persisted data and public behavior claims are unchanged.

Sensitive Surface Review

  • Current tab / portal target binding is preserved.
  • Download completion remains evidence-backed and fail-closed.
  • Ambiguous side-effect delivery cannot be reported as confirmed success.
  • Service-worker durability preserves the acquisition intent after unproven MAIN-world execution.
  • Real taxpayer data, local paths, raw URLs/referrers, and portal HTML are absent from the diff.

Chrome Web Store Impact

  • This PR does not expand beyond the existing Chrome Web Store V0 listing.
  • Full fiscal year remains source-build alpha and is not part of the Chrome Web Store V0 listing.
  • Store copy, README status, Privacy QA, and reviewer instructions were reviewed; no user-facing copy changed.
  • CI ZIP creation, provenance, and protected publishing remain release evidence, not manual store-submission sign-off.
  • PR title uses Conventional Commits so Release Please can bump Pack after merge.

Verification

  • pnpm install --frozen-lockfile
  • pnpm audit --audit-level high (not run; no dependency change)
  • pnpm exec wxt prepare
  • pnpm exec prettier --check .
  • pnpm exec eslint . --max-warnings 0
  • pnpm exec tsc --noEmit
  • pnpm exec vitest run — 101 files, 1459 tests
  • pnpm exec wxt build
  • node scripts/verify-extension-package.mjs .output/chrome-mv3
  • pnpm exec wxt zip (release-only; not run)
  • node scripts/verify-extension-zip.mjs (release-only; not run)
  • Release provenance and publishing checks (release-only; not run)
  • git diff --check
  • Strict review gate ran with --allow-missing-head-review; no current-head automated review was found, so this remains an audit gap and no readiness is claimed.

Artifact Evidence

  • CI run: pending.
  • ZIP artifact: not produced; this is not a release.
  • ZIP SHA-256: not applicable.
  • Clean source/tag or head SHA: 752856f.

MAIN-world Injection Audit

  • Unsafe before this fix: capturePortalPdfBlob, used by both page-generated capture call sites. It closed over the module byte cap and visible-target helper.
  • Already self-contained: fetchFiledReturnJsonInMainWorld and selectFiledReturnsFiltersInMainWorld.
  • The serialization guard was run against unfixed code and failed with ReferenceError: controlHasVisibleTarget is not defined; it now rebuilds and exercises every distinct injected function.
  • main-world-execution-failed distinguishes absent or rejected injection execution from a portal generation timeout.
  • Live authenticated QA remains outstanding.

PR Review Follow-Up

  • GitHub Actions completed.
  • Strict review gate found no current-head automated review after its configured wait window; this audit gap remains recorded.
  • The initial two inline findings and the final-round sibling sweep are fixed in the two follow-up commits below.
  • Fresh automated review of the follow-up head is pending; this remains an audit gap and no readiness is claimed.
  • Two follow-up commits were pushed after the initial branch publication.
Thread/comment Disposition Commit or evidence
Post-injection staged-delivery rejection fixed 36badc0; rejected local staging becomes durable artifact review, with focused and full Vitest coverage
MAIN-world JSON checkpoint retention fixed 36badc0; no-action JSON clears its checkpoint while page-generated paths retain recovery intent
Direct delivery rejection and pre-write checkpoint retention fixed 752856f; all post-injection delivery siblings return delivery-unconfirmed, and rejected callback writes retain recovery ownership

Screenshots

Not applicable; this is a background execution-boundary fix.

DCO

  • The first follow-up commit lacks a Signed-off-by: trailer; final commit 752856f is signed, and history was not rewritten.

Signed-off-by: Tapish Khandelwal <tapishkhandelwal13@gmail.com>
@lamemustafa
lamemustafa marked this pull request as ready for review August 1, 2026 14:17

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46f1c1c1e8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/background/filed-returns-json-acquisition.ts Outdated
Comment thread src/background/filed-returns-download-trigger.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 36badc08cb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/background/filed-returns-json-acquisition.ts Outdated
Comment thread src/background/filed-returns-download-trigger.ts Outdated
Signed-off-by: Tapish Khandelwal <tapishkhandelwal13@gmail.com>
@lamemustafa
lamemustafa merged commit 20e7422 into master Aug 1, 2026
13 checks passed
@lamemustafa
lamemustafa deleted the tapish-codex/injected-scope-selfcontained branch August 1, 2026 17:15
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