8000 feat(nfs): import files added over the NFS share by adeelahmad · Pull Request #540 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(nfs): import files added over the NFS share - #540

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-cmjahx
Oct 18, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-cmjahx

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the NFS share was served read-only, so cp onto a mounted share failed.

After: a file copied into a collection's folder on the NFS share is imported a moment after it's closed, as the account the share shows the tree as (nfs.account), with the same checks as an upload. A file Lens can't take shows in the share's log.

How: while nfs.add_files is on, rclone serves NFS without --read-only and with a VFS write cache under data_dir/cache/nfs. A closed file is put to Lens's own S3 server with the share's service key, and imported through the same share_import.Adder as S3, WebDAV and SMB. The S3 server tells the NFS key apart (file_key.service), so NFS writes follow nfs.add_files and are audited as coming over NFS. Changing the setting restarts rclone; off, the share is read-only as before.

Motivation and Context

Adeel asked that any file added through Lens's file protocols be imported automatically. #408 did S3 and WebDAV and #519 did SMB; this is the last one.

Steps to reproduce (if appropriate):

Turn on the NFS share, mount it (mount -t nfs -o port=12049,mountport=12049,nfsvers=3,tcp host:/ /mnt/lens), cp talk.pdf /mnt/lens/pods/Collections/Talks/ and look at the Talks collection.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests: test_s3_writes.py test_the_nfs_shares_key_follows_nfs_add_files, test_nfs_share.py updated. ci/local-ci.sh: backend, Next.js, pre-commit and the upgrade check pass.
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/file-shares.md, Adding files; docs/file-tree.md).
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

Done questions (AGENTS.md)

  • Goal: with this, files added over S3, WebDAV, SMB and NFS are all imported. Merged on green.
  • Agents: any NFS client adds files; nfs.add_files is in the settings API.
  • Zero setup: nothing new to install; rclone is already what serves NFS.
  • Fewest clicks: cp or drag files in.
  • Configurable: nfs.add_files (on) is a switch in Settings, NFS share; not in the wizard.
  • Light: no new dependency; rclone's write cache holds a file only until it's put to Lens.
  • Private and secure: NFS has no login, so files are added as nfs.account only, from nfs.allowed_networks, checked as uploads, never over Lens's own files. Threat model (P-NFS, entry point) updated in md, yaml and json.
  • Cost: no model calls beyond the namespace's normal pipeline.
  • User decides: the share stays off until an admin turns it on; one switch makes it read-only again.
  • Upgrades: no stored-data change; the new setting is read through DEFAULTS.
  • Honest: README built list and docs/requirements.md name the tests. Tested for real with rclone 1.75.1 and libnfs nfs-cp; CI runs the unit tests, not a mounted share.
  • Tests, docs and generated files: make openapi regenerated openapi.json and the client.
  • Open standards: NFSv3. No new dependencies.
  • Reported in the thread; refine later (in docs/file-shares.md): telling the client when Lens turns a file down, and making empty new folders collections at once.
  • Reuse: rclone's NFS server and VFS cache, Lens's own S3 server and the share_import adder.

Generated by Claude Code

While nfs.add_files is on, rclone serves NFS without --read-only and
with a VFS write cache under data_dir/cache/nfs: a file written to the
share is put to Lens's own S3 server once it's closed, with the share's
service key, and imported as nfs.account adds it. The S3 server tells
the NFS key apart (file_key.service) so NFS writes follow nfs.add_files
and are audited as coming over NFS. Off, the share is read-only as
before; changing the setting restarts rclone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013sC1p4dJXjteytbxDXnk5g
@adeelahmad adeelahmad self-assigned this Oct 18, 2026
@adeelahmad
adeelahmad merged commit 05cf38e into main Oct 18, 2026
12 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-cmjahx branch October 18, 2026 01:58
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.

2 participants

0