Skip to content

Record block end in the __origin__ sequence#10

Closed
reuvenharrison wants to merge 1 commit into
feat/node-end-positionfrom
feat/origin-end-emission
Closed

Record block end in the __origin__ sequence#10
reuvenharrison wants to merge 1 commit into
feat/node-end-positionfrom
feat/origin-end-emission

Conversation

@reuvenharrison

Copy link
Copy Markdown
Collaborator

Stacked on #9 (depends on Node.EndLine/EndColumn). Retarget to v3 once #9 merges.

What

buildOriginSeq appends two fields to each __origin__ sequence: end_delta (line delta from key_line) and end_col, marking the end of the whole mapping block.

Why

A consumer can now reconstruct an element's full span from its origin, e.g. the entire endpoint operation block, not just its start line. This is what kin-openapi (and then oasdiff changelog / the review page) needs to point at and extract an affected endpoint.

Compatibility

Appended after the sequences section. The current kin-openapi originFromSeq returns once it has parsed the sequences and ignores trailing fields, so this needs no lockstep release: yaml3 can ship first, kin-openapi reads the new fields when it's updated.

Tests

  • TestOrigin_BlockEnd asserts the reconstructed end is the block's last content line and does not bleed into the following sibling.
  • The four golden origin tests are updated for the two new trailing entries (regenerated, not hand-edited).

@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from 067d231 to fc26e60 Compare June 24, 2026 14:38
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch from 78283ac to 9b05bd6 Compare June 24, 2026 14:39
@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from fc26e60 to bc94667 Compare June 24, 2026 14:50
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch from 9b05bd6 to e80e035 Compare June 24, 2026 14:50
@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from bc94667 to 18ca61c Compare June 24, 2026 14:54
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch from e80e035 to 0c3aef0 Compare June 24, 2026 14:55
@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from 18ca61c to e6bf064 Compare June 24, 2026 15:11
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch 2 times, most recently from ae7bb39 to b83981f Compare June 24, 2026 15:24
@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from e6bf064 to 102a24c Compare June 24, 2026 15:28
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch from b83981f to bf9f7e6 Compare June 24, 2026 15:28
buildOriginSeq now appends end_delta (line delta from key_line) and
end_col for the whole mapping block, using the node EndLine/EndColumn
added in the previous commit. This lets a consumer reconstruct an
element's full span (e.g. an entire endpoint operation block) from its
origin, not just the start.

Appended after the sequences section so a consumer that stops there
(today's kin-openapi originFromSeq) ignores the new fields -- backward
compatible, no lockstep release required.

TestOrigin_BlockEnd asserts the end reconstructs the block's last
content line without bleeding into the next sibling; the existing
golden origin tests are updated for the two new trailing entries.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@reuvenharrison reuvenharrison force-pushed the feat/node-end-position branch from 102a24c to 0ea83a6 Compare June 24, 2026 15:31
@reuvenharrison reuvenharrison force-pushed the feat/origin-end-emission branch from bf9f7e6 to 0e5f333 Compare June 24, 2026 15:31
@reuvenharrison reuvenharrison deleted the branch feat/node-end-position June 25, 2026 16:22
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