Skip to content

Check stop and route IDs against Java in CI - #1805

Closed
aaronbrethorst wants to merge 2 commits into
ab/service-id-agencyfrom
ab/java-parity-test
Closed

aaronbrethorst wants to merge 2 commits into
ab/service-id-agencyfrom
ab/java-parity-test

Conversation

@aaronbrethorst

@aaronbrethorst aaronbrethorst commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Stacked on #1804. Part of the stop consolidation work (#1771–#1779). No issue filed yet.

What it does

Adds a CI test that compares the stop, route and service IDs in Maglev's responses with Java OneBusAway's, on a small synthetic two-agency feed. So far the agency-prefix fixes in this stack were checked by hand against Java running in Docker; this test keeps those results from drifting.

Root cause

Not a bug fix. The gap: nothing in CI compared Maglev with Java on a feed with more than one agency, which is where every bug fixed in this stack showed up.

Testing

  • TestJavaParity_SyntheticTwoAgencyFeed replays 38 requests from testdata/java_parity/java_ids.json. 32 match Java. 6 are skipped as known differences, each with its reason, in knownJavaDifferences.
  • On main the same test fails 26 of 32 requests (I copied it into a main worktree and ran it there), so it covers what this stack fixed.
  • Passes under CGO and purego.

Response comparison

This PR changes no response.

Checklist

  • This PR addresses one issue.
  • It is under ~200 changed lines, or the description says why it can't be split.
  • This PR is not a bug fix, or the new or changed test fails on main and passes on this branch.
  • Each commit is one logical change with a clear message.
  • I did not hand-edit sqlc-generated files under gtfsdb/ (db.go, models.go, query.sql.go) or testdata/openapi.yml (synced from upstream).
  • This PR changes no handler, or handlers pass r.Context() to DB/service calls, not context.Background().
  • The response comparison above is filled in, or this PR doesn't change a Java-served response.
  • This PR adds no endpoint, or each new endpoint matches testdata/openapi.yml, has an issue open on OneBusAway/sdk-config, or is outside the SDK and the description says why.
  • I read every line of this diff and can explain it if asked.

Notes for reviewers

  • Size: most of the 1,049 lines are data:

    • Java's recorded answers in java_ids.json;
    • the generated feed in feed/ (255 lines).

    The code to review is java_parity_test.go (122 lines), plus make_feed.py and capture.py, which regenerate the data.

  • Recapturing: testdata/java_parity/README.md explains how to re-record Java's answers with the oba-api Docker stack. That stack's gtfstidy step has to be switched off with GTFS_TIDY_ARGS=-help, or it deletes stops with no routes, which production Java keeps.

  • A new bug the test found: in arrivals, a later trip in the same block gets its own first stop as nextStop. Java gives the active trip's next stop. It's skipped for now and will be fixed in a follow-up.

  • The other skipped differences:

    • trip status built from the schedule when there's no vehicle;
    • schedule-for-route stop references and stop-time serviceIds.
  • Java quirk: on this feed Java's trips-for-location returns no trips, even at times when trips are running. Maglev also returns none without real-time data, so that request currently matches.

After review

  • A request in knownJavaDifferences is now compared anyway, and the test fails once it matches Java, so a fixed difference can't stay listed.
  • The test comment says what the comparison misses: it checks each response's set of key=ID pairs, not which list entry holds which ID.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: f5c6bb24-6567-4b75-ac98-51d845934142

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@github-actions

Copy link
Copy Markdown

@aaronbrethorst, the PR description does not follow the PR template:

  • No linked issue. Add Fixes #N (or Part of #N) for a triaged issue.
  • Testing: "Test failing on main before this change:" is empty.
  • Testing: "Manual check:" is empty.
  • Response comparison: "Request URL(s):" is empty.
  • Response comparison: "Java server, feeds and date checked:" is empty.
  • Response comparison: "Maglev before:" is empty.
  • Response comparison: "Maglev after:" is empty.
  • Response comparison: "Java:" is empty.
  • Checklist item is not checked: "I read every line of this diff and can explain it if asked." If this item doesn't apply to your PR, ask a maintainer.

Keep this PR as Draft until these are fixed. This comment updates when the description changes.

@github-actions

Copy link
Copy Markdown

Performance Smoke Test Results

Status: PASSED

Metric Value
p(95) latency 2.0 ms
Error rate 0.00%
Total requests 332
Req/sec 10.9

Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%.

Full results uploaded as workflow artifact: k6-smoke-summary.

Maglev's agency-prefix work was checked by hand against Java
OneBusAway running in Docker. Nothing stopped those results from
drifting.

Add a small synthetic two-agency feed, the IDs Java 2.7.1 returns
for 38 requests on it, and TestJavaParity_SyntheticTwoAgencyFeed,
which replays the requests and compares every stop, route and service
ID. The six requests that still differ are skipped with the reason.
The feed generator and capture script live next to the data, and the
README explains how to recapture.
A request listed in knownJavaDifferences was skipped without being
compared, so a fixed difference stayed listed and stopped guarding
anything. Compare it anyway and fail once it matches Java, so the
entry gets removed. Also say what the comparison does not catch: an
ID moved between entries of the same list.
@sonarqubecloud

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

Performance Smoke Test Results

Status: PASSED

Metric Value
p(95) latency 2.2 ms
Error rate 0.00%
Total requests 342
Req/sec 11.2

Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%.

Full results uploaded as workflow artifact: k6-smoke-summary.

@github-actions

Copy link
Copy Markdown

Performance Smoke Test Results

Status: PASSED

Metric Value
p(95) latency 2.1 ms
Error rate 0.00%
Total requests 332
Req/sec 10.9

Smoke test config: 5 VUs x 30s. Thresholds: p(95) < 300ms, error rate < 1%.

Full results uploaded as workflow artifact: k6-smoke-summary.

@aaronbrethorst

Copy link
Copy Markdown
Member Author

Closing as superseded. The multi-feed static GTFS spec (#1811, docs/multi-agency-static-feeds-spec.md §10) folds this stack's stop-ID rules into the per-feed default agency and the stored-ID identity model; they return as phases B and C of that plan. The Java-recorded data in testdata/java_parity and the tests on this branch will be reused there. #1806, #1807 and #1810 are not identity work and stay open to be re-cut against main.

@aaronbrethorst
aaronbrethorst deleted the ab/java-parity-test branch November 8, 2026 18:31
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.

1 participant