You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SWF(perf): batch git reads in issue listing - #647
list_issues spawned one git cat-file --batch process per issue. That's a fork and exec for every row, so the list endpoint got slower with every issue a repo collected. Now it spawns one cat-file --batch, writes every blob id to it, and reads the replies back in ref order. Ref enumeration is still a single git for-each-ref. Only crates/twigpine-node/src/git/issues.rs changes.
Behavior doesn't change. A missing object is still skipped, and so is a ref deleted between enumeration and the read. A blob that isn't valid issue JSON is still filtered out.
Benchmark
Issue refs
Before (ms)
After (ms)
Speedup
0
1.058
1.088
0.97x
10
18.712
4.924
3.80x
100
163.871
9.730
16.84x
500
637.970
30.289
21.06x
1,000
1,279.264
57.968
22.07x
2,500
5,047.318
194.439
25.96x
Method: median of 9 alternating release-mode runs, calling the old and new list_issues in-process against the same warm bare repos. Fixture setup and JSON serialization aren't timed. Ubuntu x86-64 Intel Xeon VM, pinned to one logical CPU, Git 2.56.0. The 0-ref row is noise.
Separate fixtures with a non-blob ref, a corrupt blob, and a ref deleted mid-listing also matched. New unit tests pin exact output for multiline, large, and malformed blobs.
test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out
Try it
cargo test -p twigpine-node --lib git::issues
Not tested
Workspace clippy and cargo test --workspace don't compile on current main until #643 lands, so CI here will be red until then. An untouched main checkout fails the same way:
error: could not compile `twigpine-node` (lib) due to 5 previous errors
So the full node suite and the live HTTP endpoint haven't run against this change.
Summary by CodeRabbit
Bug Fixes
Issue lists now preserve large and non-JSON content instead of losing or misreading it.
Listings handle issues whose refs disappear during retrieval, and correctly continue reading subsequent issue records.
Invalid or inconsistent issue data is reported as an error rather than silently returned as a valid issue.
Review was skipped as selected files did not have any reviewable changes.
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: df474519-8313-40b9-990d-cf4aa320a7ae
Commits
Reviewing files that changed from the base of the PR and between 5455c8a and a3b6d9a.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Walkthrough
Issue blob reading now uses a stateful parser for cat-file --batch records. list_issues sends validated ref names through one batch process, handles missing refs, and rejects unconsumed output.
Changes: Issue blob reading
Layer / File(s)
Summary
Record parsing and missing-ref checks crates/twigpine-node/src/git/issues.rs
read_batch_record consumes one batch record, validates its type, size, and trailing separator, and preserves remaining output. Both individual issue readers use it and check whether a ref still resolves when its record is missing.
Batched issue listing and coverage crates/twigpine-node/src/git/issues.rs
list_issues validates enumerated refs and reads them in order through one cat-file --batch process. It skips refs that disappeared, errors if a missing record still resolves, and rejects extra output. Tests cover large and non-JSON contents, plus parsing a record after a missing record.
sequenceDiagram
participant list_issues
participant Git_for_each_ref
participant Git_cat_file_batch
participant read_batch_record
list_issues->>Git_for_each_ref: enumerate issue refs
Git_for_each_ref-->>list_issues: return ref names
list_issues->>Git_cat_file_batch: send validated ref names
Git_cat_file_batch-->>list_issues: return batch records
list_issues->>read_batch_record: parse each record in order
read_batch_record-->>list_issues: return body and remaining output
Loading
Possibly related PRs
Twigpine/node#645: Proposes the same batched list_issues reading change.
Twigpine/node#437: Introduced the unreadable-object error behavior that this change preserves.
Suggested labels:crate:node
Suggested reviewers:kevincodex1, jatmn
Merge Risk: Minimal · previous review 5455c
Issue listing now reads blobs through a single git cat-file --batch process while keeping the same output behavior, and the added tests pin exact output for large and non-JSON blobs. No defect was found in the changed file. The red CI jobs trace to compile errors in files this PR does not touch, which should clear once the separate fix (PR #643) lands.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "SWF(perf): batch git reads in issue listing" names the main change. The PR replaces one git cat-file --batch process per issue with a single batched process in list_issues, which the ti…
Description check
The description covers the core content of the template. The Summary and Motivation are present, with a clear problem statement and a benchmark. It describes the change, lists the touched file, and gi…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "SWF(perf): batch git reads in issue listing" names the main change. The PR replaces one git cat-file --batch process per issue with a single batched process in list_issues, which the title describes. The title is short and specific, uses a Conventional Commits-style scope, and does not list files.
Full details: Description check
Explanation
The description covers the core content of the template. The Summary and Motivation are present, with a clear problem statement and a benchmark. It describes the change, lists the touched file, and gives verification commands. It also explains the blocked workspace tests. Several template items are missing or unresolved: the Summary is merged into the opening paragraph, the "Closes #" issue link is empty, the Kind of change checkboxes are not ticked, the "What changed" section is a single prose paragraph rather than bullets with crate names, and the "Before you request review" checklist is not marked. The Protocol & signing block is not addressed, and the author does not say whether the cargo fmt and clippy checks pass. These gaps are non-critical, so the description is mostly complete.
Resolution
Optional improvements: fill in the "Closes #" issue reference or state that none exists, tick the Kind of change box (likely Refactor or Performance-related, though the template has no perf option), name the crate touched (twigpine-node) in the What changed section, and state whether cargo fmt and clippy pass for this change.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Fix failing CI checks
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: d6204a11-9a59-44c8-a5ff-4e617d52700b
Commits
Reviewing files that changed from the base of the PR and between 6168c55 and 5455c8a.
Files selected for processing: 1
crates/twigpine-node/src/git/issues.rs
Limit details: You’ve used the included review currently available.
The reason will be displayed to describe this comment to others. Learn more.
🟢 Thanks for the contribution. I do not see any actionable issues from my review.
Merge readiness
Required Rust CI jobs (fmt + clippy, test (stable), build --release, MSRV) are failing on this head. The author attributes failures to workspace compile errors on current main (see #643), not to crates/twigpine-node/src/git/issues.rs. Merge remains BLOCKED until the workspace builds and required checks pass; treat failures as likely unrelated to this diff until PR 643 (or equivalent) lands and CI is green on a rebased head.
Closed duplicate PR 645 proposed the same batched listing change; 647 is the active line.
Auto-generated CodeRabbit release notes in the PR body contradict implementation (they claim JSON validation behavior this PR does not change). Safe to ignore for merge; avoid treating them as release truth.
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
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.
Listing 1,000 issues took 1.28 s. Now it's 58 ms.
list_issuesspawned onegit cat-file --batchprocess per issue. That's a fork and exec for every row, so the list endpoint got slower with every issue a repo collected. Now it spawns onecat-file --batch, writes every blob id to it, and reads the replies back in ref order. Ref enumeration is still a singlegit for-each-ref. Onlycrates/twigpine-node/src/git/issues.rschanges.Behavior doesn't change. A missing object is still skipped, and so is a ref deleted between enumeration and the read. A blob that isn't valid issue JSON is still filtered out.
Benchmark
Method: median of 9 alternating release-mode runs, calling the old and new
list_issuesin-process against the same warm bare repos. Fixture setup and JSON serialization aren't timed. Ubuntu x86-64 Intel Xeon VM, pinned to one logical CPU, Git 2.56.0. The 0-ref row is noise.Process count at 1,000 refs, from
strace:Same output
Raw listings and the HTTP JSON were byte-identical before and after at every count above. SHA-256 of the 1,000-ref JSON:
Separate fixtures with a non-blob ref, a corrupt blob, and a ref deleted mid-listing also matched. New unit tests pin exact output for multiline, large, and malformed blobs.
Try it
cargo test -p twigpine-node --lib git::issuesNot tested
Workspace clippy and
cargo test --workspacedon't compile on current main until #643 lands, so CI here will be red until then. An untouched main checkout fails the same way:So the full node suite and the live HTTP endpoint haven't run against this change.
Summary by CodeRabbit