refactor: use HTTP style start/end ranges - #7
Merged
Conversation
Contributor
There was a problem hiding this comment.
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/DecryptRangeWithCEKand related helpers to accept inclusivestart/endand 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.
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
bajtos
approved these changes
Aug 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.