[Parked] Source/Consumer block relationship — reference branch for Jared#174
Draft
dconnenc wants to merge 1 commit into
Draft
[Parked] Source/Consumer block relationship — reference branch for Jared#174dconnenc wants to merge 1 commit into
dconnenc wants to merge 1 commit into
Conversation
Adds a "source" relationship type on ExperienceBlockLink alongside the existing "depends_on". A consumer block (e.g. FamilyFeud) can have many top-level blocks attached as sources, allowing those source blocks to be sequenced and broadcast independently of when the consumer runs. Backend - Migrations: add "source" to the relationship enum, drop the global unique constraint on child_block_id (sources can feed multiple consumers), add position column for ordering within a consumer. - ExperienceBlockLink: scopes + uniqueness scoped per relationship; cycle/depth/parent_id-sync gated to depends_on only. - ExperienceBlock: new sources/consumers associations; existing children/parents scoped to depends_on. - Orchestrator: add_block_with_dependencies! accepts source_block_ids; new attach_source!, detach_source!, reorder_sources! verbs; FamilyFeud lifecycle methods read from sources, not child_blocks. - Visibility: dag_metadata exposes source_block_ids, consumer_block_ids, and serialized sources. responded_participant_ids includes source responses for active consumers. - Routes/controller: /blocks/:id/sources endpoints; question-response broadcast finds FamilyFeud consumers via consumer_links. Frontend - Types: BlockLink.relationship adds 'source'; BaseBlock gets source_block_ids/consumer_block_ids/sources. - New Core/SourcesPanel with attach/detach/reorder + Storybook stories. - New useBlockSources hook. - EditBlock renders a SourcesPanel for FamilyFeud blocks. - FamilyFeudManager + EditBlockContext read from block.sources. Tests - Factory updates source attachment. - Spec updates: FamilyFeud open/close/hide no longer cascade to source questions (independent lifecycle by design). - 344 specs pass; tsc clean; storybook builds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 tasks
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.
Status: Draft, parked
This branch is a fully-working implementation of a Source/Consumer block model. It's pushed as a draft for context, not for merging. The simpler parent/child + flatten approach lives in #173 (block-lifecycle-decouple) — that's the one to review for the immediate need.
I'm posting this branch as reference in case the parent/child approach turns out to be limiting later, or to inform whatever direction GuessWho's overhaul takes.
Context (for @jared)
You mentioned that the original codebase had a graph-style model (variables + bindings) that you intentionally simplified down to parent/child because the upkeep wasn't paying off. When I came in not knowing that history, my first instinct was to build a Source/Consumer model — essentially the same direction you'd already moved away from.
After you flagged this, we changed course: I parked this branch and took your suggested path — try parent/child + ordering first, and only revisit the heavier model if friction shows up. That work is in #173.
The original requirements from the user were:
Requirement 1 is met by the parent/child + lifecycle-decouple approach in #173. Requirement 2 is already satisfied today through GuessWho's existing
slides[].block_idpayload references andParticipantSubmissions.for_user, which query all blocks regardless of nesting.What this branch contains
If we ever need cross-consumer reuse of source blocks (one Poll feeding both a FamilyFeud and a GuessWho simultaneously, surfaced in the UI), this branch has a working implementation:
Schema
sourceto theblock_link_relationshipenum onExperienceBlockLinkchild_block_idso a block can be linked from multiple consumerspositionfor ordering within a consumerBackend
sources/consumersassociations onExperienceBlock(scoped to thesourcerelationship; existingchildren/parentsstay scoped todepends_on)Orchestrator#attach_source!,#detach_source!,#reorder_sources!endpoints under/blocks/:id/sourcesstart_family_feud_playing!reads fromblock.sourcesrather thanblock.child_blocksFrontend
Core/SourcesPanel— pure presentational component with attach/detach/reorder, plus Storybook storiesuseBlockSourceshookTests
When this might be worth revisiting
For now, the simpler change in #173 is the recommended path.
🤖 Generated with Claude Code