Use .relayignore exclusions and refresh sharing state#104
Open
MDerman wants to merge 4 commits into
Open
Conversation
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.
1dcaa72 to
01b5f2f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
.relayignoreas a local marker file for folders Relay should not sync.cloud-offindicator in Obsidian's file explorer for ignored folders.Implementation
SharedFoldernow tracks ignored marker roots and skips matching local and remote paths. The.relayignorefile 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-offmarker; 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:
.relayignoremarks its parent folder and descendants ignored..relayignoremarker itself is never syncable.Validation run:
npm test -- src/ignoredFolderPolicy.test.ts src/privateFolderIgnore.test.tsnpm run buildI 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.