Skip to content

feat: exclude AIB / bots-only tournaments from consumer view feed#5002

Open
aseckin wants to merge 6 commits into
mainfrom
claude/issue-2605-duplicate-looking-questions-in-search-in
Open

feat: exclude AIB / bots-only tournaments from consumer view feed#5002
aseckin wants to merge 6 commits into
mainfrom
claude/issue-2605-duplicate-looking-questions-in-search-in

Conversation

@aseckin

@aseckin aseckin commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #2605.

Summary

AIB (bots-only) tournament questions are typically cross-posted into a human-facing tournament (e.g. Metaculus Cup), which produces duplicate-looking search results in consumer view. This PR excludes them from filter_for_consumer_view using the existing Project.bot_leaderboard_status == BOTS_ONLY marker — the same signal the comment feed already uses (see comments/services/feed.py:104-107).

Using the flag rather than a hard-coded project id means new quarterly AIB tournaments (aibq5, aibq6, …) are automatically covered.

Test plan

  • Search for a cross-posted AIB question in consumer view — only the human-facing copy appears.
  • Consumer feed no longer surfaces AIB-only posts.
  • Direct link to an AIB question still loads (filter is feed-scoped).
  • Non-consumer (forecaster) feed is unchanged.

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved consumer-view filtering behavior for search when only text search is provided, so the correct filtering is no longer skipped.
    • Search-based consumer-view feeds now relax certain curation constraints, allowing resolved questions to appear when appropriate.
    • Consumer-view feeds now consistently exclude posts associated with bots-only leaderboard status.

…nsumer feed

