Skip to content

fix(player): own connection and media resources#2152

Merged
jrusso1020 merged 1 commit into
mainfrom
07-10-fix_player_own_connection_media_resources
Jul 13, 2026
Merged

fix(player): own connection and media resources#2152
jrusso1020 merged 1 commit into
mainfrom
07-10-fix_player_own_connection_media_resources

Conversation

@jrusso1020

@jrusso1020 jrusso1020 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

What

Make Player connection resources symmetric and scope slideshow media ownership.

Why

Reconnect could retain destroyed handles, while slideshow operations scanned and mutated unrelated document media.

How

Null and recreate connection-owned resources idempotently and introduce an OwnedMediaRegistry with abortable cleanup.

Test plan

  • Player reconnect, media-scope, slideshow, and owned-media registry tests
  • Stack-wide lint, format, build, typecheck, and relevant integration gates

jrusso1020 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch from 601af15 to ab96a94 Compare July 11, 2026 18:11
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch 2 times, most recently from 7bb3529 to a9f9e40 Compare July 11, 2026 18:16
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch from ab96a94 to 720a1ed Compare July 11, 2026 18:16
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch 2 times, most recently from cb38f96 to 5b28eec Compare July 12, 2026 04:01
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch 2 times, most recently from 1fcffa3 to e7cec75 Compare July 12, 2026 04:32
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch 2 times, most recently from 9c7bf71 to d0969c4 Compare July 12, 2026 04:58
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch from 8eca5d7 to aeca7e3 Compare July 12, 2026 08:54
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch 2 times, most recently from 29caf12 to b6a53a4 Compare July 12, 2026 09:11
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch 2 times, most recently from 7b49c3c to b720c3f Compare July 13, 2026 15:52
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch from b6a53a4 to 65c4a72 Compare July 13, 2026 15:52
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch from b720c3f to edd75b5 Compare July 13, 2026 17:29
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch from 65c4a72 to d80edef Compare July 13, 2026 17:29
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_core_preserve_runtime_transport_contract branch from edd75b5 to cc3ca2f Compare July 13, 2026 18:09
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch from d80edef to 0220c21 Compare July 13, 2026 18:09
Base automatically changed from 07-10-fix_core_preserve_runtime_transport_contract to main July 13, 2026 18:34
@jrusso1020 jrusso1020 force-pushed the 07-10-fix_player_own_connection_media_resources branch from 0220c21 to 16942c0 Compare July 13, 2026 18:35

@james-russo-rames-d-jusso james-russo-rames-d-jusso 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.

Clean ownership boundary — OwnedMediaRegistry replaces the fragile dataset.hfSlideshowMediaSync marker with AbortController-per-binding, and the 10-cycle reconnect test pins the idempotence contract cleanly. The el.ownerDocument.defaultView?.AbortController ?? AbortController fallback for cross-realm iframe media is a nice touch.

Nits

  • packages/player/src/slideshow/hyperframes-slideshow.ts:1170stopDocumentMedia now stops only owned media, not document-wide. The name is left over from the old ownerDocument.querySelectorAll implementation. Consider stopOwnedMedia (or similar) to match the registry's actual scope. Trivial; ignore if you'd rather keep the internal API stable.
  • packages/player/src/slideshow/hyperframes-slideshow.ts:1163-1174updateMutedState and stopDocumentMedia both call ownedMedia.sync(...) directly instead of routing through wireSlideshowMedia(). If a new element gets picked up by updateMutedState's call, its initial mute state is applied by the immediately-following setMuted(muted) (bounded set, single-threaded — safe), but the added-mute path from wireSlideshowMedia is duplicated. Consistent as-is; flagging in case you'd rather have one entry point.

What I didn't verify

  • Cross-realm AbortController behavior in Firefox / older Safari — trusting the pattern generalizes to your target matrix.
  • Whether any consumer outside packages/player relied on the old page-wide mute/pause semantics of <hyperframes-slideshow>. Workspace grep turned up none; the PR body explicitly calls the scope reduction a fix.

Review by Rames D Jusso

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Independent bottom-layer review on 16942c0c.

  • Reconnect teardown/recreation is symmetric for controls and parent media (packages/player/src/hyperframes-player.ts:179, :192).
  • The registry uses owner-realm AbortControllers and aborts removed/disconnected bindings (packages/player/src/slideshow/owned-media-registry.ts:35, :46, :67).
  • Scope tests cover two slideshows plus unrelated page media (packages/player/src/slideshow/hyperframes-slideshow.test.ts:397).

Rames already covered the naming/entry-point nits; I found no additional correctness gap. Current required checks are green.

Verdict: APPROVE
Reasoning: Resource ownership is bounded to the component, teardown is deterministic, and reconnect/scope regressions are directly tested.

— Home

jrusso1020 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

Merge activity

  • Jul 13, 8:14 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jul 13, 8:15 PM UTC: @jrusso1020 merged this pull request with Graphite.

@jrusso1020 jrusso1020 merged commit e523a29 into main Jul 13, 2026
45 checks passed
@jrusso1020 jrusso1020 deleted the 07-10-fix_player_own_connection_media_resources branch July 13, 2026 20:15

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-reviewed the merged head 16942c0c12fab7e87876fa253432e29d85835db4. There is no new code delta since my approval, and the completed required checks are green. I found no post-merge correctness issue. The earlier naming / duplicate sync-entry-point notes remain optional cleanup only.

Verdict: COMMENT (post-merge: Ready)
Reasoning: Same approved head, green required CI, and no newly discovered blocker.
— Magi

@miguel-heygen miguel-heygen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Final freshness check on merged head 16942c0c12fab7e87876fa253432e29d85835db4.

The reviewed commit is unchanged, the player-ownership boundary remains clean, and the complete required check set is green. No post-merge regression or new review finding surfaced.

Verdict: COMMENT (post-merge ready)
Reasoning: The merged implementation remains sound and fully green; there is no actionable follow-up from this pass.

— Deepwork

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