Add mapbox matrix compute - #48
Open
mattpodwysocki wants to merge 1 commit into
Open
mattpodwysocki wants to merge 1 commit into
mattpodwysocki wants to merge 1 commit into
Conversation
Fourth of the Navigation-category APIs with no prior CLI coverage. Same
shape as directions/isochrone/map-matching: hand-authored into
custom-openapi/ since openapi-specs has no spec for this API either,
reusing ARG_NAME_OVERRIDES for the same profile-vs-global-flag collision
(fourth row, not a fourth mechanism).
Named `compute` rather than the API-naming doc's proposed `get`, matching
the precedent set by the three commands before it (route/contours/match) —
this returns a matrix computed fresh from the request, not a stored
resource.
Verified a real discrepancy against production while testing: the API
answers a comma-separated --sources/--destinations list with a 422
("may be \"all\" or semicolon-separated list of 0-based integer indices"),
unlike this CLI's own convention elsewhere of comma-separating index lists.
Documented in the spec and in --help, not just discovered and left as a
surprise.
Also fixes a --help truncation on --fallback-speed ("Legacy." as a leading
sentence, same class of bug as directions.yaml's earlier ones) by moving
the qualifier to the end of the description.
Smoke-tested against production: a full 3x3 matrix and a subsetted 1x2
matrix via --sources/--destinations, both verified to return the
documented shape.
487 tests, fmt and clippy clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same stacking situation as #44 on #43 and #45 on #44: this reuses
ARG_NAME_OVERRIDESfor the sameprofile-vs-global-flag collision. Once#43/#44/#45 merge in order, this should be retargeted to
main(gh pr edit --base main). Everything below is scoped to what this PR actuallyadds on top of #45.
What
mapbox matrix compute— the fourth Navigation-category API with no priorCLI coverage. Same shape as #43/#44/#45: hand-authored into
custom-openapi/since openapi-specs publishes no spec for it either.
Travel time and/or distance between every pair in a set of up to 25
coordinates, in one call — an N×N table, useful for ranking or filtering
many candidates by reachability before committing to a route through any
of them (as opposed to
directions route, a route through fixed stops inorder).
Named
computerather thanget— matching the precedent the threecommands before it set (
route/contours/match): this returns a matrixcomputed fresh from the request, not a stored resource.
A real discrepancy found and documented, not just worked around
--sources/--destinationstake semicolon-separated indices, notcomma — confirmed by testing, not assumed: a comma-separated list gets a
422 from the live API (
"may be \"all\" or semicolon-separated list of 0-based integer indices"), which is the opposite of most other index/valuelists on this CLI's Navigation commands. Documented in the spec's own
description and in
docs/commands.md, called out explicitly rather thanleft as a surprise for the next person to hit.
Also fixes a
--helptruncation on--fallback-speed("Legacy."as aleading sentence — same class of bug fixed in
directions.yamlearlier),by moving the qualifier to the end of the description.
Verification
Smoke-tested against production: a full 3×3 matrix and a subsetted 1×2
matrix via
--sources/--destinations, both verified to return thedocumented shape.
487 tests,
cargo fmt --checkandcargo clippy --all-targets -- -D warningsboth clean.🤖 Generated with Claude Code