Skip to content

Treat blank bounty status filters as unfiltered#463

Open
INDICUMA wants to merge 1 commit into
ramimbo:mainfrom
INDICUMA:codex/blank-status-bounty-filter
Open

Treat blank bounty status filters as unfiltered#463
INDICUMA wants to merge 1 commit into
ramimbo:mainfrom
INDICUMA:codex/blank-status-bounty-filter

Conversation

@INDICUMA
Copy link
Copy Markdown

@INDICUMA INDICUMA commented May 26, 2026

Bounty #406

Summary

  • Treat blank status query values as no bounty status filter.
  • Normalize the public bounty page context so blank status keeps the All filter selected.
  • Add regression coverage for the public bounty page, summary API, and context helper.

Why

Copied or form-generated URLs can include ?status=. Before this change, that empty value was stripped and then validated as an invalid status, producing a 400 instead of showing the unfiltered bounty list. Non-empty invalid status values still return the existing validation error.

Validation

  • ./.venv312/bin/python -m pytest -q -> 413 passed
  • ./.venv312/bin/python -m ruff format --check . -> 79 files already formatted
  • ./.venv312/bin/python -m ruff check . -> All checks passed
  • ./.venv312/bin/python -m mypy app -> Success: no issues found in 30 source files
  • git diff --check -> clean

Summary by CodeRabbit

  • Bug Fixes

    • Fixed status filtering to handle empty or whitespace-only values gracefully. Empty status parameters (e.g., ?status=) now behave like no filter is applied instead of returning a validation error. Valid status values (open, paid, closed) remain validated and filter results correctly.
  • Tests

    • Added test coverage for blank status filter behavior across bounty listing pages and API summary endpoints.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 2ae80f6f-825f-487e-8757-d3178bb434a1

📥 Commits

Reviewing files that changed from the base of the PR and between 12c3dbd and f013c22.

📒 Files selected for processing (4)
  • app/bounty_api.py
  • app/public_routes.py
  • tests/test_bounty_pages.py
  • tests/test_public_routes.py

📝 Walkthrough

Walkthrough

The PR updates bounty listing status filtering to treat empty or whitespace-only status query values as unspecified rather than invalid. The handler now skips raising validation errors and avoids applying a status filter when status is blank, while still validating non-empty values against the allowed set (open, paid, closed).

Changes

Empty status filter normalization

Layer / File(s) Summary
Status normalization and validation
app/public_routes.py, app/bounty_api.py
Status normalization in public_bounties_context produces an empty string for null input and sets selected_status to None only when normalized value is empty. API validation logic skips enforcement and avoids applying filter when status is empty.
Test coverage for blank status filter
tests/test_public_routes.py, tests/test_bounty_pages.py
Unit test verifies context normalization of whitespace input produces selected_status = None. Page test confirms /bounties?status= renders all bounties without filtering. API test verifies /api/v1/bounties/summary?status=&q=discovery returns unfiltered summary.

Possibly related PRs

  • ramimbo/mergework#311: Updates status query value normalization to treat blank values as unspecified, directly affecting /api/v1/bounties/summary behavior and test assertions verifying summary matches public list filtering.
🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: treating blank bounty status filters as unfiltered rather than invalid.
Description check ✅ Passed The description covers the required sections: summary of changes, evidence of the problem, and comprehensive validation evidence.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Mergework Public Artifact Hygiene ✅ Passed PR modifies only bounty status filter logic; no investment, price, cash-out, payout, or private security claims present in code or documentation changes.
Bounty Pr Focus ✅ Passed Diff matches stated files with test coverage for blank status in public page, API, and context helper. All validation passed and scope focused on bounty status filtering.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

Copy link
Copy Markdown
Contributor

@GHX5T-SOL GHX5T-SOL left a comment

Choose a reason for hiding this comment

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

Reviewed current head f013c22860aa005009c1590bbce948bec7bf6843.

The change is narrowly scoped and matches the #406 bug-report class: blank or whitespace-only status query values are normalized to the same behavior as an omitted status filter for /api/v1/bounties, /api/v1/bounties/summary, and the public /bounties page. Non-empty invalid values still return the existing 400 validation error, and the public page no longer renders an impossible blank selected status.

