Skip to content

fix(server): bound runs pagination parameters - #1225

Draft
shunichironomura wants to merge 1 commit into
mainfrom
fix/1066-runs-pagination
Draft

shunichironomura wants to merge 1 commit into
mainfrom
fix/1066-runs-pagination

Conversation

@shunichironomura

Copy link
Copy Markdown
Member

Warning

This content was written by an AI agent and must be verified by a human developer. After human verification, this alert may be removed.

Summary

  • normalize HTML and API run-list pagination to limit=1..=1000 and offset=0..=100000
  • prevent GET /runs?limit=0 from dividing by zero
  • add regression coverage for the HTML route and normalized API response

Fixes #1066.

AI assistance

  • AI used: yes — Amp investigated the issue, implemented the fix, and added tests
  • Human review of AI-assisted code: pending

Breaking changes

  • No breaking changes
  • Breaking changes; the breaking change label is applied

Verification

  • cargo fmt --check --all
  • cargo test -p capsula-server --lib (13 passed)
  • RUSTFLAGS='-Dwarnings' cargo clippy -p capsula-server --all-targets --all-features
  • cargo test -p capsula-server --test api_tests test_pagination -- --exact --nocapture compiled successfully, but could not execute because this orb has no Docker socket for Testcontainers

Normalize list pagination before division or SQL execution so zero, negative, and excessive values cannot panic the HTML handler or fail/overload the API query.

Co-authored-by: Shunichiro Nomura <shunichiro.nomura.1035@gmail.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a06b77-9990-75fe-b428-a220b30151f3
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.17%. Comparing base (433b438) to head (82ad267).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1225      +/-   ##
==========================================
+ Coverage   54.16%   55.17%   +1.00%     
==========================================
  Files          44       45       +1     
  Lines        4233     4254      +21     
==========================================
+ Hits         2293     2347      +54     
+ Misses       1940     1907      -33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Remote panic (division by zero) via GET /runs?limit=0

3 participants