Skip to content

test: stop the live route-length test failing on Google's shifted threshold - #381

Open
maximn wants to merge 1 commit into
masterfrom
test/directions-route-length-drift
Open

test: stop the live route-length test failing on Google's shifted threshold#381
maximn wants to merge 1 commit into
masterfrom
test/directions-route-length-drift

Conversation

@maximn

@maximn maximn commented Aug 24, 2026

Copy link
Copy Markdown
Owner

Why

The weekly scheduled live drift-check failed:

Failed Directions_ExceedingRouteLength
  Expected: MAX_ROUTE_LENGTH_EXCEEDED
  But was:  OK

Not a regression - Google-side drift, which is exactly what that scheduled job exists to catch. The test builds a deliberately absurd route (NYC → Miami via Seattle/Dallas/Naginey/Edmonton ×3) and asserts the real Directions API rejects it. Google now computes that route happily.

Evidence it isn't us: the last commit touching the test is #355, long before; the previous scheduled live run passed on effectively the same tree; and it isn't quota masking (NotExceedQuota passed, status was OK, not OVER_QUERY_LIMIT).

The route-length ceiling is an undocumented server-side threshold. Chasing it with more waypoints would just move the flake, so the assertion is split by who owns it.

What

Live test - degrade to inconclusive. New AssertInconclusive.EnforcedRouteLengthLimit, alongside the existing NotExceedQuota / HasTransitStep:

status result
MAX_ROUTE_LENGTH_EXCEEDED passes
OK inconclusive, message names the cause
anything else fails, with status + error message

DirectionsTests.cs is a one-line swap to call it. The scheduled run reports drift instead of going red, and still fails loudly on a genuine regression.

Offline - pin what we actually own. New DirectionsUnitTests covers the wire-status → DirectionsStatusCodes mapping deterministically, via the StubHandler + MapsAPIGenericEngine pattern already used by RoadsUnitTests / PollenUnitTests / SolarUnitTests:

  • MaxRouteLengthExceeded_IsDeserialized - the assertion the live test used to carry
  • ErrorStatus_CarriesErrorMessage - error_message binding
  • EveryDocumentedStatus_RoundTripsFromTheWire - all 9 enum members, so a future rename or EnumMember slip breaks offline

Plus three tests for the new helper in AssertInconclusiveTests.

Why not a VCR cassette

Cassettes are recordings. Google no longer emits MAX_ROUTE_LENGTH_EXCEEDED for this route, so VCR_MODE=record cannot produce one - the file would have to be hand-forged, contradicting Cassettes/README.md. StubHandler needs no fixture and tests the same contract.

Verification

  • net10.0 and net8.0: 283 passed, 0 failed (offline filter, VCR_MODE=replay)
  • dotnet format --verify-no-changes clean on all files authored here. DirectionsTests.cs reports violations, but all are pre-existing lines (40-47, 57, 61, 71, 111+), none at the changed line 91 - the known repo-wide format debt.

Follow-up (not in this PR)

If the next run or two confirms Google has permanently dropped the limit, the honest end state is deleting the live test and keeping only the offline coverage. Left in place for now so a re-tightened threshold is still observed.

…eshold

The weekly scheduled live run started failing: Directions_ExceedingRouteLength
asserts Google rejects a deliberately overlong route with
MAX_ROUTE_LENGTH_EXCEEDED, and Google now returns OK for it. The route-length
ceiling is an undocumented server-side threshold, so the assertion could never
be stable.

Split the concern in two:

- AssertInconclusive.EnforcedRouteLengthLimit treats OK as inconclusive, so a
  shifted threshold reports as live drift instead of a red build. Any other
  status still fails.
- DirectionsUnitTests pins the part we actually own - mapping the wire status
  onto DirectionsStatusCodes - offline via the existing StubHandler pattern,
  covering MAX_ROUTE_LENGTH_EXCEEDED, error_message binding, and all nine
  documented status values.

A VCR cassette was not an option here: cassettes are recordings, and Google no
longer emits this status for the route, so one would have to be hand-forged.
@github-actions

Copy link
Copy Markdown

🔬 TestGlance

✅ 292 passed across 1 job — 100.0% · ⏱️ 2.0s

Job Result Pass rate Duration Health
build 292/292 · 100.0% ↑ 2.0s ↓ Report
🟡 build — details

✅ 292 passed
████████████████ 100.0%
⏱️ 2.0s
📈 vs master · Pass rate: 100.0% ↑ (+2.9%) · Duration: 2.0s ↓ (17.3s, -89.5%) · Tests: 292 (+223)

vs master

Metric master PR Delta
Pass rate 97.1% 100.0% +2.9%
Duration 19.4s 2.0s -89.5%

📄 HTML Report


Updated 2026-08-24T09:52:55.212Z

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