Skip to content

feat(preference): add scope filtering to Filter struct and repository#1367

Merged
whoAbhishekSah merged 2 commits intomainfrom
feat/preference-scope-filter
Feb 4, 2026
Merged

feat(preference): add scope filtering to Filter struct and repository#1367
whoAbhishekSah merged 2 commits intomainfrom
feat/preference-scope-filter

Conversation

@whoAbhishekSah
Copy link
Member

@whoAbhishekSah whoAbhishekSah commented Feb 3, 2026

Summary

  • Add ScopeType and ScopeID fields to preference.Filter struct
  • Update repository List() to filter by scope (defaults to global when not specified)
  • Add unit tests for scope filtering behavior

Related: #1347

Details

This enables querying preferences by their scope, e.g., "get user X's preferences scoped to org Y".

When no scope is provided in the filter, defaults to global scope (app/platform + zero UUID) to maintain backward compatibility.

Test Plan

  • Unit tests pass: go test ./internal/store/postgres/... -run TestPreferenceRepository
  • E2E tests pass: make e2e-regression-test
  • Manual API verification:
    • Inserted org-scoped preference via SQL
    • Verified ListUserPreferences returns only global-scoped preferences (unchanged behavior)
    • Verified ListCurrentUserPreferences returns only global-scoped preferences (unchanged behavior)
    • Org-scoped preferences are correctly isolated from default API queries

🤖 Generated with Claude Code

Add ScopeType and ScopeID fields to the preference Filter struct to
enable querying preferences by their scope. The repository List method
now applies scope filtering, defaulting to global scope when not specified.

This enables queries like "get user X's preferences scoped to org Y".

- Add ScopeType/ScopeID to Filter struct
- Update List() to filter by scope (defaults to global)
- Add unit tests for scope filtering

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
frontier Ready Ready Preview, Comment Feb 3, 2026 11:08am

@coveralls
Copy link

coveralls commented Feb 3, 2026

Pull Request Test Coverage Report for Build 21627783205

Details

  • 13 of 13 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 38.186%

Totals Coverage Status
Change from base Build 21623958951: 0.2%
Covered Lines: 16046
Relevant Lines: 42021

💛 - Coveralls

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@whoAbhishekSah whoAbhishekSah merged commit 7e6fa82 into main Feb 4, 2026
7 checks passed
@whoAbhishekSah whoAbhishekSah deleted the feat/preference-scope-filter branch February 4, 2026 06:27
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.

3 participants