Skip to content

docs: design forager.media.categorize multi-faceted nested grouping#70

Draft
andykais-claude wants to merge 1 commit into
mainfrom
cursor/design-media-categorize-b829
Draft

docs: design forager.media.categorize multi-faceted nested grouping#70
andykais-claude wants to merge 1 commit into
mainfrom
cursor/design-media-categorize-b829

Conversation

@andykais-claude

Copy link
Copy Markdown
Collaborator

Summary

Adds a design doc (docs/design/media-categorize.md) for a new @forager/core action, forager.media.categorize. This is a generalization of the existing forager.media.group:

  • Multiple split types: tag_group, date facets (source_created_at, created_at, updated_at, last_viewed_at) bucketed by year / month / day / hour / minute, and stars.
  • Arbitrarily nested splits (Cartesian product of buckets).
  • Opt-in remainder bucket per split for media that doesn't match any split value.
  • Same query filter surface as forager.media.search / forager.media.group.
  • Deprecation plan for 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:

  1. Counting semantics for tag_group splits. Today's media.group counts media_reference_tag rows, which inflates counts when a media reference has multiple tags in the same group. I'm proposing categorize switches to COUNT(DISTINCT media_reference.id) since it's a new API, but want your call.
  2. Date bucket value placement. The user's example put the bucket value inside by (by: { month: '2025/02' }). I'm proposing a cleaner split where by stays as the granularity and value carries the bucketed string ({ split: 'source_created_at', by: 'month', value: '2025/02' }). Calling out the deviation.
  3. Multiple tag_group splits cause Cartesian blowups. Will warn at runtime but not block.
  4. Pagination over deeply nested splits can produce millions of leaves with bad inputs (e.g. by: 'minute' over years of history). Paginates correctly but flagged for awareness.
  5. stars granularity — currently one bucket per integer; schema is forward-compatible with optional range buckets later.
  6. Web UI migration is out of scope for the implementation PR.

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, query filter composition, pagination, sort orders, and categorized_media).

Open in Web Open in Cursor 

Co-authored-by: andykais-claude <andykais-claude@users.noreply.github.com>
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.

2 participants