Skip to content

Use .relayignore exclusions and refresh sharing state#104

Open
MDerman wants to merge 4 commits into
No-Instructions:mainfrom
MDerman:codex/ignore-private-folders
Open

Use .relayignore exclusions and refresh sharing state#104
MDerman wants to merge 4 commits into
No-Instructions:mainfrom
MDerman:codex/ignore-private-folders

Conversation

@MDerman
Copy link
Copy Markdown

@MDerman MDerman commented May 29, 2026

Why

I want Relay to support local-only folders inside a shared folder. Some folders should stay on my device while the rest of the shared folder continues syncing normally.

While testing shared folders, I also found places where Relay state in Obsidian could look stale: users, roles, and newly available folders sometimes did not refresh until Obsidian was restarted. This PR also tightens those refresh paths so changes show up in the UI without a restart.

What changed

  • Added .relayignore as a local marker file for folders Relay should not sync.
  • Added folder context-menu actions to stop syncing or resume syncing a folder.
  • Added a small cloud-off indicator in Obsidian's file explorer for ignored folders.
  • Added a cleanup prompt for remote Relay metadata that already exists under an ignored folder.
  • Refreshed shared-folder state after marker, user, role, and folder changes so Obsidian does not need a restart.

Implementation

SharedFolder now tracks ignored marker roots and skips matching local and remote paths. The .relayignore file itself is treated as local control metadata, so it is never uploaded as a Relay file.

Marker scan/create/remove uses Obsidian's vault adapter instead of only the metadata tree. This matters because hidden dotfiles can exist on disk without appearing reliably in Obsidian's file cache.

Rename and move handling now checks whether a path is moving into, out of, or within an ignored subtree. Relay can then decide whether to skip the change, upload it, move existing metadata, or remove sync metadata for ignored content.

The file explorer indicator reuses Relay's existing folder navigation walker. Directly ignored folders get the stronger cloud-off marker; folders ignored by a parent marker get a muted marker.

The refresh changes update Relay's local folder/user state after relevant changes, so the settings UI and folder list do not depend on an Obsidian restart to catch up.

Tests

Added focused tests for the marker-based ignore policy:

  • .relayignore marks its parent folder and descendants ignored.
  • Sibling folders remain syncable.
  • The .relayignore marker itself is never syncable.
  • Rename/move classification covers syncable-to-syncable, syncable-to-ignored, ignored-to-syncable, and ignored-to-ignored transitions.
  • Remote cleanup collects ignored entries under marker roots, deepest paths first.

Validation run:

  • npm test -- src/ignoredFolderPolicy.test.ts src/privateFolderIgnore.test.ts
  • npm run build

I kept these tests outside the encrypted/binary SharedFolder test fixture in this checkout, so the new behavior is covered in small policy tests that can run normally.

@MDerman MDerman changed the title Ignore configurable private folders during sync Ignore private folders and refresh sharing state May 30, 2026
Ignore private relay folders during sync and surface ignored remote entries so private folders are not recreated on other devices.

Refresh remote sharing state after role/access changes and keep the new behavior tests in plaintext src/*.test.ts files because __tests__/** is git-crypt encrypted.
@MDerman MDerman force-pushed the codex/ignore-private-folders branch from 1dcaa72 to 01b5f2f Compare May 30, 2026 15:25
@MDerman MDerman marked this pull request as ready for review May 30, 2026 15:41
@MDerman MDerman changed the title Ignore private folders and refresh sharing state Use .relayignore exclusions and refresh sharing state May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant