Skip to content

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

Open
aseckin wants to merge 4 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 4 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
    • Search results now preserve consumer-view filtering more consistently when only text search is used.
    • Resolved questions can now appear in search-based feed views when appropriate, instead of being hidden in all cases.
    • Posts from tournaments marked as bots-only are no longer excluded from consumer-view feeds in the same way as before.

…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: 4a605b15-fcf2-4477-a782-54078e4cac81

📥 Commits

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

📒 Files selected for processing (2)
  • front_end/src/app/(main)/questions/helpers/filters.ts
  • posts/services/feed.py
💤 Files with no reviewable changes (1)
  • front_end/src/app/(main)/questions/helpers/filters.ts

📝 Walkthrough

Walkthrough

Backend consumer-view filtering now accepts an include_resolved flag, applied when a search term is present, and additionally excludes posts from tournaments marked bots-only. 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 logic
posts/services/feed.py
filter_for_consumer_view gains an include_resolved parameter (default False), conditionally excludes resolved questions instead of always excluding them, and now excludes posts whose default project has bot_leaderboard_status=BOTS_ONLY; get_posts_feed passes include_resolved=bool(search).
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 thus when for_consumer_view is applied for text-only searches.

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

Suggested reviewers: hlbmtc

Poem

A rabbit hopped through search results wide,
Found bots-only twins it could now hide. 🐇
Resolved or not, the flag decides,
Text search now takes filters in stride.
Hop, hop, hooray—cleaner feeds arrive!

🚥 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 matches the main change: excluding bots-only/AIB tournaments from the consumer-view feed.
Linked Issues check ✅ Passed The PR addresses #2605 by suppressing bots-only/AIB posts in consumer-view search and keeping search behavior aligned.
Out of Scope Changes check ✅ Passed The additional search and resolved-post filter adjustments support the same consumer-view behavior and appear 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-06e2bc8
🗄️ 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: d9d8f4152b740e607c64bf59548c20d98e22ac29
  • 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
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)

1 participant