feat(sessions): un-stub Manual TrackSource via shared write sink#51
Open
mads-jm wants to merge 1 commit into
Open
feat(sessions): un-stub Manual TrackSource via shared write sink#51mads-jm wants to merge 1 commit into
mads-jm wants to merge 1 commit into
Conversation
The 'manual' arm of useTrackSource was a no-op (useTrackSource.ts:322), so a session could only be sourced from a Spotify Premium coordinator. Add a source-agnostic normalize->write sink (addIncomingTrack) shared with the Spotify path, expose a functional addTrack from the hook for manual sessions, and add an AddTrackPanel affordance (manual entry + local-library search) to SessionView. Turn advancement stays derived (computeEffectiveTurn) to avoid the advanceTurn double-fire race. P2P arm (#38) remains a no-op (out of scope).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Short Description
Un-stubs the Manual TrackSource (it was a no-op at
useTrackSource.ts:322) by routing it through a new shared normalize→write sink, so a manually-entered track now actually lands in the playlist with correct attribution and source provenance. The P2P TrackSource stays a deliberate no-op — that's #38, a separate P2P-gated lane.Background
This is the renderer-cluster predecessor for Wave 2/3 (#43 turn coordination, #50 SessionView extraction, #26 CRUD tests). The point of doing it first is the sink:
track-sink.tsis the single place that normalizes an incoming track (manual, and later P2P) into a canonical record and appends it, so the later lanes build on a fixed contract instead of negotiating one live. The hook wrapper stays intentionally thin — all the load-bearing logic lives in the sink, where it's testable without a React/RxDB harness.What Has Changed
track-sink.ts(new) — normalize→createTrack→addTrackToPlaylistwith attribution (addedBy) and source provenance; Spotify-onlyexternalId→spotifyIdmapping,localFilePathpassthrough, deterministic create-then-append orderuseTrackSource.ts— the'manual'branch calls the sink instead of returning a no-op;'p2p'remains a no-op by design (out of scope)AddTrackPanel.tsx(new) +SessionView.tsx— the manual add affordance and its wiringsession-interfaces.ts— types for the sink inputtrack-sink.test.ts(new, 5 cases) — attribution, source provenance,externalId→spotifyId,localFilePathpassthrough, create→append orderingSteps for Reviewing
track-sink.ts— this is the contract Wave 2/3 will consume; judge it as load-bearing API, not a one-off.useTrackSource.ts: confirm'manual'now writes and'p2p'is still a no-op (scope was feat(sessions): un-stub Manual TrackSource #37 only). ✅ inspector verified no P2P TrackSource code presentcd app && npm run test— 191 pass incl. the 5 new sink tests. ✅ independently re-run by inspectorChecklist
node_modules/vite.config.tstsc errors are a pre-existing base baseline)chore/fix-dev-env-lint; changed files were lint-validated via a temporary.mjsconfigCloses #37
Comments
Carry-forwards (non-blocking, for a later cycle):
AddTrackPanel+ theuseTrackSource.addTrackwrapper are untested — the repo has no React/hook test harness; the load-bearing normalization is fully covered intrack-sink.test.ts.Merging this first unblocks Wave 2 (#43, #39).