Repository navigation
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/23388
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 Unclassified FailureAs of commit 8b95a2e with merge base 61ec450 ( UNCLASSIFIED FAILURE - DrCI could not classify the following job because the workflow did not run on the merge base. The failure may be pre-existing on trunk or introduced by this PR:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
0485975 to
8bdd47d
Compare
aa99feb to
7998984
Compare
|
@claude review this PR |
|
Claude finished @metascroy's task in 1m 28s —— View job This PR adds descriptor-based storage primitives for the Core AI cache. It doesn't need to block on anything, but the rename in Detailed reviewPR Review: #23388SummaryThe PR adds the Code Quality
API Design
Testing
RecommendationApprove (with minor changes) Nothing blocks approval. The |
7998984 to
04a20e6
Compare
8bdd47d to
5f68c11
Compare
|
@claude review this code Updated head: Context on the previous findings: retaining the raw descriptor return from |
|
Claude finished @metascroy's task in 3m 24s —— View job This revision fixes the earlier durability, Unicode and coverage points, but three issues remain: a failed Detailed reviewPR Review: #23388SummaryThe PR adds descriptor-based storage primitives for the Core AI cache: root preparation, backup exclusion, listing, Thread Safety
API Design
Testing
Code Quality
RecommendationApprove (with minor changes) Nothing blocks approval. Fix the partial-file cleanup in |
Summary:
Add the filesystem layer the Core AI runtime uses for its asset and bookmark
cache (`runtime/coreai_storage.{h,mm}`, `runtime/coreai_file.h`).
- Prepare an absolute storage root chosen by the application. Creating a root
also excludes it from backup; inspecting an existing root changes nothing.
- Enumerate directories through descriptors and return sorted names, failing
on operational errors rather than returning partial listings.
- Write new files relative to a directory descriptor and `fsync` each file and
its parent directory.
- Publish data atomically: write a temporary file, `fsync` and `F_FULLFSYNC`
it, `renameat` it into place and sync the directory. Readers see either the
old or the new complete bytes. A failure before the rename leaves the old
bytes and removes the temporary file.
- Tree removal is not included here; it lands with cache clearing.
- README: the "Asset storage" root, durability and backup-exclusion text.
Trust model: the application owns the cache directory. The helpers do not
defend against other processes of the same user renaming or replacing paths
inside it.
Fault injection points use `storage_fault()`, which compiles to a constant 0
unless `COREAI_ASSETS_TESTING` is defined. Only the `coreai_host_test` target
defines it.
No changes outside `backends/apple/coreai`.
Test Plan:
```
# Local: configure and build only
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_DEPLOYMENT_TARGET=27.0 -DEXECUTORCH_BUILD_COREAI=ON \
-DEXECUTORCH_BUILD_TESTS=ON -DEXECUTORCH_BUILD_EXTENSION_DATA_LOADER=ON
cmake --build build --target backends/apple/coreai/all
# CI (macOS 27 runner, .github/workflows/coreai.yml)
ctest --test-dir build/backends/apple/coreai --output-on-failure --no-tests=error
```
CTest runs `coreai_host_test`, which adds the storage suite.
AtomicPublicationPreservesOldBytesOnFailure checks that a failed rename leaves
the old bytes and no `.tmp-*` entry.
The filesystem tests now own the fault-injection build setting that was removed from the parser-only base, where it had no consumers. Test Plan: Built and ran coreai_host_test locally on macOS 27. All 28 parser and filesystem tests passed, including injected atomic-publication failure. Authored with assistance from Devmate (OpenAI GPT-6-Astra).
Summary: Keep failed writes from blocking retries and prevent directory listings from disturbing other readers. Reject invalid roots consistently, preserve strict publication durability, and cover directory-sync failures. Remove a fixture that APFS cannot create. Test Plan: All 46 native tests passed with zero skips, including partial-write cleanup and retry, independent enumeration offsets, root validation, and directory-sync ordering/failure/interruption checks. All 113 CoreAI Python tests passed. Formatting and whitespace checks passed.
04a20e6 to
61a5f2d
Compare
Reduce redundant filesystem work during cache preparation, particularly on iOS, while giving newly created cache contents an explicit first-unlock protection policy. Preserve backup exclusion and durability behavior, use default directory permissions, and leave existing cache contents unmigrated. Test Plan: Native filesystem tests passed, including protection inheritance, default permissions, creation-free warm paths, concurrent creation, invalid paths, and failure/retry durability. The combined bookmark-layer suite previously passed all 95 native tests; the Python suite passed all 113 tests.
Adds the filesystem layer the Core AI runtime uses for its asset and bookmark cache (
runtime/coreai_storage.{h,mm},runtime/coreai_file.h).fsynceach file and its parent directory.fsync+F_FULLFSYNCit,renameatit into place and sync the directory. A failure before the rename keeps the old bytes and removes the temporary file.storage_fault(), which compiles to a constant 0 unlessCOREAI_ASSETS_TESTINGis defined (only incoreai_host_test).coreai_host_test.No changes outside
backends/apple/coreai.Stack: 2 of 9, based on #23387. Review only this PR's commit. Next: #23389.
Test plan: built locally for macOS 27.0;
ctest -Nlistscoreai_host_test, which the Core AI workflow runs on the macOS 27 runner.lintrunneris clean.