Add novem --load tree sync with --dry-run#228
Merged
Conversation
`--load` previously walked a dumped folder and blindly PUT+POSTed every
file, leaving stale remote files in place, rewriting unchanged ones, and
reporting success regardless of the server response. Make it a real sync
that treats the local folder as the desired state of the resource:
* create files that don't exist remotely
* overwrite only files whose content differs (single-line values log
the old -> new change instead of a byte count)
* delete remote files no longer present locally
* leave unchanged files untouched
`--dry-run` prints the planned actions without sending any request.
Only real file_content-backed files are synced. The directory listing
flattens every leaf to type="file", so selection keys on the DELETE verb
in each node's `actions`: read-only files (no DELETE) and virtual/computed
files like `notifications` (POST but no DELETE) are excluded. Virtual
paths that exist remotely are tracked so a stale local copy is ignored
rather than re-created every run. Shares (`/shared/`) round-trip as
links created via PUT (POST 405s on them); tags (`/tags/`) are excluded
entirely as they're managed via the -t flag.
Each create/overwrite/delete is gated on its POST/DELETE status: failures
print a FAILED line and are tallied under a `N failed` summary suffix
instead of being counted as done.
The dump/load logic is shared by the vis and job APIs, so it lives in a
NovemTreeSync mixin in novem/sync.py; each class supplies a base-path and
a label hook. Covered by tests/test_load_sync.py.
2d50ef2 to
a0e28b8
Compare
sondove
approved these changes
Jun 3, 2026
sondove
approved these changes
Jun 3, 2026
Collaborator
|
Could've considered a |
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.
What
Turns
--loadinto a real tree sync and adds a--dry-runpreview.--load/--dumplet you round-trip a resource's file tree (plots, grids, docs, mails, jobs) to/from a local folder.Previously
--loadwalked the dumped folder and blindlyPUT+POSTed every file — leaving stale remote files in place, rewriting unchanged ones, and reporting success regardless of what the server returned. Now it treats the local folder as the desired state:old -> newchange instead of a byte count)--dry-runprints the planned actions without sending any request.Notable behaviour
file_content-backed files are synced. The directory listing flattens every leaf totype="file", so selection keys on theDELETEverb in each node'sactions. Read-only files (no DELETE) and virtual/computed files likenotifications(POST but no DELETE) are excluded — and virtual paths that exist remotely are tracked so a stale local copy is ignored rather than re-created on every run./shared/) round-trip as links created viaPUT(they405on POST)./tags/) are excluded — they're managed via the-tflag.FAILEDline and are tallied under aN failedsummary suffix instead of being silently counted as done.Structure
The dump/load logic is shared by the vis and job APIs, so it lives in a
NovemTreeSyncmixin innovem/sync.py; each class supplies a base-path and a label hook. Filesystem code usespathlib.Testing
tests/test_load_sync.pycovers create/overwrite/delete/unchanged, dry-run, failure reporting, single-line diffs, and the virtual/shares/tags handling.