Skip to content

fix: restrict CreateObject component usage detection - #197

Merged
TwitchBronBron merged 3 commits into
rokucommunity:masterfrom
AysajanE:northset/M-115
Aug 11, 2026
Merged

fix: restrict CreateObject component usage detection#197
TwitchBronBron merged 3 commits into
rokucommunity:masterfrom
AysajanE:northset/M-115

Conversation

@AysajanE

Copy link
Copy Markdown
Contributor

Summary

Count a component as used only when it is the component argument to CreateObject("roSGNode", ...), not any matching string literal.

Change

  • src/plugins/checkUsage/createObjectUsage.spec.ts
  • src/plugins/checkUsage/index.ts

Checks

  • npx mocha --no-config --require ts-node/register --require source-map-support/register src/plugins/checkUsage/createObjectUsage.spec.ts — passed in a network-isolated container.

Fixes #61


AI assistance was used; I reviewed and own this change.

Verification

Northset proof-of-pass receipt M-115
Contributor self-run; not maintainer verification.

Signed-off-by: Aysajan Eziz <aeziz@northset.ai>

@TwitchBronBron TwitchBronBron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Can you add a few unit tests just verifying your new logic doesn't crash for these situations:

createObject()
createObject("roRegex")

Signed-off-by: Aysajan Eziz <aeziz@northset.ai>
@AysajanE

Copy link
Copy Markdown
Contributor Author

Added the requested regression coverage for both CreateObject() and CreateObject("roRegex"). The test filters the parser’s expected argument-count diagnostics so it exercises the plugin crash path. Local build and lint pass, and the full suite passes 117/117.

@TwitchBronBron TwitchBronBron left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great. Thanks!

@TwitchBronBron
TwitchBronBron enabled auto-merge (squash) August 11, 2026 14:18
@TwitchBronBron
TwitchBronBron merged commit 29a4e44 into rokucommunity:master Aug 11, 2026
9 checks passed
TwitchBronBron added a commit that referenced this pull request Sep 9, 2026
The master->v1 merge kept v1's generic `LiteralExpression` component-name
visitor alongside master's new `CallExpression` visitor, but #197 had
*replaced* the former with the latter. Keeping both meant any bare string
literal matching a component name still counted as usage, which defeated
#197 and left the new test with nothing to report.

Also switch the test's `diagnosticFilters` from legacy numeric codes to the
human-readable string codes v1 now emits, so the expected CreateObject
errors are actually filtered out.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

Incorrect usage of CreateObject for component usage

2 participants