Repository navigation
perf: cut repeated parsing and requests in the GitHub client and extraction - #407
Merged
Merged
Conversation
sweepies
marked this pull request as draft
November 24, 2026 06:25
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
count-patchula | de5266a | Commit Preview URL Branch Preview URL |
Nov 24 2026, 06:25 AM |
sweepies
marked this pull request as ready for review
November 24, 2026 06:45
…action GitHub client: - The governor classifies a GraphQL 200 by its top-level `errors` alone: a body whose bytes cannot spell that key (literally or through a `\u` escape) is not parsed under the in-flight permit, and one that can is scanned for the three classifying fields without building a document. - `identify` reads the installation listing and the viewer together. - `App::repository_id` is single flight per repository. - GraphQL blob batches go to the cache in one write transaction each (`Cache::http_put_many`). Extraction: - Every manager reading a file as YAML shares one serde parse and one location parse through `Lines`; the YAML family locates a file only when it takes something from it, and skips YAML lockfiles. - Lockfile lookups are indexed: npm's package-lock/bun.lock versions, aube-lock key offsets, uv/poetry locks parsed once per extraction, Cargo.lock releases by name. - mise parses each configuration and the Cargo files once for every tool's redirect check. - The scanner checks `exclude` once per path, keeps enabled managers as a bitset, and path predicates compare without allocating. - The repository view asks `shared_name` once per entry and skips the final `more` pass when the chain settled; config modules are found in the tree without indexing every path; the files hash streams the JSON. Code-versioned states whose hashed sources changed are bumped, as is github-release-head, whose source holds the bumped source-head versions.
sweepies
force-pushed
the
perf/github-and-extraction
branch
from
November 24, 2026 18:51
de5266a to
674810f
Compare
Merged
This branch was successfully deployed
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.
PR 3 of the performance series: the GitHub client, manager extraction and the engine's repository scan.
GitHub client
errorsalone. If the body's bytes contain neithererrorsnor a\uescape (which is the only other way JSON can spell that key), it isn't parsed under the in-flight permit. Otherwise a small map visitor readsmessage,documentation_urlanderrorsand skips everything else without building a document. AnyRATE_LIMITEDor secondary-limit answer is still classified, including escaped keys and multi-MB bodies, and tests cover both.identify:installation/repositoriesandviewer { databaseId }now go out together withtokio::join!. Every rule in the threat model is unchanged: both reads must succeed, and the contents probe still follows. A test proves the two reads overlap.App::repository_id: single flight per(installation, repository). A failed read leaves the slot empty for the next caller.Cache::http_put_many(Store::http_putnow delegates to it).Extraction
Linescaches the file's serde documents andyaml_locationsspans. Actions, GitLab CI, npm catalogs, Helm, pre-commit, Woodpecker, APM and Copier all share one parse, and the YAML family seedsLineswith the documents it already parsed. Actions keepsfrom_str's exact single-document behaviour.HelmRepositoryare still located eagerly, so the repository map is unchanged. When locating fails, the skip warning is emitted once per file.pnpm-lock.yamloraube-lock.yaml. Selection is unchanged, soneedsand the public verdict still read them.package-lock.json/bun.lockversions (first property wins, as withObject::get_*).aube-lock.yamlkey offsets, found in one pass with the same answers astext.find, which a test checks.uv.lock/poetry.lockparsed once per extraction and indexed by PEP 503 name.Cargo.lockcrates.io releases indexed by name.excludeis checked once per path and enabled managers are a bitset. Path predicates in gradle, cargo, nuget, maven and mise no longer allocate, andpossible_sourceshort-circuits. Regexes are hoisted intoLazyLock.gradle_varsandrunner_scopebuild their line tables once.Engine
shared_nameis asked once per entry, and the finalmorepass is skipped when the chain already settled (the files are unchanged since it returned nothing).Engine::config: finds its few modules in the tree slice instead of cloning every path and SHA into a map.patchula_manager::hash_json). It produces the same bytes and the same hash, which a test checks.Versioning
These states' hashed sources changed, so they are bumped:
extract,files,config,config-files,catalog,catalog-controls,source-head,tag-catalog,tag-object,release-notesandchangelog.Some of these bumps, and the
github-release-headderive bump, had to land outside this PR's planned files:crates/engine/src/catalogs.rs(catalog),crates/datasource/src/github.rs(source-head, tag-catalog, tag-object, and the derive),crates/notes/src/{lib,releases}.rsandtests/derived-versions.tsv.crates/github/src/orcrates/engine/src/lib.rstriggers them through the parity guard. Thegithub-release-headderive is bumped only because its source file holds the bumped state constants.Tests
cargo test --locked --no-fail-fast -p patchula-github -p patchula-manager -p patchula-engine -p patchula-cache -p patchula-datasource -p patchula-notes -- --skip lockfiles::tests::real_passes;tests/corpus-extraction.tsvhas no diff.cargo clippy --workspace --all-targets --locked -- -D warningsandcargo fmt --checkare clean.Follow-ups not done here
Documentonce per extraction, and the workspace dependencyItems once per manifest.