Skip to content

h3-go v0.4.0 — H3 Core v4.5.0

Latest

Choose a tag to compare

@dimchansky dimchansky released this 29 Jul 08:42
Immutable release. Only release title and notes can be modified.
c53e8cb

h3-go v0.4.0 — H3 Core v4.5.0

Library version: v0.4.0
Behavioral compatibility target: H3 Core v4.5.0

Minor release migrating the behavioral compatibility target from H3 C v4.4.0
to H3 C v4.5.0. This library is a pure-Go, dependency-free port of
Uber's H3 — now all 79 public functions of
H3 C v4.5.0
behind a typed Go API, plus the upstream-compatible h3 CLI.
The minor bump (not a patch) reflects documented behavior changes inherited
from H3 Core 4.5.0; there are no Go API removals or renames, and the only
signature-visible addition is DirectedEdge.Reverse.

The full, reviewed symbol/test/CLI migration record is
docs/sync/4.4.0-to-4.5.0.md.

Upstream H3 changes adopted

Adopts H3 C v4.5.0
(uber/h3@1b536c34225191ba24a75a840f634d4a48c3b206), function by function:

  • New public function reverseDirectedEdge (see Go API changes).
  • cellsToMultiPolygon rewritten to an arc-cancellation algorithm,
    replacing the vertex-graph algorithm. Observable output differences:
    hole/outer loop start-vertex and extraction order change; invalid cells
    now report E_CELL_INVALID (was E_FAILED); mixed-resolution inputs
    report E_RES_MISMATCH; duplicate cells report E_DUPLICATE_INPUT; a
    full-globe input yields eight octant polygons.
  • Cell area reimplemented as boundary-loop spherical area:
    cellAreaRads2, cellAreaKm2, and cellAreaM2 now compute the area
    enclosed by a cell's boundary loop (per-edge Cagnoli terms,
    Kahan-compensated summation), replacing the previous center-fan of
    spherical triangles. Numeric values may differ slightly and are
    expected to be more accurate. (These surface in Go as Cell.AreaRads2
    / Cell.AreaKm2 / Cell.AreaM2.)
  • Internal Vec3 indexing refactor: latLngToCell, cellToLatLng,
    and the boundary pipeline route through 3D-vector geometry. The
    floating-point operation sequence changed, so geographic coordinate
    outputs may differ in their low bits (see Compatibility and
    migration
    ); the discrete index-producing operations remain
    parity-locked.
  • gridPathCells adopts bidirectional interpolation: paths are
    endpoint-exact, and some pentagon-crossing pairs that previously
    failed with a pentagon error can now succeed (not all — upstream still
    pins a known-failing pair). Path contents stay unstable across
    versions, so the intermediate cells for a given pair can differ.
  • CLI (src/apps/filters/h3.c): the 1500-byte cell-input scanner takes
    the stale-buffer fix (no phantom cells at chunk boundaries — uber/h3
    #1124,
    #1125); edgeLengthM prints at
    %.8f (was %.10f). (Upstream also fixed an uncompactCells
    help-text typo — a no-op here: this Go CLI's help wording was already
    correct and is deliberately not byte-locked.)
  • destroyLinkedMultiPolygon becomes idempotent (head-zeroing); mirrored in
    this library's internal linked-geo lifecycle.

Go API changes

Added — DirectedEdge.Reverse() (DirectedEdge, error): the H3 4.5.0
reverseDirectedEdge function, exposed as a method on the typed receiver to
match the uber/h3-go v4.5.0
shape. Never allocates. This brings public coverage to 79/79 H3 C v4.5.0
functions (was 78/78).

No other public API changes: nothing was removed or renamed, and every
existing signature is unchanged. The behavioral differences visible to
existing code are the upstream 4.5.0 changes listed above and enumerated
under Compatibility and migration. Guaranteed error ordering is documented
on the CellsToMultiPolygon wrapper.

Fixed

  • No standalone bug fixes independent of the upstream adoption. The CLI
    cell-input scanner's 4.4.0 chunk-boundary bug (phantom duplicate cells on
    inputs spanning the 1500-byte buffer) is resolved by taking upstream's
    4.5.0 fix; the reproduced-quirk contract in
    docs/cli-compatibility.md
    is re-derived accordingly.

Compatibility and migration

  • No breaking Go API changes to the existing surface: nothing was
    removed or renamed, and every existing signature is unchanged. Requires
    Go ≥ 1.24.

  • Migration warning — observable behavior changed with the H3 4.5.0
    adoption.
    Review these if your code or tests depend on them:

    • CellsToMultiPolygon — multipolygon loop start-vertex / ordering and
      the error codes for invalid (ErrCellInvalid), mixed-resolution
      (ErrResolutionMismatch), and duplicate (ErrDuplicateInput) inputs;
    • Cell.AreaRads2 / Cell.AreaKm2 / Cell.AreaM2 — slightly
      different, more accurate numeric values (boundary-loop
      reimplementation);
    • geographic coordinate outputs from the refactored cell/boundary
      pipeline — Cell.LatLng, Cell.Boundary, DirectedEdge.Boundary,
      and Vertex.LatLng — may differ in their low bits. The discrete
      index-producing operations (e.g. LatLngToCell) remain parity-locked,
      and the golden fixture suites pass at their established tolerances;
    • gridPathCells — the intermediate cells produced for a given
      start/end pair, and reachability near pentagons (some pairs that
      previously failed now succeed);
    • the h3 CLI — edgeLengthM precision (%.8f) and the cell-input
      scanner (no phantom cells at 1500-byte chunk boundaries).

    This is the authoritative set of behaviors to check when upgrading.

  • VersionMajor / VersionMinor / VersionPatch now report 4, 5, 0
    (the H3 Core target; the CLI separately reports its own build version).

  • Migrating from the official cgo binding:
    docs/migration-from-uber-h3-go.md.
    The interop comparison baseline is now uber/h3-go v4.5.0 (both
    libraries expose DirectedEdge.Reverse with the same shape); the
    function-by-function matrix is
    docs/comparison-uber-h3-go.md.

  • Intentional, documented deviations from H3 C:
    docs/DEVIATIONS.md.

  • The stale 2019 pseudo-version v0.0.0-20191115084349-4ab39a97d2af remains
    retracted in go.mod (unrelated pre-rewrite code once cached by the
    proxy).

