Skip to content

Support includeReferences=false in route-search#1204

Open
ARCoder181105 wants to merge 1 commit into
OneBusAway:mainfrom
ARCoder181105:feature-route-search-references
Open

Support includeReferences=false in route-search#1204
ARCoder181105 wants to merge 1 commit into
OneBusAway:mainfrom
ARCoder181105:feature-route-search-references

Conversation

@ARCoder181105

@ARCoder181105 ARCoder181105 commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR adds support for the includeReferences query parameter in the search-route endpoint, bringing it into compliance with the OBA spec and matching the behavior of sibling endpoints.

Key Changes:

  • Leveraged the existing ShouldIncludeReferences utility to parse the query parameter.
  • Skips database queries for agencies and situations when includeReferences=false is provided, returning an empty references block and reducing payload size.
  • Added TestRouteSearchHandlerIncludeReferencesFalse to explicitly test this boundary condition and prevent regressions.

closes #1198

Summary by CodeRabbit

  • New Features

    • Added an option to exclude supplementary agency, route, and situation references from route search responses.
    • Route search results remain available when references are excluded.
  • Bug Fixes

    • Ensured reference sections are returned as empty objects when supplementary data is disabled.

The route search handler previously queried and populated agency and
situation references unconditionally, ignoring the includeReferences
query parameter.

This commit leverages the existing ShouldIncludeReferences utility to
parse the parameter and conditionally bypass the database queries for
agencies and situations when references are not requested. A new unit
test has been added to verify that the references block remains empty
when includeReferences is set to false, preventing future regressions
and reducing payload overhead as defined by the specification.
@coderabbitai

coderabbitai Bot commented Jul 19, 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: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 7ebce54c-4227-4619-b013-f030c53ad8ca

📥 Commits

Reviewing files that changed from the base of the PR and between 5d59661 and 477510e.

📒 Files selected for processing (2)
  • internal/restapi/route_search_handler.go
  • internal/restapi/route_search_handler_test.go

📝 Walkthrough

Walkthrough

Route search now honors includeReferences=false. It always returns the references block, but skips agency, route, and situation reference population while continuing to return route results.

Changes

Route search reference filtering

Layer / File(s) Summary
Conditional reference population and validation
internal/restapi/route_search_handler.go, internal/restapi/route_search_handler_test.go
The handler uses ShouldIncludeReferences(r) to gate reference construction, and the test verifies successful route results with empty reference collections when disabled.

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

Possibly related issues

  • OneBusAway/maglev issue 1187 — Covers the same includeReferences=false behavior in another REST handler.
  • OneBusAway/maglev issue 1211 — Covers honoring includeReferences=false for agency reference data in another endpoint.
  • OneBusAway/maglev issue 1209 — Directly tracks conditional reference population using ShouldIncludeReferences(r).

Possibly related PRs

Suggested reviewers: burma-shave, ahmedhossamdev

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: supporting includeReferences=false in route search.
Linked Issues check ✅ Passed The handler now honors includeReferences=false by skipping agency and situation population while keeping an empty references block, matching #1198.
Out of Scope Changes check ✅ Passed The only code changes are the handler logic and a regression test directly tied to includeReferences support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

@ARCoder181105

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@Ahmedhossamdev Ahmedhossamdev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great work!

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.

search-route: support includeReferences=false

2 participants