fix(review): recognize export const enum and abstract class in impact-symbols - #5858
Conversation
…-symbols `EXPORTED_DECLARATION_RE` in impact-symbols.ts had two regex-variant gaps that fed wrong input to the deterministic impact-map extraction (JSONbored#2183): - `export const enum Foo {}` matched the bare `const|let|var` alternative first and captured the literal word "enum" as the symbol name instead of `Foo`. - `export abstract class Foo {}` matched no alternative at all, so an added/changed abstract base class contributed zero symbols to the impact map. Add a `(?:const\s+)?enum` alternative ahead of `const|let|var` so `const enum` is captured as the enum's real name (and a real `export const enumValue`, whose identifier merely starts with "enum", still falls through to the const boundary), and allow an optional `abstract` prefix on the class alternative (covering `export default abstract class` too). Group order keeps function/class in groups 1/2, so `boundaryKindForMatch` is unchanged — the reordering only moves groups that all resolve to the "export" kind. Public signatures and the empty-patch fail-safe are untouched.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5858 +/- ##
===========================================
+ Coverage 66.87% 95.11% +28.23%
===========================================
Files 587 587
Lines 46511 46511
Branches 14870 14870
===========================================
+ Hits 31106 44240 +13134
+ Misses 12930 1515 -11415
+ Partials 2475 756 -1719
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ LoopOver review result - approve/merge recommendedReview updated: 2026-07-14 20:16:00 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 2 non-blocking
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
[BETA] Chat with GittensoryAsk Gittensory a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://gittensory.aethereal.dev/docs/gittensory-commands 🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
Summary
EXPORTED_DECLARATION_REinsrc/review/impact-symbols.ts— the deterministic changed-symbol extractor feeding the impact-map computation (#2183) — had two regex-variant gaps:export const enum Direction {}matched the bare(?:const|let|var)\s+([\w$]+)alternative before theenumone, capturing the literal word"enum"as the symbol name instead ofDirection.export abstract class Foo {}matched no alternative at all (there was noabstracthandling), so an added/changed abstract base class contributed zero symbols to the impact map.Fix
(?:const\s+)?enum\s+([\w$]+)alternative ahead ofconst|let|var, soconst enumis captured as the enum's real name.enum\s+requires trailing whitespace, so a realexport const enumValue = 1(identifier merely starting with "enum") still falls through to the const boundary — no over-capture.(?:abstract\s+)?prefix to theclassalternative, coveringexport abstract class Fooandexport default abstract class Foo(mirroring the existingdefault-prefix handling).function/classin groups 1/2, soboundaryKindForMatchis unchanged — the reordering only moves groups that all resolve to the"export"kind. Public signatures and the empty/unparseable-patch fail-safe are untouched.Tests
Extends
test/unit/impact-symbols.test.tswith regressions for both fixes —export const enum Direction→{ name: "Direction", kind: "export" }(asserting the correct name, not merely that it matches),export abstract class Fooandexport default abstract class Foo→{ name: "Foo", kind: "class" }, plus a guard thatexport const enumValue = 1stays a const boundary. All prior declaration-form tests pass unchanged. 100% patch coverage (statements/branches/functions/lines) on the touched module locally.No regression to previously-working behavior beyond the two corrected cases.
Closes #5841