fix(health): count TS object-literal shorthand properties as reads#759
Merged
Conversation
The ts_js def/use dialect only knew shorthand_property_identifier_pattern
(the destructuring binder) and never counted shorthand_property_identifier
(an object-literal read like { days, limit }) as a use. Extract Method
IN/OUT inference on TS/JS could therefore omit a variable a candidate span
consumes via shorthand, producing a wrong parameter list, and params_unused
reported false positives for such parameters.
Grammar introspection across the typescript, tsx, and javascript packs
confirms the non-pattern kind never appears in a write-target position, so
extending identifier_kinds adds reads without risking false defs.
|
✅ Health: 7.7 (unchanged) 📋 At a glance Files & modules (2)
🔎 More signals (1)🔥 Hotspots touched (2)
📊 Full report · ⭐ Star Repowise · 📥 Install bot · Last updated 2026-07-10 15:25 UTC |
swati510
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The ts_js def/use dialect classifies only plain
identifiernodes as variable reads. It knowsshorthand_property_identifier_pattern(the destructuring binder, a def) but never countsshorthand_property_identifier, the object-literal read in{ days, limit }. Those reads were invisible to the dataflow layer.Impact on shipped consumers:
Concrete repros:
packages/api-client/src/graph.ts::getHotFilesGraphreporteddaysandlimitas unused parameters even though both are consumed at line 97 via shorthand; same forproviders.ts::setActiveProvider(provider) andpackages/vscode/src/features/trees/shared.ts::section(key,label).Fix
Extend the dialect's
identifier_kindswithshorthand_property_identifier. Grammar introspection across the typescript, tsx, and javascript packs confirms the non-pattern kind only ever appears in read position (object literals); destructuring binders, including assignment-LHS destructuring, always parse as the_patternvariant. So this adds reads and can never introduce a false def.Tests
New fixtures in
tests/unit/health/test_dataflow_langs.py:return { days, limit, payload })const { a } = { ...source, b })Full health suite (921 tests) passes with no extract-method golden shifts. Full unit suite passes except the pre-existing
test_bundled_changelog_in_syncfailure, which is unrelated (bundled changelog drifted on main).Rerunning the tree-wide dataflow sweep confirms the three shorthand false-positive repros above are gone.
Perf-neutral: the change adds one string to a frozenset consulted in an existing membership check.