Skip to content

directededge: return the edge's cells as two values - #186

Merged
justinhwang merged 1 commit into
masterfrom
directededge/cells-two-values
Nov 19, 2026
Merged

justinhwang merged 1 commit into
masterfrom
directededge/cells-two-values

Conversation

@justinhwang

Copy link
Copy Markdown
Collaborator

Breaking change. DirectedEdge#Cells now returns (Cell, Cell, error), the origin and the destination, instead of a []Cell.

The slice always held exactly two cells. Two values match DirectedEdge#Vertexes (#184): the signature states the count and the order, and the call no longer allocates.

Migration:

// before
cells, err := edge.Cells()
origin, destination := cells[0], cells[1]

// after
origin, destination, err := edge.Cells()

Validation is unchanged. A non-edge index still fails with ErrDirectedEdgeInvalid from Origin, and an origin that cannot step to its neighbor still fails from Destination. Both values are zero on error.

The changelog's Unreleased section gains a Breaking Changes heading with this entry.

Testing

The existing directed-edge tests now use the two values: the corpus round trip, the cell-mode rejection and the corrupt-origin failure. Cells stays at 100% coverage, and lint and the full test suite pass.

DirectedEdge#Cells returned a []Cell that always held exactly two cells,
the origin and the destination. It now returns them as two values, the
same shape as DirectedEdge#Vertexes: the signature states the count and
the order, and the call no longer allocates a slice.

This breaks callers. Code that read the slice, such as

    cells, err := edge.Cells()
    origin, destination := cells[0], cells[1]

becomes

    origin, destination, err := edge.Cells()

Validation is unchanged. A non-edge index still fails with
ErrDirectedEdgeInvalid from Origin, and an origin that cannot step to its
neighbor still fails from Destination. Both values are zero on error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@justinhwang
justinhwang force-pushed the directededge/cells-two-values branch from 8c3d541 to e0351a4 Compare November 19, 2026 17:15
@justinhwang
justinhwang merged commit 81efd19 into master Nov 19, 2026
11 checks passed
@justinhwang
justinhwang deleted the directededge/cells-two-values branch November 19, 2026 17:19
@coveralls

coveralls commented Nov 19, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 44575254393

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage remained the same at 100.0%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 4 of 4 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 4094
Covered Lines: 4094
Line Coverage: 100.0%
Coverage Strength: 6205528.14 hits per line

💛 - Coveralls

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.

2 participants