You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 70cbb5f
Browse filesBrowse the repository at this point in the historyBrowse files
feat(ownts): parse function callbacks/cleanups; catch a real OSS leak
Hook libraries clean up by design, so the real-leak hunt moved to app-shaped
component code — and found one: react-scroll-to-bottom@4.2.0 Composer.js:574 adds
a `focus` listener with { capture: true } but removes it with the default capture
(false), so per the DOM spec it is NEVER removed and piles up on every `target`
change. That code ships transpiled ES5 (`function () {}` callbacks + `return
function () {}` cleanups), which the arrow-tuned parser could not read.
This teaches the frontend those shapes:
- _effect_callback: detect a `function (...) {}` callback (body brace after the
params via _body_brace), alongside arrow block / arrow expression.
- _cleanup_span: a cleanup may be `return function () {}` (not only `return () =>`).
With both, the Composer bug is caught for the RIGHT reason — the cleanup parses,
and the listener key rejects the capture:true-vs-false removal — instead of by the
coarse "no cleanup" path. EffectFunctionCallback.tsx pins it: a correctly-matched
ES5 cleanup stays silent; the capture mismatch is the single OWN001. CI step added.
The ES5 corpus (ahooks + react-use, ~93 useEffect) now parses; its 11 findings
triage as FPs from the known patterns plus one new transpilation artifact
(optional-chaining desugars the cleanup receiver to a temp `_a` ≠ `ref.current`),
documented as residual in docs/notes/ownts-oss-benchmark.md (which also records the
first confirmed true positive). Arrow corpus unchanged at 11; full suite green;
ruff + mypy --strict clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVeuchch67CtjSbizYm8gi
0 commit comments