Skip to content

test: Add coverage for empty references #1098

Open
ARCoder181105 wants to merge 1 commit into
OneBusAway:mainfrom
ARCoder181105:fix-1048
Open

test: Add coverage for empty references #1098
ARCoder181105 wants to merge 1 commit into
OneBusAway:mainfrom
ARCoder181105:fix-1048

Conversation

@ARCoder181105

@ARCoder181105 ARCoder181105 commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Description

Resolves #1048 by adding missing defensive test coverage to the /stop endpoint.

Changes Made

  • Added explicit assert.Empty checks for references.Trips and references.StopTimes to the standard end-to-end test to enforce the wiki spec guarantees.

Testing

  • Verified the new test assertions pass successfully using make test.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ARCoder181105, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 42 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fec3f2bf-2458-45ee-9e81-2f8899865b71

📥 Commits

Reviewing files that changed from the base of the PR and between 589b92f and 38c48dc.

📒 Files selected for processing (1)
  • internal/restapi/stop_handler_test.go
📝 Walkthrough

Walkthrough

Two test additions in stop_handler_test.go: TestStopHandlerEndToEnd gains assert.Empty checks on References.Trips and References.StopTimes; a new TestStopHandler_DanglingParentStation seeds a stop with a non-existent parent_station and asserts a 200 OK response with empty References.Stops.

Changes

Stop Handler Test Coverage

Layer / File(s) Summary
Empty references assertions and dangling parent station test
internal/restapi/stop_handler_test.go
TestStopHandlerEndToEnd adds assert.Empty for References.Trips and References.StopTimes. New TestStopHandler_DanglingParentStation seeds an agency and child stop with a non-existent parent_station, calls the stop endpoint, and asserts 200 OK, code OK, and empty References.Stops.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Possibly related issues

  • #1048: This PR directly implements all acceptance criteria from the issue — adding assert.Empty checks for Trips and StopTimes in TestStopHandlerEndToEnd and introducing TestStopHandler_DanglingParentStation to verify graceful handling of a non-existent parent_station.

Possibly related PRs

  • OneBusAway/maglev#999: Modifies the same test file with parent_station-related assertions about references.stops population, directly complementary to the dangling parent station scenario added here.
  • OneBusAway/maglev#1069: Updates the same end-to-end test to assert specific model.Data.References.* arrays stay empty (for Situations), the same pattern applied here for Trips and StopTimes.
  • OneBusAway/maglev#1049: Touches stop_handler reference payload behavior with includeReferences logic, directly relevant to the empty-reference guarantees being asserted in this PR.

Suggested reviewers

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

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Linked Issues check ✅ Passed The PR implements both acceptance criteria from issue #1048: explicit assert.Empty checks for Trips/StopTimes in the standard test, and a new TestStopHandler_DanglingParentStation test verifying graceful 200 OK response with empty references.stops.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the test file and address the exact coverage gaps identified in issue #1048 with no extraneous modifications.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: Add coverage for empty references' directly corresponds to the main changes: adding explicit assertions for empty references (Trips and StopTimes) and a new test for handling edge cases with empty references.

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

✨ 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 and usage tips.

@ARCoder181105 ARCoder181105 changed the title test: Add coverage for empty references and dangling parent stations test: Add coverage for empty references Jun 20, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

test: Missing test coverage for empty reference arrays

1 participant