Skip to content

fix(renderer): the first play after a launch reads the seeding switch - #31

Closed
SovereignTechnology wants to merge 1 commit into
mainfrom
fix/seed-switch-first-play
Closed

SovereignTechnology wants to merge 1 commit into
mainfrom
fix/seed-switch-first-play

Conversation

@SovereignTechnology

@SovereignTechnology SovereignTechnology commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

"Seed what you watch" was ignored after every launch or page reload.

SeedPublish (packages/renderer/src/seeding/controller.ts) started with watched: false and only asked the worker for the switch once something was already being served or Settings was opened. onPlay returned early on that starting value, so the first play after a launch was never stored or seeded, whatever the worker's seeding.json said.

Found by the real-host proof (draft #30): the installed app played a video over the public HyperDHT with the switch on, then published no beacon in about 36 minutes, so a fresh nutflix-pear fetcher had nobody to fetch from.

Fix: the controller remembers whether it has read the switch. A play before that asks the worker first, then hands the play over if the switch is on. A launch with nothing played still sends the worker no request (the existing "asks the worker nothing until it is told something is served" test is unchanged).

Tests (packages/renderer/src/__tests__/seeding.test.ts), on a fresh controller that has read nothing:

  • switch on: the first play reads the status, then is handed over with its signed manifest;
  • switch off: the status is read and nothing is handed over;
  • a switch already read is not asked for again.

The existing on/off tests read the status before the play, which is why they never caught this.

Summary by CodeRabbit

  • Bug Fixes
    • Playback now checks the current seeding setting before starting a watch. When seeding is disabled, playback proceeds without starting one; when enabled, playback starts with the required session information.
    • The setting is reused for later plays instead of being checked repeatedly, and successful watch requests refresh the status. This keeps playback behavior aligned with the latest seeding setting.

"Seed what you watch" was ignored after every launch or page reload. The
controller started with `watched: false` and only asked the worker once
something was already served or Settings was open, so `onPlay` returned
early and the first play was never stored or seeded, whatever the
worker's switch said. Found by the real-host proof: the installed app
played a video over the public DHT, then published no beacon in 36 min.

The controller now remembers whether it has read the switch. A play
before that asks the worker first; a launch with nothing played still
sends it no request. Three tests cover a fresh controller: on (the play
is handed over), off (nothing is), and a switch already read (not asked
again).
@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

SeedPublish now reads worker seeding status before deciding whether to hand off the first play. It tracks whether status has been adopted, and tests cover enabled, disabled, and cached status cases.

Changes: Seeding status and play handoff

Layer / File(s) Summary
Status-gated play handoff
packages/renderer/src/seeding/controller.ts, packages/renderer/src/__tests__/seeding.test.ts
SeedPublish reads worker status before the first play handoff and requests seeding.watch only when watched is true. It caches whether status has been adopted. Tests cover enabled and disabled status, and verify that later plays do not request status again after refreshSeeding reads it.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to e3d90

This change makes the first play after a launch or reload read the worker's seeding switch before deciding whether to hand the play over. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the actual fix: the first play after a launch now reads the seeding switch before deciding whether to hand the play over. The change adds status tracking to SeedPublish.onPlay, and the…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the actual fix: the first play after a launch now reads the seeding switch before deciding whether to hand the play over. The change adds status tracking to SeedPublish.onPlay, and the tests cover that first-play path. The title uses the conventional fix(renderer) prefix and is specific enough for a reviewer scanning history.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Automatic approval policy

Commit: e3d90652d193.

Setting Effective value Source
Automatic approvals Enabled Global configuration
Merge risk Minimal Global configuration
Security risk Not set Global configuration

Not set means no limit was configured after inheritance. Use @coderabbitai configuration to inspect the resolved settings and their sources.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Central YAML; Path: .coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6f5189b7-5470-4720-a54d-41c99c2e6149
Commits

Reviewing files that changed from the base of the PR and between c6af5c5 and e3d9065.

Files selected for processing: 2

  • packages/renderer/src/__tests__/seeding.test.ts
  • packages/renderer/src/seeding/controller.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@sovtechpro sovtechpro Bot added the size/M Lines changed by this pull request: M (sovtechpro[bot]) label Nov 26, 2026
@SovereignTechnology
SovereignTechnology marked this pull request as ready for review November 26, 2026 13:04
SovereignTechnology added a commit that referenced this pull request Nov 26, 2026
…#31)

"Seed what you watch" was ignored after every launch or page reload. The
controller started with `watched: false` and only asked the worker once
something was already served or Settings was open, so `onPlay` returned
early and the first play was never stored or seeded, whatever the
worker's switch said. Found by the real-host proof: the installed app
played a video over the public DHT, then published no beacon in 36 min.

The controller now remembers whether it has read the switch. A play
before that asks the worker first; a launch with nothing played still
sends it no request. Three tests cover a fresh controller: on (the play
is handed over), off (nothing is), and a switch already read (not asked
again).
@SovereignTechnology

Copy link
Copy Markdown
Owner Author

Squash-merged locally as a9d7805 (CI green on e3d9065, CodeRabbit approved).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Lines changed by this pull request: M (sovtechpro[bot])

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant