Skip to content

feat: add searchSourcePosts query for squad text search#3996

Merged
rebelchris merged 1 commit into
mainfrom
feat/squad-post-search
Jul 10, 2026
Merged

feat: add searchSourcePosts query for squad text search#3996
rebelchris merged 1 commit into
mainfrom
feat/squad-post-search

Conversation

@rebelchris

Copy link
Copy Markdown
Contributor

What

New GraphQL query for text-searching posts within a single source (squad), powered by the existing Mimir integration:

searchSourcePosts(
  source: ID!
  query: String!
  first: Int
  after: String
  supportedTypes: [String!]
  version: Int = 2
): PostConnection!

How

  • Permissions first: ensureSourcePermissions(ctx, source) runs before any Mimir call — private squads throw FORBIDDEN for anonymous users and non-members, same gate as sourceFeed.
  • Mimir request: StringListFilter on source_id, plus explicit BoolFilters for deleted = false, visible = true, banned = false. These must be explicit because Mimir only injects its safety defaults when a request carries no filters.
  • No private = false filter (unlike searchPosts): the permission check already gates access, and squad members must be able to find their private squad's posts.
  • Hydration: sibling resolver to mimirSearchResolver with allowPrivatePosts: true, removeHiddenPosts: true, removeBannedPosts: false, removeNonPublicThresholdSquads: false — mirroring sourceFeed's scoped-source rationale. Results preserve Mimir's ranked order via fixedIdsFeedBuilder.
  • Zod validation for source/query in src/common/schema/search.ts.

Tests

6 new tests in __tests__/search.ts (Mimir mocked via proto-typed SearchResponse instances):

  • public squad returns hydrated posts in Mimir ranked order
  • private squad: anonymous → FORBIDDEN, non-member → FORBIDDEN, member → succeeds
  • constructed SearchRequest contains the source_id filter, omits private=false, includes the three safety filters
  • pagination offset math from first/after

Full search suite: 42/42 passing. Lint and build clean.

Deploy order

Merge/deploy after the mimir index PR and before the apps PR. Related PRs linked in a comment below.

🤖 Generated with Claude Code

Adds a Mimir-powered searchSourcePosts GraphQL query that searches posts
within a single source (squad). Permission is gated via
ensureSourcePermissions before any Mimir call so private squads stay
private. The Mimir request scopes results with a source_id filter and,
since sending any filter suppresses Mimir's own safety defaults, explicitly
adds deleted/visible/banned filters instead of the private=false filter used
by searchPosts (members must be able to find private squad posts).
@pulumi

pulumi Bot commented Jul 10, 2026

Copy link
Copy Markdown

🍹 The Update (preview) for dailydotdev/api/prod (at 739695f) was successful.

Resource Changes

    Name                                                       Type                           Operation
~   vpc-native-channel-highlights-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-images-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-worker-job-deployment                           kubernetes:apps/v1:Deployment  update
~   vpc-native-clean-zombie-users-cron                         kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-deployment                  kubernetes:apps/v1:Deployment  update
~   vpc-native-user-profile-analytics-clickhouse-cron          kubernetes:batch/v1:CronJob    update
~   vpc-native-update-highlighted-views-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tag-materialized-views-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-check-analytics-report-cron                     kubernetes:batch/v1:CronJob    update
~   vpc-native-post-lifecycle-state-clickhouse-cron            kubernetes:batch/v1:CronJob    update
~   vpc-native-squad-posts-analytics-refresh-cron              kubernetes:batch/v1:CronJob    update
+   vpc-native-api-db-migration-8e5b54a6                       kubernetes:batch/v1:Job        create
~   vpc-native-clean-channel-highlights-cron                   kubernetes:batch/v1:CronJob    update
~   vpc-native-daily-digest-cron                               kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-zombie-user-companies-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-subscription-anniversary-achievements-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-achievements-cron                kubernetes:batch/v1:CronJob    update
~   vpc-native-generate-search-invites-cron                    kubernetes:batch/v1:CronJob    update
~   vpc-native-deployment                                      kubernetes:apps/v1:Deployment  update
~   vpc-native-calculate-top-readers-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-generic-referral-reminder-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-expired-better-auth-sessions-cron         kubernetes:batch/v1:CronJob    update
~   vpc-native-post-analytics-clickhouse-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-personalized-digest-cron                        kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-analytics-history-clickhouse-cron  kubernetes:batch/v1:CronJob    update
~   vpc-native-validate-active-users-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-update-tags-str-cron                            kubernetes:batch/v1:CronJob    update
~   vpc-native-sync-subscription-with-cio-cron                 kubernetes:batch/v1:CronJob    update
-   vpc-native-api-db-migration-f40ae263                       kubernetes:batch/v1:Job        delete
~   vpc-native-update-current-streak-cron                      kubernetes:batch/v1:CronJob    update
~   vpc-native-bg-deployment                                   kubernetes:apps/v1:Deployment  update
~   vpc-native-temporal-deployment                             kubernetes:apps/v1:Deployment  update
~   vpc-native-update-achievement-rarity-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-user-profile-updated-sync-cron                  kubernetes:batch/v1:CronJob    update
~   vpc-native-clean-stale-user-transactions-cron              kubernetes:batch/v1:CronJob    update
~   vpc-native-channel-digests-cron                            kubernetes:batch/v1:CronJob    update
+   vpc-native-api-clickhouse-migration-8e5b54a6               kubernetes:batch/v1:Job        create
~   vpc-native-materialize-yearly-best-post-archives-cron      kubernetes:batch/v1:CronJob    update
~   vpc-native-private-deployment                              kubernetes:apps/v1:Deployment  update
-   vpc-native-api-clickhouse-migration-f40ae263               kubernetes:batch/v1:Job        delete
~   vpc-native-ws-deployment                                   kubernetes:apps/v1:Deployment  update
... and 15 other changes

@rebelchris

Copy link
Copy Markdown
Contributor Author

Related PRs (deploy in this order):

  1. dailydotdev/mimir#47 — source_id index migration
  2. feat: add searchSourcePosts query for squad text search #3996searchSourcePosts GraphQL query
  3. feat: add in-squad post search apps#6301 — squad page search UI

@rebelchris rebelchris merged commit 678f889 into main Jul 10, 2026
9 checks passed
@rebelchris rebelchris deleted the feat/squad-post-search branch July 10, 2026 12:53
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.

1 participant