Skip to content

perf(posts): scan authorized filter sources once - #1182

Open
seonghobae wants to merge 2 commits into
mainfrom
codex/post-filter-options-db-scan-20261019
Open

seonghobae wants to merge 2 commits into
mainfrom
codex/post-filter-options-db-scan-20261019

Conversation

@seonghobae

@seonghobae seonghobae commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Change

Compute Board filter choices from one materialized, authorized eligible-Post set. The two option categories retain current Voice assignments and the primary-Voice fallback, lookup labels, ordering, and ABAC scope. ADR 0212 receives an explicit amendment for this query shape. No API, schema, release number, or numerical weight changes.

Observed bottleneck

On the canonical synthetic Compose stack, authenticated k6 HTTP runs reached 15.58 requests/s at 4 VUs (p95 906 ms) and 17.81 requests/s at up to 12 VUs (p95 2.38 s), with zero HTTP failures. PostgreSQL reached about 406% CPU while the worker, Valkey, and gateway remained much lower. A separate authorized Board read took about 936 ms; Lineage took about 67 ms. This identifies PostgreSQL Board work as the measured bottleneck, not a production capacity or SLO claim.

The existing filter query took 226–238 ms in three direct PostgreSQL observations. The candidate query returned identical option codes and labels on the same source, taking 92–144 ms in three observations. This is a query-level comparison; the running Compose API still serves the protected-main code, so no post-change k6 improvement is claimed.

Verification

  • Authenticated PostgreSQL/API regression checks: 4 passed, with DeprecationWarning treated as an error. Documentation hygiene and the focused filter contract: 7 passed. A new case proves that an additional Voice enters the filter only while its carrying Post remains authorized.
  • Current-main authenticated Voice write, distinct derivation Post, and hidden-evidence checks: 3 passed.
  • git diff --check: passed.
  • Read-only merge-tree comparison with perf(board): normalize only the excerpt prefix a reader sees #1168 found only its pre-existing baseline conflict against current main; the backend and test edits merged cleanly. perf(board): normalize only the excerpt prefix a reader sees #1168 owns the separate excerpt optimization.

Delivery limits

Exact-head hosted checks, independent approval, and enforced review/check rules remain required. The current ruleset inspection exposed only a non-fast-forward rule. This PR must not merge or auto-merge while that protection gap remains. Authenticated rendered Voice UI and synthetic k6 acceptance on this candidate head remain unverified.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 13b69d89-7d39-4ac0-9601-67801cc84064
📥 Commits

Reviewing files that changed from the base of the PR and between 91c3e1c and 4e71264.

📒 Files selected for processing: 4
  • backend/app/main.py
  • backend/tests/test_api.py
  • docs/adr/0212-single-query-authorized-post-filter-options.md
  • tests/test_post_filter_options.py
✨ Finishing Touches: 💡 1
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

This branch has not been deployed

No deployments
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