docs: design forager.media.categorize multi-faceted nested grouping#70
Draft
andykais-claude wants to merge 1 commit into
Draft
docs: design forager.media.categorize multi-faceted nested grouping#70andykais-claude wants to merge 1 commit into
andykais-claude wants to merge 1 commit into
Conversation
Co-authored-by: andykais-claude <andykais-claude@users.noreply.github.com>
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.
Summary
Adds a design doc (
docs/design/media-categorize.md) for a new@forager/coreaction,forager.media.categorize. This is a generalization of the existingforager.media.group:tag_group, date facets (source_created_at,created_at,updated_at,last_viewed_at) bucketed byyear/month/day/hour/minute, andstars.remainderbucket per split for media that doesn't match any split value.queryfilter surface asforager.media.search/forager.media.group.forager.media.group(kept around for back-compat in this PR).No code changes — design only. Implementation will land in a follow-up PR after design approval.
Concerns called out for discussion
The doc has a dedicated Concerns & Open Questions section. Highlights:
media.groupcountsmedia_reference_tagrows, which inflates counts when a media reference has multiple tags in the same group. I'm proposingcategorizeswitches toCOUNT(DISTINCT media_reference.id)since it's a new API, but want your call.by(by: { month: '2025/02' }). I'm proposing a cleaner split wherebystays as the granularity andvaluecarries the bucketed string ({ split: 'source_created_at', by: 'month', value: '2025/02' }). Calling out the deviation.tag_groupsplits cause Cartesian blowups. Will warn at runtime but not block.by: 'minute'over years of history). Paginates correctly but flagged for awareness.starsgranularity — currently one bucket per integer; schema is forward-compatible with optional range buckets later.Testing
Design doc only — no executable changes to test. Test plan is included in the doc (10 cases covering single/nested splits, every date
by, remainder semantics,queryfilter composition, pagination, sort orders, andcategorized_media).