Validation

Run on the exact released commit by the tag-triggered
Nightly release gate
and release-builds
workflows:

  • The full C parity suite (213 opt-in cgo test files) against pristine
    H3 C v4.5.0 sources; the complete upstream fixture replay
    (526,546 golden conversion/boundary records); the CLI differential
    suite
    (172 scenarios) against the compiled 4.5.0 C h3; the race
    detector
    .
  • A fuzz smoke over six of the seven fuzz targets —
    FuzzUpstreamPolygonOperations remains seed-corpus-only because fuzzing
    surfaced a confirmed finite ~15 s adversarial polygon input whose
    pathology is inherited from upstream maxPolygonToCellsSizeExperimental
    and reproduced (slower) in H3 C itself; reproducer and analysis:
    issue #3.
  • The uber/h3-go v4.5.0 differential and semantic-equivalence suites;
    govulncheck v1.6.0 (root module ./...; the test-only interop/
    modules are intentionally out of scope — they never reach consumers); and a
    digest-pinned gitleaks full-history secret scan.
  • Secret-scan evidence (this tag's run): gitleaks, full history — zero findings.

Counts (parity files, fixture records, CLI scenarios, registry rows) are
recorded in the tag-pinned generated inventories under
docs/.

CLI artifacts

Six archives + SHA256SUMS, built bit-reproducibly with go1.26.5
(CGO_ENABLED=0, -trimpath, normalized archive metadata via
tools/releasepack) — verified by an independent CI rebuild and an
independent local rebuild, all byte-identical. Reproduce from the tag:

git checkout v0.4.0 && GOTOOLCHAIN=go1.26.5 make release-dist VERSION=v0.4.0 OUT=$(mktemp -d)

Runtime-tested on architecture-proven runners: linux/amd64,
windows/amd64, darwin/arm64
(plus darwin/arm64 natively and linux/arm64
under emulation). Cross-built only: darwin/amd64, windows/arm64.

Integrity: this Release is immutable (tag and assets locked at
publication, release attestation minted). sum.golang.org authenticates the
Go module source only — verify the one archive you downloaded against
SHA256SUMS (tokenless; run in the directory holding both files).

macOS:

archive=h3-v0.4.0-darwin-arm64.tar.gz   # darwin-amd64 on Intel Macs
actual=$(shasum -a 256 "$archive") &&
  grep -Fxq -- "$actual" SHA256SUMS &&
  echo "OK: checksum verified"

Linux:

archive=h3-v0.4.0-linux-amd64.tar.gz    # or linux-arm64
actual=$(sha256sum "$archive") &&
  grep -Fxq -- "$actual" SHA256SUMS &&
  echo "OK: checksum verified"

Windows (PowerShell):

$archive = "h3-v0.4.0-windows-amd64.zip"   # or windows-arm64
$entries = @(Select-String -Path SHA256SUMS -SimpleMatch $archive)
if ($entries.Count -ne 1) { throw "expected exactly 1 manifest entry for $archive, found $($entries.Count)" }
$hash = (Get-FileHash $archive -Algorithm SHA256).Hash.ToLower()
if ($entries[0].Line -ne "$hash  $archive") { throw "checksum mismatch for $archive" }
"OK: checksum verified"

The Unix commands are fail-closed (grep -Fxq requires an exact whole-line
fixed-string match; a missing archive stops the && chain at the checksum
tool; OK: checksum verified prints only after success). The PowerShell
version fails explicitly on zero/multiple manifest entries or a hash
mismatch. The release pipeline executes these exact commands — plus
corrupted-archive and missing-archive negative cases — on real macOS, Linux,
and Windows runners for every tag. Alternatively, verify cryptographically
with gh release verify v0.4.0 --repo dimchansky/h3-go and
gh release verify-asset v0.4.0 <file> --repo dimchansky/h3-go (requires an
authenticated GitHub CLI session).

macOS: the darwin binaries are ad-hoc linker-signed, but not Developer
ID-signed or notarized
, so Gatekeeper can reject browser-downloaded copies.
Verify the archive first (command above), extract, then remove quarantine
from the exact verified binary only —
xattr -d com.apple.quarantine h3-v0.4.0-darwin-arm64/h3 (substitute
darwin-amd64 on Intel Macs) — or use System Settings → Privacy & Security →
Open Anyway. go install github.com/dimchansky/h3-go/cmd/h3@v0.4.0 avoids
quarantine entirely. Never disable Gatekeeper globally. Full steps ship in
the README inside each archive.