Skip to content

fix(review): narrow visual screenshot path gate - #4648

Closed
JSONbored wants to merge 1 commit into
mainfrom
codex/propose-fix-for-visual-path-vulnerability
Closed

fix(review): narrow visual screenshot path gate#4648
JSONbored wants to merge 1 commit into
mainfrom
codex/propose-fix-for-visual-path-vulnerability

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Motivation

  • The previous visual-path classifier marked every apps/* file as "visual", which caused backend/config/docs files under app folders to trigger expensive browser screenshot captures.
  • The intent is to restrict screenshot capture to truly web-visible changes (public assets and frontend source files) while preserving route-file inference for frontend apps.

Description

  • Removed the broad /^apps\/[^/]+\//i pattern from VISUAL_PATTERNS in src/review/visual/paths.ts so only public/** and web-visible frontend extensions (e.g. .tsx, .jsx, .css, .html, .svg, .astro, .vue, .svelte, .mdx) are considered visual.
  • Left DEFAULT_ROUTE_FILE and mapFilesToRoutes behavior in src/review/visual/capture.ts unchanged so frontend route files in apps/*/src/routes/*.tsx|jsx are still mapped via extension-based matching and route inference remains available.
  • Updated test/unit/visual-paths.test.ts to reflect the narrowed gate and added regression assertions that backend/config/docs files such as apps/api/src/server.ts, apps/ui/components.json, and apps/marketing-site/README.md do not trigger the visual gate.

Testing

  • Ran git diff --check which passed with no whitespace or conflict markers.
  • Ran targeted unit tests with npx vitest run test/unit/visual-paths.test.ts test/unit/visual-capture.test.ts --testNamePattern "isVisualPath|mapFilesToRoutes app-folder generalization", and the test files executed successfully (unit assertions for isVisualPath and mapFilesToRoutes passed).
  • npm run typecheck failed in this environment due to missing optional/local packages (@anthropic-ai/claude-agent-sdk, web-tree-sitter) causing TypeScript resolution errors.
  • npm run test:coverage could not complete in this environment because coverage remapping errored with TypeError: jsTokens is not a function, so full coverage verification remains blocked here.

Codex Task

@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.12%. Comparing base (63d5a0f) to head (9892916).
⚠️ Report is 33 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4648   +/-   ##
=======================================
  Coverage   94.12%   94.12%           
=======================================
  Files         430      430           
  Lines       38181    38181           
  Branches    13922    13922           
=======================================
  Hits        35939    35939           
  Misses       1585     1585           
  Partials      657      657           
Files with missing lines Coverage Δ
src/review/visual/paths.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 10, 2026
@loopover-orb

loopover-orb Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-10 23:23:05 UTC

2 files · 1 AI reviewer · 2 blockers · readiness 93/100 · CI green · unstable

⏸️ Suggested Action - Manual Review

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.

Review summary
The diff narrows VISUAL_PATTERNS in src/review/visual/paths.ts by dropping the blanket /^apps\/[^/]+\//i pattern, so isVisualPath now only fires on public/** paths and a fixed set of web-visible extensions. Route inference in capture.ts's DEFAULT_ROUTE_FILE (apps/*/src/routes/*.tsx|jsx) is untouched and its matches are .tsx/.jsx, which the narrowed extension pattern still covers, so route-triggered captures keep working end to end. The test updates are internally consistent: dropped assertions (apps/gittensory-ui/public/og.png, apps/gittensory-ui/README.md as 'true') and new negative assertions (apps/api/src/server.ts, apps/ui/components.json, apps/marketing-site/README.md as 'false') match the new regex set, and the public-asset case is still correctly covered by the separate '(^|/)public/' pattern even without an apps/*-prefixed positive test for it.

Nits — 4 non-blocking
  • The removed 'apps/gittensory-ui/public/og.png' true-case isn't re-asserted anywhere in test/unit/visual-paths.test.ts after the app-folder pattern was dropped — it still passes via the public/ pattern, but there's no direct regression test pinning that specific path now that the app-folder shortcut is gone.
  • The PR description doesn't link a maintainer-authorized issue (only a Codex task URL) — worth adding one per repo contribution conventions.
  • Add back a targeted assertion for a public asset nested under an app folder (e.g. apps/gittensory-ui/public/og.png) in test/unit/visual-paths.test.ts so future edits to the public/ pattern can't silently regress that path without the app-folder shortcut to fall back on.
  • Link this PR to the specific open issue it closes in the description.

Concerns raised — review before merging

  • No linked issue detected — If this PR is intended to solve an issue, link it explicitly in the PR body.
  • Maintainer requires a linked issue — Link the relevant issue (for example Closes #123) before opening the PR.
Signal Result Evidence
Code review ❌ 2 blockers 1 reviewer
Linked issue ⚠️ Missing No linked issue or no-issue rationale found.
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (no linked issue context).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 48 registered-repo PR(s), 40 merged, 285 issue(s).
Contributor context ✅ Confirmed Gittensor contributor JSONbored; Gittensor profile; 48 PR(s), 285 issue(s).
Gate result ❌ Blocking Repo-configured hard blocker found.
Review context
  • Author: JSONbored
  • Role context: owner (maintainer lane)
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, TypeScript, JavaScript, Ruby, Go, Kotlin, MDX, Shell
  • Official Gittensor activity: 48 PR(s), 285 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Treat this as maintainer-lane context rather than normal contributor-lane activity.
  • Explain no-issue PR.
  • Link the issue being solved, or explicitly explain why this is a no-issue PR.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added the manual-review Gittensor contributor context label Jul 10, 2026
@JSONbored

Copy link
Copy Markdown
Owner Author

Closing — this reverts deliberate, already-shipped behavior from #4564 (merged the day before this PR was opened).

e063f55ff intentionally widened VISUAL_PATTERNS's app-folder pattern from /^apps\/gittensory-ui\//i to /^apps\/[^/]+\//i specifically so metagraphed's apps/ui/** (a different app-folder name using the same TanStack flat-file routing convention) gets web-visible capture coverage — see #3611. That commit even added test cases pinning apps/gittensory-ui/public/og.png → true and apps/ui/components.json → true.

This PR removes that pattern entirely and flips those exact same test assertions to false, undoing the fix rather than fixing a real bug. The "every apps/* file marked visual, causing expensive captures" framing in the PR description is describing the intended outcome of #4564, not a defect.

Thanks for the scan — the underlying "is this gate too broad" question is worth watching, but the correct fix (if capture cost becomes a real problem) would need to preserve #3611 coverage, not drop it.

@JSONbored JSONbored closed this Jul 10, 2026
@JSONbored
JSONbored deleted the codex/propose-fix-for-visual-path-vulnerability branch July 19, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. manual-review Gittensor contributor context

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant