Skip to content

cli: add edgeToVertexes - #1325

Open
justinhwang wants to merge 1 commit into
uber:masterfrom
justinhwang:cli-edge-to-vertexes
Open

justinhwang wants to merge 1 commit into
uber:masterfrom
justinhwang:cli-edge-to-vertexes

Conversation

@justinhwang

Copy link
Copy Markdown
Collaborator

Closes #1324.

Adds edgeToVertexes (new in 4.6.0, #1272) as an h3 CLI subcommand. It takes a directed edge and prints its start and end vertexes, with the same json and newline formats as directedEdgeToCells.

$ h3 edgeToVertexes -c 115283473fffffff
["255283463fffffff", "22528340ffffffff"]

The two vertexes are the endpoints that directedEdgeToBoundary returns for the same edge, in the same order. An index that is not a valid directed edge gives Error 6: Directed edge argument was not valid.

Docs

The website section for edgeToVertexes comes from #1323, which is not merged yet, so this PR does not change vertex.mdx. Its Shell tab can become:

$ h3 edgeToVertexes --help
h3: Returns the start, end pair of vertexes from the directed edge
H3 4.6.0

	edgeToVertexes	Returns the start, end pair of vertexes from the directed edge
	-c, --cell <index>	Required. H3 Cell
	-h, --help	Show this help message.
	-f, --format <FMT>	'json' for ["CELL", ...], 'newline' for CELL\n... (Default: json)
$ h3 edgeToVertexes -c 115283473fffffff
["255283463fffffff", "22528340ffffffff"]

🤖 Generated with Claude Code

Expose edgeToVertexes, added to the library in 4.6.0, as an h3 CLI
subcommand. It takes a directed edge and prints its start and end
vertexes, in the same formats as directedEdgeToCells.

Closes uber#1324

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The H3 CLI adds and registers edgeToVertexes. The command accepts a directed-edge index and prints its two endpoint vertex indexes in JSON or newline format. Tests cover both formats and invalid input.

Changes

H3 CLI edge-to-vertex command

Layer / File(s) Summary
Implement and validate the CLI command
src/apps/filters/h3.c, tests/cli/edgeToVertexes.txt, CHANGELOG.md
Adds and registers edgeToVertexes. The command outputs endpoint indexes in JSON or newline format, returns API errors, and returns E_FAILED for unsupported formats. Tests cover both output formats and invalid input. The changelog records the addition.

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

Change: Feature

Possibly related PRs

  • uber/h3#1323: Adds website documentation for edgeToVertexes, a related part of the feature.
  • uber/h3#1272: Adds the library API that the CLI command exposes.

Suggested reviewers: isaacbrodsky, ajfriend

Merge Risk: Minimal · up to ebcfa

This adds an edgeToVertexes command to the H3 CLI that prints a directed edge's two endpoint vertexes. The change is additive and isolated, so merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "cli: add edgeToVertexes" names the main change: a new edgeToVertexes subcommand in the h3 CLI. The changeset adds that subcommand in src/apps/filters/h3.c, along with CLI tests and a change…
Description check Passed The description states that the PR adds edgeToVertexes as an h3 CLI subcommand, shows its json and newline output formats, gives an example command and output, and names the error for an invalid direc…
Linked Issues check Passed Issue #1324 asks for edgeToVertexes in the H3 CLI as a follow-up to v4.6.0. The reviewed diff adds SUBCOMMAND(edgeToVertexes, ...) in src/apps/filters/h3.c. It takes a cell argument, calls `H3_EXP…
Out of Scope Changes check Passed All changes map to the CLI request in #1324. src/apps/filters/h3.c adds the subcommand and its dispatch entry. tests/cli/edgeToVertexes.txt adds CLI test cases for the new subcommand. CHANGELOG.md add…
Full details: Title check

Explanation

The title "cli: add edgeToVertexes" names the main change: a new edgeToVertexes subcommand in the h3 CLI. The changeset adds that subcommand in src/apps/filters/h3.c, along with CLI tests and a changelog entry, so the title matches the primary change.

Full details: Description check

Explanation

The description states that the PR adds edgeToVertexes as an h3 CLI subcommand, shows its json and newline output formats, gives an example command and output, and names the error for an invalid directed edge. These match the changes in the h3.c subcommand and the CLI test file. It also explains that the website docs are left to #1323.

Full details: Linked Issues check

Explanation

Issue #1324 asks for edgeToVertexes in the H3 CLI as a follow-up to v4.6.0. The reviewed diff adds SUBCOMMAND(edgeToVertexes, ...) in src/apps/filters/h3.c. It takes a cell argument, calls H3_EXPORT(edgeToVertexes), and prints both vertexes in json (default) or newline format. It returns the API error on failure and E_FAILED for unsupported formats. The subcommand is registered via SUBCOMMAND_INDEX(edgeToVertexes) in the vertex section. The summary reports CLI tests in tests/cli/edgeToVertexes.txt covering json, newline, and the invalid-edge error. The API-docs note in #1324 refers to #1323, which is a separate issue. The PR states it does not change vertex.mdx, so no website documentation requirement applies to this PR. Test expectations were not inspected directly. The CLI test file is described only by the summary.

Full details: Out of Scope Changes check

Explanation

All changes map to the CLI request in #1324. src/apps/filters/h3.c adds the subcommand and its dispatch entry. tests/cli/edgeToVertexes.txt adds CLI test cases for the new subcommand. CHANGELOG.md adds one Unreleased entry referencing #1324. No unrelated files or behavior changes appear in the summary or in the h3.c diff. The PR does not change vertex.mdx, which the PR description explains.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3f1035f9-09ae-4236-bd11-cbe25df32025
Commits

Reviewing files that changed from the base of the PR and between 33ec628 and ebcfaef.

Files selected for processing: 3

  • CHANGELOG.md
  • src/apps/filters/h3.c
  • tests/cli/edgeToVertexes.txt

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 99.687%. remained the same — justinhwang:cli-edge-to-vertexes into uber:master

This branch has not been deployed

No deployments
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.

Add edgeToVertexes in H3 CLI

2 participants