Skip to content

refactor: use HTTP style start/end ranges - #7

Merged
alanshaw merged 2 commits into
mainfrom
ash/refactor/http-style-ranges
Aug 28, 2026
Merged

refactor: use HTTP style start/end ranges#7
alanshaw merged 2 commits into
mainfrom
ash/refactor/http-style-ranges

Conversation

@alanshaw

Copy link
Copy Markdown
Member

This PR switches to inclusive start/end for ranges, per HTTP range (int-range) https://www.rfc-editor.org/rfc/rfc9110.html#rule.int-range which matches the method names - "range" is most often expressed as start/end whereas offset/length is usually named extent/slice/span.

@alanshaw
alanshaw requested review from bajtos and a lite review from Copilot August 26, 2026 12:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the range APIs to use inclusive [start, end] semantics aligned with HTTP Range behavior (RFC 9110), updating implementation, tests, and documentation to match.

Changes:

  • Update DecryptRange / DecryptRangeWithCEK and related helpers to accept inclusive start/end and return inclusive ciphertext spans.
  • Remove “empty range” behavior in favor of HTTP-style “unsatisfiable range” errors (aesstream.ErrRange).
  • Revise README/examples and test suites to reflect the new semantics and edge cases.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Updates public-facing documentation and examples to inclusive start/end semantics.
range.go Refactors RangeReader, range entrypoints, and ciphertext span plumbing to inclusive ranges.
range_test.go Updates range behavior tests (including rejecting empty/EOF ranges) for inclusive semantics.
example_range_test.go Updates example usage to start/end and inclusive Content-Range formatting.
example_descriptor_test.go Updates descriptor-based example to start/end inclusive semantics.
descriptor.go Adjusts documentation wording for suffix-range interpretation under new semantics.
descriptor_test.go Updates descriptor read-path tests to use inclusive ranges and reject EOF-start ranges.
aesstream/spanreader.go Refactors span reader and geometry helpers to inclusive range semantics and removes empty-range support.
aesstream/spanreader_test.go Updates spanreader tests to validate inclusive ciphertext spans and new range validation rules.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread range.go
Co-authored-by: alanshaw <152863+alanshaw@users.noreply.github.com>
alanshaw added a commit to fil-forge/ingot that referenced this pull request Aug 28, 2026
Consistently use start/end for reading ranges, aligning with the HTTP
range format (start/end inclusive), as it is what we already define in
UCAN `/content/retrieve` commands and is the format used by S3
`GetObject`.

Depends on:

* filecoin-project/go-fee#7
@alanshaw
alanshaw merged commit f89e5c0 into main Aug 28, 2026
7 checks passed
@alanshaw
alanshaw deleted the ash/refactor/http-style-ranges branch August 28, 2026 12:59
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.

4 participants