AIB (bots-only) questions are typically cross-posted in a human-facing
tournament (e.g. Metaculus Cup), which produces duplicate-looking search
results in the consumer view (issue #2605). Filter them out of
`filter_for_consumer_view` using `Project.bot_leaderboard_status == BOTS_ONLY`
— the same semantic marker the comment feed already uses to hide AIB-only
comments (comments/services/feed.py:104-107). Using the flag instead of a
hard-coded project id automatically covers each new quarterly AIB tournament.

Co-authored-by: aseckin <3686968+aseckin@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f1b1cfee-8bd2-497e-ad36-cf2e3977838e

📥 Commits

Reviewing files that changed from the base of the PR and between 06e2bc8 and f72e420.

📒 Files selected for processing (1)
  • posts/services/feed.py

📝 Walkthrough

Walkthrough

Backend consumer-view filtering now receives search context, relaxes curation constraints during searches, and always excludes posts from bots-only projects. Frontend feed filter detection no longer treats text search as an explicit feed filter, changing when for_consumer_view is applied.

Changes

Consumer view filtering

Layer / File(s) Summary
Backend consumer-view filter changes
posts/services/feed.py
get_posts_feed passes is_search=bool(search) to filter_for_consumer_view; search requests skip the curation block, while posts from projects with bot_leaderboard_status=BOTS_ONLY are always excluded.
Frontend explicit filter detection
front_end/src/app/(main)/questions/helpers/filters.ts
EXPLICIT_FEED_FILTER_KEYS no longer includes POST_TEXT_SEARCH_FILTER, changing when hasExplicitFeedFilter is true and for_consumer_view is applied for text-only searches.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hopped through search results bright,
While bots-only posts vanished from sight. 🐇
Search context guides the feed’s stride,
And text filters change the consumer side.
Hop, hop, hooray!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: excluding bots-only/AIB questions from consumer-view feed results.
Linked Issues check ✅ Passed The PR implements the requested consumer-view exclusion for AIB bots-only questions while preserving the broader issue scope.
Out of Scope Changes check ✅ Passed The frontend search-parameter tweak is directly tied to consumer-view search behavior, so it is in scope.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/issue-2605-duplicate-looking-questions-in-search-in

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Environment

Your preview environment is ready!

Resource Details
🌐 Preview URL https://metaculus-pr-5002-claude-issue-2605-duplicate-lo-preview.mtcl.cc
📦 Docker Image ghcr.io/metaculus/metaculus:claude-issue-2605-duplicate-looking-questions-in-search-in-f72e420
🗄️ PostgreSQL NeonDB branch preview/pr-5002-claude-issue-2605-duplicate-lo
Redis Fly Redis mtc-redis-pr-5002-claude-issue-2605-duplicate-lo

Details

  • Commit: 533e76f40af6e2a4fe4c915f0cdcb440f3740478
  • Branch: claude/issue-2605-duplicate-looking-questions-in-search-in
  • Fly App: metaculus-pr-5002-claude-issue-2605-duplicate-lo

ℹ️ Preview Environment Info

Isolation:

  • PostgreSQL and Redis are fully isolated from production
  • Each PR gets its own database branch and Redis instance
  • Changes pushed to this PR will trigger a new deployment

Limitations:

  • Background workers and cron jobs are not deployed in preview environments
  • If you need to test background jobs, use Heroku staging environments

Cleanup:

  • This preview will be automatically destroyed when the PR is closed

@aseckin

aseckin commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@claude search results in consumer view still display questions from the AIB tournament

@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aseckin's task in 2m 9s —— View job


Root cause found and fixed

  • Read current posts/services/feed.py PR diff
  • Trace how consumer search wires up (does it use filter_for_consumer_view?)
  • Confirm root cause and apply fix

The AIB exclusion in this PR is correct — the bug is that filter_for_consumer_view was never getting applied to search queries in the first place.

What was happening

In front_end/src/app/(main)/questions/helpers/filters.ts:

  • EXPLICIT_FEED_FILTER_KEYS included POST_TEXT_SEARCH_FILTER (line 89).
  • On line 114, hasExplicitFeedFilter was set true whenever any of those keys was present in the URL.
  • On line 201, filters.for_consumer_view = filterForConsumerView.toString() was only assigned when !hasExplicitFeedFilter.

So the moment a consumer‑view user typed anything in search, the for_consumer_view=true param was dropped from the API call. The backend then skipped filter_for_consumer_view(qs) in posts/services/feed.py:72-73, and search happily returned AIB posts, resolved posts, CP‑hidden posts, and non‑programs/research notebooks.

Fix

Removed POST_TEXT_SEARCH_FILTER from EXPLICIT_FEED_FILTER_KEYS. Consumer view reflects the user's role (user.interface_type === ConsumerView), not a browsing mode — searching should not disable it.

This preserves the existing "search across everything" behavior for other explicit filters and for for_main_feed (which uses its own !search && !ids check on line 172).

Commit: 0b8557b

Manual test plan

  • As a consumer‑view user, search for an AIB question title — only the human‑facing cross‑post appears.
  • Search for a resolved question — hidden, per consumer view rules.
  • As a forecaster (non‑consumer), search still returns all posts.
  • Non‑search filtering behaviour unchanged.
    · Branch

Text search was in EXPLICIT_FEED_FILTER_KEYS, so any search set
hasExplicitFeedFilter=true and dropped for_consumer_view from the API
call. That bypassed filter_for_consumer_view on the backend, letting
AIB, resolved, and CP-hidden posts appear in search results for
consumer-view users.

Consumer view is a role-based constraint (user.interface_type ===
ConsumerView), not a browsing mode — searching shouldn't unset it.

Co-authored-by: aseckin <3686968+aseckin@users.noreply.github.com>
@claude claude Bot temporarily deployed to testing_env July 8, 2026 13:36 Inactive
@claude claude Bot temporarily deployed to testing_env July 8, 2026 13:36 Inactive
@aseckin

aseckin commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

@claude searching in consumer view should still return resolved questions

@claude

claude Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Claude finished @aseckin's task in 1m 6s —— View job


Done — resolved posts now included in consumer-view search

  • Read filter_for_consumer_view to see how it excludes resolved posts
  • Trace how search plumbs for_consumer_view into the backend
  • Decide where to bypass the resolved-exclusion during search
  • Implement + push

Change

filter_for_consumer_view unconditionally called qs.exclude(resolved=True) on line 374, so consumer‑view search hid any question the moment it resolved.

filter_for_consumer_view now takes an include_resolved flag, and get_posts_feed passes include_resolved=bool(search) — the resolved exclusion is skipped only when the request is a text search. All other consumer‑view feed paths (main feed, browse, homepage) still hide resolved posts as before.

Commit: 4dda2f0

Manual test plan

  • As a consumer‑view user, search for a title of a resolved question — it appears in results.
  • Consumer‑view feed (no search) still hides resolved posts.
  • AIB / bots‑only exclusion (from the earlier commit) still applies during search.
  • Non‑consumer (forecaster) search unchanged.
    · Branch

When a user is searching in consumer view they should still be able to
find questions by title regardless of resolution state — otherwise a
question they remember reading about disappears the moment it resolves.

Co-authored-by: aseckin <3686968+aseckin@users.noreply.github.com>
@aseckin aseckin requested a review from hlbmtc July 8, 2026 14:36
@aseckin aseckin marked this pull request as ready for review July 8, 2026 14:36
Comment thread posts/services/feed.py
Consumer view hid notebooks outside programs/research, CP-pending
questions and resolved questions from search, not just from the feed.
Those filters curate what we offer someone browsing; when the user is
searching they are looking up something specific, so they only produce
dead ends. In practice the notebook filter was mostly hiding Metaculus'
own editorial content (Pathways, Journal, meta, platform) from search.

Replace include_resolved with an is_search flag that relaxes all three.
The bots-only exclusion is a dedupe rather than curation — those posts
are cross-posted into a human-facing project — so it now always applies,
keeping the #2605 fix intact under search.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.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.

Duplicate-looking questions in search in consumer view (AIB)

2 participants