Fix Obsidian plugin checks for inaccessible config files - #30331
Conversation
Keep plugin discovery from crashing when macOS denies access to an Obsidian configuration file. The synchronous reads previously happened before the existing error boundary, so EPERM escaped during command rendering. Changes: - extensions/obsidian/src/obsidian/internal/plugins.ts - Move community and core plugin file existence checks and reads inside their error boundaries. - Log read failures and preserve the existing undefined fallback. - extensions/obsidian/src/tests/plugins.spec.ts - Cover EPERM failures for community and core plugin configuration reads. - Restore filesystem spies after each test. - extensions/obsidian/CHANGELOG.md - Document the plugin configuration permission fix. - extensions/obsidian/package.json - Add raulkolaric to the contributor list. Validation: - npm test (328 tests passed) - npm run lint - npm run build - git diff --check
|
Thank you for your contribution! 🎉 🔔 @marcjulianschwarz @KevinBatdorf @iancanderson @pernielsentikaer @ofalvai @AdamAdamsMusic @FServais @rakoort @MuuNU @theherk @vicampuzano @ErBlack @byheaven @tofrankie @alexibuild @RLuf you might want to have a look. You can use this guide to learn how to check out the Pull Request locally in order to test it. 📋 Quick checkout commandsBRANCH="codex/obsidian-plugin-file-permissions"
FORK_URL="https://github.com/raulkolaric/extensions.git"
EXTENSION_NAME="obsidian"
REPO_NAME="extensions"
git clone -n --depth=1 --filter=tree:0 -b $BRANCH $FORK_URL
cd $REPO_NAME
git sparse-checkout set --no-cone "extensions/$EXTENSION_NAME"
git checkout
cd "extensions/$EXTENSION_NAME"
npm install && npm run devWe're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days. |
Greptile SummaryThe PR catches inaccessible Obsidian plugin configuration reads and prevents transient failures from entering the process-wide plugin-check cache.
Confidence Score: 4/5The PR is not yet safe to merge because restored filesystem access remains unobserved while a plugin-checking component stays mounted. The process-wide cache no longer stores transient failures, but Files Needing Attention: extensions/obsidian/src/utils/hooks.ts Important Files Changed
Reviews (3): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile |
Treat filesystem read errors as transient plugin-check results so they do not persist in the process-wide cache after access is restored. Keep known plugin states cacheable and use the repository's merge-date placeholder for the changelog entry. Changes: - extensions/obsidian/src/obsidian/internal/plugins.ts - Return a named plugin-check result with an explicit cacheable flag. - Catch configuration read failures at the aggregate check boundary and mark the result non-cacheable. - Preserve cached handling for missing files and malformed JSON. - extensions/obsidian/src/utils/hooks.ts - Cache plugin-check results only when every configuration read completed normally. - extensions/obsidian/src/tests/plugins.spec.ts - Verify EPERM results for community and core plugin files are non-cacheable. - Update assertions for the named plugin-check result. - extensions/obsidian/CHANGELOG.md - Replace the literal date with the PR merge-date placeholder. Validation: - npm test (328 tests passed) - npm run lint - npm run build - git diff --check
pernielsentikaer
left a comment
There was a problem hiding this comment.
Hey @raulkolaric — nice catch on the iCloud EPERM crash. Daily Note (and the other plugin-gated commands) no longer blow up when community-plugins.json / core-plugins.json cannot be read, and skipping the process-wide cache on those failures is the right call so a later run can see the vault again. The community/core tests and {PR_MERGE_DATE} changelog look solid. Thanks for the quick follow-up on Greptile’s first pass as well.
|
Published to the Raycast Store: |
|
🎉 🎉 🎉 We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag. |
Description
This PR attempts to address #30308.
The Obsidian plugin readers call
fs.readFileSyncfor each vault configuration. When macOS returnedEPERMfor an iCloud-hosted vault, that exception escaped during the shared plugin check and aborted the Daily Note command's render.The shared plugin check now catches read failures for both
community-plugins.jsonandcore-plugins.json, logs them, and reports the vault as unavailable for the current render instead of crashing. It also marks that result as non-cacheable, so restoring filesystem access can be observed on the next check rather than leaving a transient failure in the process-wide cache. Successful reads, missing files, and malformed configuration keep their previous cache behavior.The regression tests simulate
EPERMfor both files and verify that those results are not cacheable. I also addedraulkolaricto the extension's contributor list.Validation:
npm test— 328 tests passednpm run lintnpm run buildFixes #30308
Screencast
Not included; this is a filesystem error path covered by unit tests.
Checklist
npm run buildand tested this distribution build in Raycastassetsfolder are used by the extension itselfREADMEare located outside the metadata folder if they were not generated with our metadata tool