Skip to content

Fix Obsidian plugin checks for inaccessible config files - #30331

Merged
raycastbot merged 3 commits into
raycast:mainfrom
raulkolaric:codex/obsidian-plugin-file-permissions
Aug 19, 2026
Merged

raycastbot merged 3 commits into
raycast:mainfrom
raulkolaric:codex/obsidian-plugin-file-permissions

Conversation

@raulkolaric

@raulkolaric raulkolaric commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR attempts to address #30308.

The Obsidian plugin readers call fs.readFileSync for each vault configuration. When macOS returned EPERM for 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.json and core-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 EPERM for both files and verify that those results are not cacheable. I also added raulkolaric to the extension's contributor list.

Validation:

  • npm test — 328 tests passed
  • npm run lint
  • npm run build

Fixes #30308

Screencast

Not included; this is a filesystem error path covered by unit tests.

Checklist

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
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: obsidian Issues related to the obsidian extension AI Extension platform: macOS platform: Windows labels Aug 19, 2026
@raycastbot

Copy link
Copy Markdown
Collaborator

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 commands
BRANCH="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 dev

We're currently experiencing a high volume of incoming requests. As a result, the initial review may take up to 15 business days.

@greptile-apps

greptile-apps Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR catches inaccessible Obsidian plugin configuration reads and prevents transient failures from entering the process-wide plugin-check cache.

  • Adds a cacheability flag to plugin-check results.
  • Handles community and core plugin read failures without aborting command rendering.
  • Adds regression coverage for permission failures and updates contributor metadata.

Confidence Score: 4/5

The 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 useMemo still retains the negative result with unchanged vault and plugin dependencies, leaving long-lived plugin-dependent UI unavailable after access is restored.

Files Needing Attention: extensions/obsidian/src/utils/hooks.ts

Important Files Changed

Filename Overview
extensions/obsidian/src/obsidian/internal/plugins.ts Converts plugin-check results to a structured shape and marks filesystem read failures as non-cacheable.
extensions/obsidian/src/utils/hooks.ts Skips the process-wide cache for transient failures, but the surrounding React memo still retains the failed result for the mounted component.
extensions/obsidian/src/tests/plugins.spec.ts Adds direct regression tests confirming that community and core configuration read failures produce non-cacheable results.
extensions/obsidian/package.json Adds the PR author to the extension contributor list.
extensions/obsidian/CHANGELOG.md Adds a user-facing release note for inaccessible plugin configuration handling.

Reviews (3): Last reviewed commit: "Update CHANGELOG.md" | Re-trigger Greptile

Comment thread extensions/obsidian/src/obsidian/internal/plugins.ts Outdated
Comment thread extensions/obsidian/CHANGELOG.md
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
@raulkolaric
raulkolaric marked this pull request as ready for review August 19, 2026 04:12
Comment thread extensions/obsidian/src/utils/hooks.ts
@pernielsentikaer pernielsentikaer self-assigned this Aug 19, 2026

@pernielsentikaer pernielsentikaer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@raycastbot
raycastbot merged commit 40299ba into raycast:main Aug 19, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Published to the Raycast Store:
https://raycast.com/marcjulian/obsidian

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Extension extension fix / improvement Label for PRs with extension's fix improvements extension: obsidian Issues related to the obsidian extension platform: macOS platform: Windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Obsidian]

3 participants