fix(services/github): support env-driven construction, honor range reads, add read-only behavior tests - #8010
Open
trim21 wants to merge 4 commits into
Open
fix(services/github): support env-driven construction, honor range reads, add read-only behavior tests#8010trim21 wants to merge 4 commits into
trim21 wants to merge 4 commits into
Conversation
trim21
marked this pull request as draft
August 1, 2026 15:26
GithubConfig::from_uri requires owner and repo to be parsed from the URI
authority, which breaks Operator::via_iter("github", env) construction
used by the behavior tests and env-driven setups. Fall back to options
when the URI has no authority or path.
Run the existing read-only behavior tests against the fixtures in core/tests/data of the apache/opendal repository. Forward the workflow GITHUB_TOKEN to raise the GitHub API rate limit.
trim21
force-pushed
the
test-github-read-only
branch
from
August 1, 2026 15:27
f5f2cb2 to
4d86abe
Compare
This was referenced Aug 1, 2026
GitHub ignores the Range header on authenticated Contents API requests and returns the full content with 200 instead of 206. Slice the response client-side when the server did not honor the requested range, matching the pattern used by other services.
trim21
marked this pull request as ready for review
August 1, 2026 15:50
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.
Which issue does this PR close?
None.
Rationale for this change
Three related gaps block the github service from having behavior test coverage and working correctly with a token:
GithubConfig::from_urirequiresownerandrepoto be parsed from the URI authority, which breaksOperator::via_iter("github", ...)construction used by env-driven setups and the behavior test framework. The github service is the only service that cannot be configured through environment variables.Rangeheader on authenticated Contents API requests and returns the full content with 200, so range reads (.range()/ suffix reads) return too much data when a token is configured.What changes are included in this PR?
from_urito fall back to options (OPENDAL_GITHUB_OWNER/OPENDAL_GITHUB_REPO) when the URI has no authority or path;github://<owner>/<repo>/<root>URI semantics are unchanged. Owner and repo stay validated as non-empty since#[serde(default)]would otherwise silently turn a missing field into an empty string..github/services/github/read_only/action.ymlthat runs the read-only behavior tests against the fixtures incore/tests/dataof the apache/opendal repository itself, so no extra backend or credentials are required.GITHUB_TOKENinto the core and python binding behavior test steps so the github tests can raise their API rate limit.Once merged, the behavior test matrix for core and all language bindings automatically picks up the github case.
Reproduction
repro_github_range.sh demonstrates the Range behavior difference (requires
ghandcurl):206withcontent-range: bytes 1024-2047/30482(1024 bytes).gh auth token):200with the full 30482-byte content — theRangeheader is ignored.Are there any user-facing changes?
OPENDAL_GITHUB_OWNER/OPENDAL_GITHUB_REPOenvironment variables now work for configuring the github service, and range reads work correctly when a token is configured.AI Usage Statement
This PR was developed with the assistance of an AI coding agent (pi) for implementation, testing, and PR preparation; the changes were reviewed by the author.