Repository navigation
perf(artifacts): run the asset catalog and Interface Builder bundle walks together - #3285
Merged
Merged
Conversation
…alks together inspect_asset_catalog walked the app bundle for Assets.car files and then walked it again for the Interface Builder graph that supplies resource keys. The analyses are independent, so start the Interface Builder one first and let a catalog failure cancel it and win, as the sequential order did. Keynote 4.20 s -> 2.89 s with identical output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Contributor
|
…o pin overlap Keep the Interface Builder stub pending until catalog inspection starts, and keep catalog inspection pending while asserting an early Interface Builder failure has not escaped. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kaoru0822-kitauji
marked this pull request as draft
October 14, 2026 08:03
kaoru0822-kitauji
marked this pull request as ready for review
October 14, 2026 08:22
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
This was referenced Oct 21, 2026
Closed
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.
Summary
inspect_asset_catalogwalks the app bundle twice, one after the other. It first finds and inspectsAssets.carfiles, then runs the full Interface Builder analysis, whose own bundle walk supplies resource keys for the asset-key join. On large Apple bundles each walk takes about 1.7 s. The two analyses are independent and read-only, so this PR starts the Interface Builder analysis first and lets both run together. Output is identical; Keynote drops from 4.20 s to 2.89 s.No linked issue: this is a hotspot I measured in a sweep of static tools over
/Applicationsbundles (Keynoteinspect-asset-catalog: 4.1 s).Problem and expected behavior
rea inspect-asset-catalog /Applications/Keynote.appon main307af044b: 4.2 s wall, 2.1 s of it system time. A CPU profile shows 2.7 s idle (I/O) on the main thread,#readDirectory/assertContainedDirectoryfrom two bundle walks, and oneassetutil --infochild (0.15 s). Phases measured with the dist modules: catalog walk 1,690 ms (37k entries, 1Assets.car), thenanalyzeInterfaceBuilderBundle1,782 ms.Change and scope
src/artifacts/apple/AppleAssetCatalogAnalysis.tsonly:collectAssetCatalogs.analyzeAppleAssetCatalogsstarts the Interface Builder analysis before collecting catalogs, on its ownAbortControllercombined with the caller's signal (AbortSignal.any).assetutil, metadata limit, or the non-file-only case) cancels the Interface Builder analysis, waits for it to settle, and is reported.analyzeInterfaceBuildersits beside the existingrunAssetUtilseam; production usesanalyzeInterfaceBuilderBundle.DirectoryArtifactReaderper-entry containment checks, or output.Contract and boundary impact
Semantic owner and earliest changed stage: asset catalog workflow orchestration.
Contribution scope fit and linked maintainer decision: existing read-only static inspection; not applicable.
CLI and MCP/tool-catalog contract: unchanged.
Provider, bridge, target-format, or platform compatibility: unchanged (
assetutilon macOS).Evidence, artifact, provenance, or reconstruction contract:
normalized_resultbyte-identical on every app tested.Target selection, authority, upstream behavior, and cleanup details: same reads; the IB analysis is cancelled and settled on catalog failure; caller cancellation reaches both.
Generated metadata, package, or installation impact: none.
Read existing files or captured data.
Launch or attach to a process.
Inject instrumentation or run scripts/code.
Change process memory, registers, files, or configuration.
Contact network services.
Recover protected code or work around protections.
Documentation or usability only; no target interaction.
Not sure yet; investigation or maintainer guidance needed.
Evidence and regression coverage
Real CLI, main
307af044bvs this branch, mean of 3 runs, macOS 26.7.1 arm64:rea inspect-asset-catalognormalized_resultKeynote and GarageBand were re-measured interleaved (main/branch alternating, 3 each) to rule out load noise. Agent token cost is unchanged (same output); the win is time to an answer. CPU rises slightly because the walks overlap.
Tests (
src/artifacts/apple/AppleAssetCatalogAnalysis.test.ts, new describe block; the review follow-up 726190d holds work open with controlled promises). Mutating the implementation to await the Interface Builder analysis before catalogs makes the overlap and cancellation tests fail; against main's implementation the cancellation and early-failure tests fail:keeps the Interface Builder analysis running while catalogs are inspected: the Interface Builder stub stays pending until catalog inspection starts, so a sequential implementation times outcancels the Interface Builder analysis and reports a catalog failure: checks the IB analysis observes cancellation and settles before the call rejects with the catalog error.reports an early Interface Builder failure only after catalogs are inspected: catalog inspection is held open while the Interface Builder stub rejects; the call must not settle until the catalog finishesRemaining proof gaps: none known. Peak RSS moves by about ±15 MB, since both analyses' working sets can now overlap.
Validation performed
npm run typecheck— passnpm run lint— 0 errorsnpm run jscpd— pass (3.20%)npm run test:focusedon 16 files covering asset catalogs and Interface Builder (module, boundary, acceptance) — 141 passed, 8 skippedCompatibility, safety, and release
assetutil.Author readiness
Human owner:
Before merge
type(scope): outcome.🤖 Generated with Claude Code