Skip to content

fix(scenegraph): report an alias field's own name in observer events - #1151

Merged
lvcabral merged 1 commit into
masterfrom
fix/alias-observer-event-fieldname
Aug 4, 2026
Merged

fix(scenegraph): report an alias field's own name in observer events#1151
lvcabral merged 1 commit into
masterfrom
fix/alias-observer-event-fieldname

Conversation

@lvcabral

@lvcabral lvcabral commented Aug 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • observeField()/observeFieldScoped() on an interface alias field cached the alias's target field name into the resulting roSGNodeEvent instead of the alias's own declared name, so GetField() on the delivered event returned the wrong value.
  • Apps that dispatch handling by comparing msg.GetField() against the alias's declared name (a common pattern for routing message-port events) would silently get misrouted to whatever handler matches the target field's name instead — producing behavior that diverges from a real Roku device, where the alias's own name is reported correctly.
  • Fix: Node.addObserver now uses the alias's own declared name (alias.aliasName) when present, falling back to the field's own name otherwise. One-line change in src/extensions/scenegraph/nodes/Node.ts.
  • Added a regression test fixture (test/cli/resources/alias-observer-event-app/) that observes an alias field via a message port and asserts the delivered event reports the alias's own name, plus a matching cli.test.js case.

Test plan

  • npm run lint — clean
  • npm run prettier:write — no unrelated changes
  • npm run build:cli && npm run build:sg
  • npx vitest run test/cli/cli.test.js -t "Alias" — new + existing alias tests pass
  • npm test — full suite: 200 files / 2541 tests passing, no regressions

🤖 Generated with Claude Code

observeField()/observeFieldScoped() on an interface alias field cached
the alias's target field name into the resulting roSGNodeEvent instead
of the alias's own declared name, so GetField() returned the wrong
value and misrouted apps that dispatch on it by name.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Aug 4, 2026

Copy link
Copy Markdown

@lvcabral
lvcabral merged commit dc6156e into master Aug 4, 2026
3 of 4 checks passed
@lvcabral
lvcabral deleted the fix/alias-observer-event-fieldname branch August 4, 2026 22:53
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.

1 participant