Skip to content

test(repo): guard against unreferenced source modules - #217

Open
lamemustafa wants to merge 13 commits into
masterfrom
tapish-codex/dead-module-check
Open

test(repo): guard against unreferenced source modules#217
lamemustafa wants to merge 13 commits into
masterfrom
tapish-codex/dead-module-check

Conversation

@lamemustafa

@lamemustafa lamemustafa commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Summary

Mechanise source-module reachability from verified WXT and HTML roots.

Root Cause / Decision Record

Scope

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

  • If this PR consumes @sanchika/* packages or copied Sanchika guidance, I
    read sanchika/docs/adoption-pack.md in the coordinated parent worktree.
  • If this PR consumes Sanchika, it links ComplyEaze and Axal completion evidence
    and records the Sanchika commit or copied guidance used.
  • 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 updated if behaviour changed.

Sensitive Surface Review

  • Current tab / portal target binding is preserved or intentionally changed.
  • Download completion remains evidence-backed and fail-closed.
  • Ambiguous side-effect delivery cannot be reported as confirmed success.
  • Service-worker durability impact is understood and documented.
  • 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 unless every gate in docs/PUBLICATION_READINESS.md is checked.
  • Full fiscal year ships in the one binary but stays out of Store-advertised scope until its evidence gates are recorded.
  • Store copy, README status, Privacy QA, and reviewer instructions were reviewed if user-facing behavior changed.
  • CI ZIP creation, provenance, and protected publishing are treated as 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
  • pnpm exec wxt prepare
  • pnpm exec prettier --check .
  • pnpm exec eslint . --max-warnings 0
  • pnpm exec tsc --noEmit
  • pnpm exec vitest run
  • pnpm exec wxt build
  • node scripts/verify-extension-package.mjs .output/chrome-mv3
  • pnpm exec wxt zip
  • node scripts/verify-extension-zip.mjs
  • node scripts/write-release-provenance.mjs
  • node scripts/verify-github-release-assets.mjs --tag <tag> --zip <zip> --checksum <sha256> --provenance <json> when release assets exist
  • node scripts/publish-chrome-web-store.mjs --zip .output/<zip> --provenance .output/pack-release-provenance.v1.json --publisher-id <id> --dry-run true
  • git diff --check
  • pnpm review:gate -- --strict-head-review --required-review-author chatgpt-codex-connector --wait-head-review-ms 180000 --allow-missing-head-review before merge/readiness claim, with missing Codex review recorded as an audit gap if reported:

Artifact Evidence

  • CI run:
  • ZIP artifact:
  • ZIP SHA-256:
  • Clean source/tag or head SHA:

PR Review Follow-Up

  • GitHub Actions completed.
  • Autogenerated Codex/bot review comments inspected after checks completed for the latest head SHA.
  • Inline review threads are resolved, outdated, or answered with evidence.
  • No commits were pushed after the last required human/bot review without re-review.
  • Any follow-up PRs or issues are listed here instead of being left implicit.
Thread/comment Disposition Commit or evidence
Nested main roots fixed 04541a8, HTML-root regression
CSS import edges fixed 04541a8, CSS import rejection regression
Stale allowlist fixed 04541a8, deleted/reachable regressions
HTML comment parsing follow-up #197 parser replacement
Aliased CSS import fixed 223b240, alias regression
Named WXT content root fixed 223b240, content-root regression
Path substitutions fixed 2958535, CodeQL disposition
Queried CSS alias fixed 2c8c8cf, queried-alias regression
Additional WXT conventions follow-up #220 verification task
Vite glob imports follow-up #221 adoption task
WXT config source imports fixed 1474c0b, config-root regression
WXT srcDir default-export binding follow-up #225, no second defineConfig call in Pack today
Overlapping path alias precedence fixed 1aa61e2, CSS-only fallback uses longest-prefix precedence; #222 closed

| CommonJS require edges | follow-up | #226; exact head has zero JavaScript or CommonJS modules under src |
| Runtime JavaScript shadowed by declarations | follow-up | #227; exact head has zero JavaScript modules under src |

Screenshots

Use synthetic data only.

DCO

  • Commits include Signed-off-by: trailers.

@lamemustafa
lamemustafa marked this pull request as ready for review August 24, 2026 11:14

@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: 331e6bc86c

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
@lamemustafa
lamemustafa marked this pull request as draft August 24, 2026 12:08
@lamemustafa

Copy link
Copy Markdown
Owner Author

Converting back to draft. All four findings verified independently — each one holds, and one of them shows the guard passing on a live instance of the defect it exists to catch.

F1 — run-evidence-panel.tsx, confirmed. Its only importer anywhere is tests/popup/recovery-actions.test.ts. That is verbatim the case #108 says must fail: "Only its own test imports it must fail, not pass." It passes because every .ts/.tsx under src/entrypoints/** is unconditionally a root.

I proved the exemption directly: an orphan planted at src/entrypoints/popup/zz-orphan-probe.ts leaves the guard green, while the same orphan at src/core/ fails it. My own earlier probe used src/core/ and therefore tested the path the guard handles rather than the exemption — the review caught what my adversarial check did not.

F2 — importer-count is not reachability, confirmed. The decision is importersByPath.get(canonicalFilePath)?.size === 0. A disconnected cycle a → b → a gives both a non-empty importer set while neither is reachable from any entry file, so both pass. Re-running to a fixed point cannot expose it, which is the specific property #108 asked for.

F3 — confirmed dead. src/styles/popup-target-summary.css, 171 lines, no importer in src/ or tests/.

F4 — confirmed. manifest-policy.ts is a root because the file exists. wxt.config.ts:14 does import it today, so the stated reason is true but unverified; if the config inlined those values the exemption would silently outlive its justification, leaving a reviewed security boundary imported only by tests.

F1 and F2 share one root cause: importer-count over a root set broad enough to swallow ordinary helpers, where reachability from real entry files is the property actually wanted. That is a redesign of the guard's core rather than a patch, so this goes back rather than being amended here.

Going back to draft rather than sitting ready, because as it stands the guard certifies a source graph containing at least two dead things — and a green gate asserting that is worse than no gate.

@lamemustafa
lamemustafa marked this pull request as ready for review August 24, 2026 12:42

@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: d46594a98f

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts

@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: 04541a84d1

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Fixed

@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: 2958535f2a

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts

@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: 2c8c8cfab6

ℹ️ 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 tests/repo/unreferenced-module-guard.test.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: 1474c0be60

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.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: 5967c8dd99

ℹ️ 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 tests/repo/unreferenced-module-guard.test.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: 0f0b84e301

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.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: c6805b7922

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts
Comment thread tests/repo/unreferenced-module-guard.test.ts
Comment thread tests/repo/unreferenced-module-guard.test.ts
Comment thread tests/repo/unreferenced-module-guard.test.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: 1aa61e2675

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts Outdated
Comment thread tests/repo/unreferenced-module-guard.test.ts

@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: bcf9de6395

ℹ️ 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 tests/repo/unreferenced-module-guard.test.ts
Comment thread tests/repo/unreferenced-module-guard.test.ts
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