Validation run locally:

  • uv run --extra dev python -m pytest tests/test_bounty_pages.py::test_bounties_page_renders_and_filters_by_status tests/test_bounty_pages.py::test_bounties_summary_api_matches_public_list_filters tests/test_public_routes.py::test_public_bounties_context_normalizes_filter_state -q -> 3 passed
  • uv run --extra dev python -m pytest -q -> 413 passed
  • uv run --extra dev python scripts/docs_smoke.py -> docs smoke ok
  • uv run --extra dev ruff check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py -> passed
  • uv run --extra dev ruff format --check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py -> 4 files already formatted
  • uv run --extra dev mypy app -> success
  • git diff --check origin/main...HEAD -> clean
  • gitleaks detect --no-banner --redact --source . --log-opts origin/main..HEAD --exit-code 1 -> no leaks found

GitHub quality/docs/image check is successful and CodeRabbit reports no actionable comments. No inline comments.

Copy link
Copy Markdown
Contributor

@jtc268 jtc268 left a comment

Choose a reason for hiding this comment

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

Approved.

I reviewed head f013c22. The blank status handling stays scoped across public page context and API summary/list logic; empty status now behaves like no filter while invalid non-empty values remain validated. Regression tests cover the page, summary API, and context helper.

Validation I ran:

  • tests/test_bounty_pages.py tests/test_public_routes.py with isolated sqlite: 8 passed
  • full pytest with isolated sqlite: 413 passed
  • ruff check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py passed
  • ruff format --check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py: 4 files already formatted
  • mypy app passed
  • docs smoke passed
  • git diff --check origin/main...HEAD clean

@tinyopsstudio
Copy link
Copy Markdown

Reviewed current head f013c22860aa005009c1590bbce948bec7bf6843 for blank bounty status filters.

No blocker found.

Evidence checked:

  • inspected app/bounty_api.py, app/public_routes.py, tests/test_bounty_pages.py, and tests/test_public_routes.py;
  • confirmed /api/v1/bounties and /api/v1/bounties/summary now treat empty or whitespace-only status as omitted, while still rejecting non-empty invalid statuses;
  • confirmed public /bounties?status= normalizes the selected status to the unfiltered tab rather than rendering an impossible blank active filter;
  • confirmed the existing query text and sort handling remain separate from status normalization.

Validation:

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python -m pytest tests/test_bounty_pages.py::test_bounties_page_renders_and_filters_by_status tests/test_bounty_pages.py::test_bounties_summary_api_matches_public_list_filters tests/test_public_routes.py::test_public_bounties_context_normalizes_filter_state -q
-> 3 passed

PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 ./.venv/bin/python scripts/docs_smoke.py
-> docs smoke ok

./.venv/bin/python -m ruff check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py
-> All checks passed

./.venv/bin/python -m ruff format --check app/bounty_api.py app/public_routes.py tests/test_bounty_pages.py tests/test_public_routes.py
-> 4 files already formatted

No private data, credentials, wallet material, payout guarantees, price/liquidity/exchange/off-ramp claims, or production mutation were used.

Copy link
Copy Markdown

@eliasx45 eliasx45 left a comment

Choose a reason for hiding this comment

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

Reviewed PR #463 at current head f013c22860aa005009c1590bbce948bec7bf6843.

No blocker found. Blank or whitespace-only status values now behave like an omitted status filter on the public /bounties page and summary/list API paths, while non-empty invalid statuses still keep the existing validation failure. The public page also returns the All filter state for ?status= instead of rendering a blank selected status.

I also checked current mergeability against origin/main: git merge --no-commit --no-ff origin/main auto-merged cleanly, then I aborted the probe to leave the branch unchanged.

Validation run locally:

  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_bounty_pages.py::test_bounties_page_renders_and_filters_by_status tests\test_bounty_pages.py::test_bounties_summary_api_matches_public_list_filters tests\test_public_routes.py::test_public_bounties_context_normalizes_filter_state -q -> 3 passed
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m pytest tests\test_bounty_pages.py tests\test_public_routes.py -q -> 8 passed
  • .\.venv\Scripts\python.exe -m ruff check app\bounty_api.py app\public_routes.py tests\test_bounty_pages.py tests\test_public_routes.py -> all checks passed
  • .\.venv\Scripts\python.exe -m ruff format --check app\bounty_api.py app\public_routes.py tests\test_bounty_pages.py tests\test_public_routes.py -> 4 files already formatted
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe -m mypy app\bounty_api.py app\public_routes.py -> success
  • PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 .\.venv\Scripts\python.exe scripts\docs_smoke.py -> docs smoke ok
  • git diff --check origin/main...HEAD -> clean

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.

5 participants