Repository navigation
fix(apps): treat a deeply nested registry cache file as absent - #31779
Conversation
f386ccc to
014fb71
Compare
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: this closes a small, real gap at the right layer. The three cache readers now treat a JSON body nested too deeply to decode as "absent", the same way they already treat every other malformed body. [DESIGN-REVIEWED] ea917b5 Description read[DESCRIPTION-READ] 43ecdf795a79797cdf196bfa8e039878ce0f0aeee0e4d60ca9c31e55582a9448 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (4 items) — 4 justifiedIntent: a corrupted or planted registry cache file that is nested too deeply should count as "no cached copy" instead of crashing the App Store listing or the store-art prewarm. This is a FIX (#22359).
[FIRST-PRINCIPLES-REVIEWED] ea917b5 Description read[DESCRIPTION-READ] ce931cf69d3aa063fb89f8d6921284806e120a0c53a212fd1785a2bdf756aee6 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
014fb71 to
dcb8843
Compare
dcb8843 to
e0d3e7e
Compare
Three readers of the agent-writable registry cache directory (the manifest cache, the external registry cache and the clone-failure record) let RecursionError from json.loads escape. A body nested deeply enough to exhaust the decoder's stack then dropped a registry from the App Store listing or ended the store-art prewarm batch, instead of reading as "no record" as every other malformed body does. Each reader's except now lists RecursionError, matching the readers #22300 already guarded. Closes #22359
e0d3e7e to
ea917b5
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved: PR Readiness passed on ea917b5, and all five review lanes (Opus 5.5, GPT 6.1, Design, UX, First Principles) report no blocking finding on this head. No conflict and no open change request.
Three readers of the agent-writable registry cache directory (the manifest cache, the external registry cache and the clone-failure record) let RecursionError from json.loads escape. A body nested deeply enough to exhaust the decoder's stack then dropped a registry from the App Store listing or ended the store-art prewarm batch, instead of reading as "no record" as every other malformed body does. Each reader's except now lists RecursionError, matching the readers #22300 already guarded. Closes #22359 (cherry picked from commit 94de517)
Three readers of the agent-writable registry cache directory (the manifest cache, the external registry cache and the clone-failure record) let RecursionError from json.loads escape. A body nested deeply enough to exhaust the decoder's stack then dropped a registry from the App Store listing or ended the store-art prewarm batch, instead of reading as "no record" as every other malformed body does. Each reader's except now lists RecursionError, matching the readers #22300 already guarded. Closes #22359 (cherry picked from commit 94de517)
Problem / Motivation
Goal: A registry cache file nested too deeply to decode reads as "no cached copy", like any other malformed cache file, instead of raising out of the App Store listing or the store-art prewarm.
Three readers of the agent-writable registry cache directory parse their file with
json.loadsinside anexceptthat does not listRecursionError: the manifest cache (_read_manifest_cache), the external registry cache (_read_external_registry_cache) and the store-art clone-failure record (_read_clone_failure). A body under the size cap that nests deeply enough to exhaust the decoder's stack raisesRecursionError, which escapes the reader.The issue names the first and third; the external registry cache reads from the same directory with the same
except, so it is the same defect. TheUnicodeDecodeErrorgap the issue also mentions for the manifest cache is already closed on main.Why it matters
The cache directory is writable by the agent, so one planted or corrupted file is enough. A nested external registry cache makes that registry's load raise instead of re-fetching, so its apps drop out of the App Store listing. The manifest-cache and clone-failure reads sit in the owner-tier prewarm's pre-filter, outside its per-row error handling, so one such file ends the whole store-art batch. Every other malformed body in these files already reads as absent; this one shape does not.
Not a goal
What changed (motivation → approach → change)
A cache file nested past the JSON decoder's stack made its reader raise
RecursionErrorinstead of returning "absent".The decoder raises
RecursionError, which is neitherValueErrornorOSError, and the three readers'exceptclauses named only those. The readers #22300 added or changed already list it.Each of the three
exceptclauses inapps/registry_pipeline/caches.pyandstore_art.pynow listsRecursionError, so the nested body takes the same "no record" path as any other malformed body.Backwards compatibility
Compatible: a reader that used to raise on this body now returns the same "absent" answer it gives for every other malformed body; well-formed files read exactly as before.
Removes nothing: no path, record, key or function is removed or narrowed.
Tests
test_apps_registry_coverage_manifests.py: a manifest cache file and an external registry cache file nested past the decoder read asNone; aRecursionErrorfails the test.test_registry_store_art_prewarm_rewarm.py: a clone-failure record nested past the decoder reads asNone.stray_line_helpers.too_deep_to_decode(), which probes this interpreter's decoder ceiling instead of hardcoding a depth.-n0, 10 runs at-n 4 --dist loadgroup --max-worker-restart=2besidetest_app_metadata_undecodable.pyandtest_registry_store_art_prewarm_order.py, and both touched test files in a shuffled order (seed 9664).Proof: PROVEN test/test_apps_registry_coverage_manifests.py::TestManifestCache::test_cache_nested_past_the_decoder_stack_reads_none, test/test_apps_registry_coverage_manifests.py::TestManifestCache::test_external_cache_nested_past_the_decoder_stack_reads_none, test/test_registry_store_art_prewarm_rewarm.py::TestCloneFailureBackoff::test_a_record_nested_past_the_decoder_stack_reads_as_absent (head f386ccc)
Manual verification
N/A — unit coverage sufficient: each reader is a pure file-to-value function, and the tests write the nested body to the real cache path and call the reader.
Screenshots / video
N/A — no user-visible frontend surface is touched.
Related Issues
Closes #22359
Sibling sweep
Swept: git grep -n -A6 "json.loads" -- src/kiro_crew/apps/registry_pipeline/ src/kiro_crew/apps/registry.py
Sibling: src/kiro_crew/apps/registry_pipeline/caches.py -- changed here
Sibling: src/kiro_crew/apps/registry_pipeline/store_art.py -- changed here
Sibling: src/kiro_crew/apps/registry_pipeline/indexes.py:243 -- not affected -- reads a fresh clone of the index, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/manifests.py -- not affected -- reads the installed checkout or a fresh clone, not the cache directory; the listing gathers with return_exceptions=True and keeps the bare row
Sibling: src/kiro_crew/apps/registry_pipeline/install.py:861 -- not affected -- reads the clone being installed, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/install_clone.py:430 -- not affected -- reads the clone being installed, not the cache directory
Sibling: src/kiro_crew/apps/registry_pipeline/sources.py:784 -- not affected -- reads the bundled registry file shipped with the package, not the cache directory
Sibling: src/kiro_crew/apps/registry.py:145 -- not affected -- reads the app's own package.json during its build, not the cache directory
In the two changed files, the readers #22300 added or changed (
_read_installed_manifest_cache,_read_unobtainable_art,_stale_row_art_present) already listRecursionError, and the fresh clone'sapp.jsonread instore_art.pyruns inside the prewarm worker, whose per-row handler logs and skips any exception.Pattern harvest
Rule candidate: review-prompt
Pattern: json.loads of a file from an agent-writable directory inside an except that lists ValueError or JSONDecodeError but not RecursionError
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)