Skip to content

[refactor] Align observable subscriptions with node entity lifecycle - #1707

Open
minggangw wants to merge 3 commits into
RobotWebTools:developfrom
minggangw:fix-1706
Open

minggangw wants to merge 3 commits into
RobotWebTools:developfrom
minggangw:fix-1706

Conversation

@minggangw

Copy link
Copy Markdown
Member

No description provided.

Copilot AI balanced review requested due to automatic review settings November 28, 2026 15:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Completion callbacks now run synchronously during native-backed teardown, while tests cover only wrapper/subscription reentrancy, leaving node/context shutdown reentrancy needing human review and ROS runtime validation.

No open issues 🎉

What changed in this PR

Aligns RxJS observable subscriptions with rclnodejs’s node-owned entity lifecycle, so observable completion and destroyed state follow the underlying ROS 2 subscription.

Changes:

  • Adds a subscription subclass that completes its observable during entity finalization.
  • Shares subscription creation logic while preserving node registration and delegating wrapper destruction to the node.
  • Adds lifecycle regression tests and documents teardown, retry, and unsubscribe behavior.
File Description
types/​observable_subscription.d.ts Documents ownership, destroyed state, and completion semantics.
types/​node.d.ts Documents observable completion on subscription or node destruction.
test/​test-observable-subscription.js Adds registration, teardown, finalization, and destruction-retry coverage.
lib/​subscription.js Allows the subscription factory to instantiate subclasses.
lib/​observable_subscription.js Moves observable ownership into the subscription entity and delegates wrapper lifecycle operations.
lib/​node.js Extracts shared creation logic and registers observable subscription entities.

Review effort: Balanced

@coveralls

coveralls commented Nov 28, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 91.449% (+0.09%) from 91.358% — minggangw:fix-1706 into RobotWebTools:develop

minggangw and others added 2 commits November 29, 2026 14:54
Reject creation and dispatch during teardown, preserve cleanup retries, and cover generic finalizer reentrancy independently of observable subscriptions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep the node's owning context live while forcing real native startup failure through an uninitialized context. Verify failed starts preserve stopped state and can recover without weakening teardown guards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

3 participants