Skip to content

fix: remove unsupported pagination from vehicles-for-agency#1112

Open
3rabiii wants to merge 1 commit into
OneBusAway:mainfrom
3rabiii:fix-vehicles-for-agency-gap-4
Open

fix: remove unsupported pagination from vehicles-for-agency#1112
3rabiii wants to merge 1 commit into
OneBusAway:mainfrom
3rabiii:fix-vehicles-for-agency-gap-4

Conversation

@3rabiii

@3rabiii 3rabiii commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a spec gap where the vehicles-for-agency endpoint was incorrectly applying pagination, leading to truncated results and an incorrect limitExceeded flag.

Problem

The spec explicitly guarantees that this endpoint will return all matching vehicles currently tracked for the requested agency. It also states that data.limitExceeded must always be false. The previous implementation honored limit and offset parameters, which violated this guarantee and could cause clients to miss vehicle data.

Changes

  • Removed calls to utils.ParsePaginationParams and utils.PaginateSlice from the handler.
  • Hardcoded the limitExceeded argument to false when building the ListResponse.
  • Added defensive unit tests to ensure that explicitly passing maxCount and offset query parameters does not truncate the result set and that limitExceeded remains false.

Closes #1105

Summary by CodeRabbit

  • Bug Fixes
    • The vehicles-for-agency response now returns all matching vehicles instead of being capped by pagination parameters.
    • The limitExceeded flag is consistently reported as false for this endpoint.
    • Requests with maxCount and offset no longer truncate the vehicle list returned.

Per the spec, this endpoint must return all matching vehicles
without applying a count ceiling. Removed ParsePaginationParams
and PaginateSlice calls to prevent truncation.

Hardcoded limitExceeded to false in the response and added
tests to verify that pagination parameters are safely ignored.
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d7ce1ccd-d6c6-4d34-9d27-e11411521939

📥 Commits

Reviewing files that changed from the base of the PR and between 3b4447f and 2286022.

📒 Files selected for processing (2)
  • internal/restapi/vehicles_for_agency_handler.go
  • internal/restapi/vehicles_for_agency_handler_test.go

📝 Walkthrough

Walkthrough

The vehiclesForAgencyHandler no longer parses pagination parameters or paginates results. limitExceeded is now hardcoded to false in the response. Two new tests verify all vehicles are returned regardless of maxCount/offset parameters.

Remove pagination from vehicles-for-agency handler

Layer / File(s) Summary
Remove pagination and hardcode limitExceeded=false
internal/restapi/vehicles_for_agency_handler.go
Removes ParsePaginationParams/PaginateSlice calls; vehiclesList is built from the full result set and limitExceeded is passed as false to NewListResponse with an inline spec comment.
Tests for limitExceeded and ignored pagination params
internal/restapi/vehicles_for_agency_handler_test.go
Adds TestVehiclesForAgencyHandler_LimitExceededAlwaysFalse and TestVehiclesForAgencyHandler_IgnoresMaxCountAndOffset, asserting all three injected vehicles are returned and limitExceeded is always false.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Suggested reviewers

  • aaronbrethorst
  • burma-shave
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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: removing unsupported pagination from vehicles-for-agency.
Linked Issues check ✅ Passed The handler now returns all matching vehicles and always sets limitExceeded to false, matching #1105.
Out of Scope Changes check ✅ Passed The changes stay focused on the vehicles-for-agency pagination fix and its tests.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@sonarqubecloud

Copy link
Copy Markdown

@3rabiii 3rabiii requested a review from burma-shave June 28, 2026 16:46
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.

[spec-gap] vehicles-for-agency: unsupported pagination and incorrect limitExceeded

1 participant