Skip to content

Commit bf0b450

Browse files
committed
release: bound pull request source ingestion
1 parent e319bb7 commit bf0b450

10 files changed

Lines changed: 737 additions & 31 deletions

File tree

‎.github/workflows/tests.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ jobs:
129129
assert callable(Repository.get_ci_status_with_status)
130130
assert callable(Repository.read_text_file_bounded)
131131
assert BoundedTextReadResult.__name__ == "BoundedTextReadResult"
132-
assert llama_github.__version__ == "0.4.4"
132+
assert llama_github.__version__ == "0.4.5"
133133
PY
134134
135135
dependency-audit:

‎CHANGELOG.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.4.5] - 2026-07-20
9+
10+
### Added
11+
- Added optional per-file and cumulative source limits to `get_pr_content()` for memory-bounded consumers while preserving the historical unbounded default and a separate cache identity
12+
- Added an optional caller-owned source limit to `get_file_content()`, including size-before-decode checks and locally capped raw-response streaming
13+
- Added content-free PR retrieval metadata for retained reads, budget exhaustion, API-patch fallback, and missing-patch fallback
14+
15+
### Fixed
16+
- Prevented large changed-file base/head content from being materialized or accumulated before callers can apply their own memory boundary
17+
- Reused GitHub's changed-file patch when bounded source is unavailable instead of treating the file as analyzable full source
18+
819
## [0.4.4] - 2026-07-19
920

1021
### Fixed
@@ -204,6 +215,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
204215
- Integration with LLM for processing and generating responses
205216

206217
[0.1.4]: https://github.com/JetXu-LLM/llama-github/compare/v0.1.3...v0.1.4
218+
[0.4.5]: https://github.com/JetXu-LLM/llama-github/compare/v0.4.4...v0.4.5
207219
[0.4.4]: https://github.com/JetXu-LLM/llama-github/compare/v0.4.3...v0.4.4
208220
[0.4.3]: https://github.com/JetXu-LLM/llama-github/compare/v0.4.2...v0.4.3
209221
[0.4.2]: https://github.com/JetXu-LLM/llama-github/compare/v0.4.1...v0.4.2

‎README.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pip install llama-github
1818

1919
Current maintained runtime target: Python `3.10` through `3.14`.
2020

21-
Version `0.4.4` keeps the existing high-level API while allowing retrieval-only
21+
Version `0.4.5` keeps the existing high-level API while allowing retrieval-only
2222
integrations to import GitHub and diff helpers without loading the ML/RAG dependency
2323
stack. Built-in Jina models are pinned to immutable revisions; custom remote-code
2424
models should provide their own immutable revision. Pull-request retrieval now keeps
@@ -27,7 +27,9 @@ evidence, and preserves review summaries plus each inline comment without collap
2727
them together. Repository-qualified links are identity-aware, so upstream release-note
2828
links are not expanded as same-repository issues. Deterministic planners can explicitly
2929
opt into typed, 2 MiB-capped
30-
lockfile or CI-config reads without weakening the generic file policy.
30+
lockfile or CI-config reads without weakening the generic file policy. Memory-sensitive
31+
PR consumers can also opt into per-file and cumulative source limits; oversized source
32+
falls back to GitHub's changed-file patch without changing the default retrieval API.
3133

3234
## Usage
3335

‎docs/api_reference.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ GitHubAppCredentials(
8383

8484
Used with `GithubRAG(github_app_credentials=...)`.
8585

86-
## `Repository.get_pr_content(number, pr=None, context_lines=10, force_update=False, *, related_issue_max_hits=None)`
86+
## `Repository.get_pr_content(number, pr=None, context_lines=10, force_update=False, *, related_issue_max_hits=None, source_file_max_bytes=None, source_total_max_bytes=None)`
8787

8888
Available from:
8989

@@ -128,8 +128,29 @@ comment as separate chronological records. `reviews` and `review_comments` have
128128
independent bounded-fetch metadata; `partial` or `error` means the interaction view is
129129
incomplete, not that no more comments exist.
130130

131+
The two source-budget arguments are optional and leave the historical behavior
132+
unchanged when omitted. A bounded caller supplies a positive
133+
`source_file_max_bytes`; `source_total_max_bytes` is an optional positive cumulative
134+
limit and requires the per-file limit. Base/head reads are bounded before decode and
135+
while streaming raw responses. If the required source side is unavailable, oversized,
136+
or outside the remaining total budget, `file_changes[].diff` uses the patch already
137+
returned by GitHub. If GitHub omitted that patch, the diff is an explicit `[SKIPPED]`
138+
marker rather than a false full-source result. Content-free counts and the aggregate
139+
`complete|partial` outcome are available at
140+
`_retrieval_meta.file_content_budget`. Bounded and legacy results use distinct cache
141+
identities so one call mode cannot silently change the other.
142+
131143
The method returns `None` if the PR cannot be retrieved.
132144

145+
## `Repository.get_file_content(file_path, sha=None, *, max_source_bytes=None)`
146+
147+
Returns the legacy generic text content or `None`. `max_source_bytes` is an optional
148+
positive caller-owned memory boundary. When supplied, GitHub's declared size is checked
149+
before decode; raw downloads are streamed and stopped locally at the same limit, and a
150+
cached value is rechecked before return. The default remains backward compatible and
151+
does not impose a new limit. This API retains the existing generic exclusion policy;
152+
use `read_text_file_bounded()` for the typed lockfile/CI-config opt-in contract.
153+
133154
## `Repository.read_text_file_bounded(file_path, sha=None, *, opt_in=None)`
134155

135156
Reads one UTF-8 repository file under a fixed 2 MiB source cap and returns a

‎docs/usage.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,24 @@ phrases. Explicit `#123` shorthand remains local.
112112
`_retrieval_meta` records bounded-fetch outcomes. A `partial` or `error` result is an
113113
unknown, not evidence that a file, comment, or match does not exist.
114114

115+
Long-lived or memory-constrained consumers may opt into source limits without changing
116+
the default API:
117+
118+
```python
119+
pr_content = repo.get_pr_content(
120+
number=15,
121+
source_file_max_bytes=128 * 1024,
122+
source_total_max_bytes=16 * 1024 * 1024,
123+
)
124+
print(pr_content["_retrieval_meta"]["file_content_budget"])
125+
```
126+
127+
Each base/head read is bounded before decode and during raw streaming. When bounded
128+
source cannot be retained, the method uses GitHub's changed-file patch; if GitHub did
129+
not provide one, it records an explicit skipped diff. The metadata contains only
130+
limits and counts, not source content. Bounded and legacy calls have separate cache
131+
identities.
132+
115133
To refresh CI evidence later without refetching the whole pull request:
116134

117135
```python

0 commit comments

Comments
 (0)