Skip to content

Rule out a manifest's root that is not on this device - #23

Merged
adammharris merged 2 commits into
mainfrom
manifest-root-absent
Oct 28, 2026
Merged

adammharris merged 2 commits into
mainfrom
manifest-root-absent

Conversation

@adammharris

Copy link
Copy Markdown
Member

prov ignore ruled a manifest's root out only when its walk met it. On a device the archive never reaches (one held on another machine, prov #22), the root is absent, so the list said nothing about it, and a copy put there later was handed to whatever syncs the folder.

The root is now ruled out as claimed whether or not it is present, named alone (/photo) so that it matches a link or a directory. It is found from the reachable nodes named by the <dir>.<ext> convention, so a page costs no probe.

  • prov/src/workspace/ignore.rs: absent_roots, run after the walk, skipping any root a rule already covers.
  • Test: a_claimed_archive_not_on_this_device_is_ruled_all_the_same.
  • docs/manifests.md §3.5: one bullet.

On the Harris library, a copy without the share now lists /photo (claimed), as the NAS's own copy does. All prov tests pass, and clippy and fmt are clean.

An archive kept on another machine never reaches the devices its workspace
travels to, so the walk never meets its root and the list said nothing
about it. A copy put there later would then be handed to whatever syncs
the folder, though the manifest pins every file that belongs there.

The root is now ruled out as claimed all the same, named alone (/photo)
so that it matches a link or a directory. Found from the reachable nodes
named by the <dir>.<ext> convention, so a page costs no probe.
@adammharris

Copy link
Copy Markdown
Member Author

Review

Reviewed head 3d417b1ffc1d5f4f6a16eb5a2ae21af81e73f13d. No P0/P1 findings; two P2 issues:

  1. P2 — Resolve the declared root instead of deriving it from the node name. prov/src/workspace/ignore.rs:191–204. With a reachable album.yaml pointing to album.manifest.yaml containing root: photos/, and no photos on disk, prov ignore returns no rule. The pass only tests album, and manifest_node_for(album) rejects the manifest because its actual root is photos. The documented rename operation (§6) produces this layout while leaving the archive in place. I also reproduced the omission with catalog/album.yaml → root: ../photos/ and photo.yaml → root: media/photos/. These devices retain the original failure: a later archive copy has no skip rule and can enter sync/history. Resolve each reachable manifest node's authoritative manifest → root chain, retaining the existing coverage check, and add a renamed/relocated-root regression case.

  2. P2 — Avoid reading the record store again as a prospective node. prov/src/workspace/ignore.rs:189–204. reachable_files includes photos.manifest.yaml as well as photos.yaml. For the record-store entry this loop invents the absent root photos.manifest, then manifest_node_for calls manifest_of(photos.manifest.yaml), reading and parsing the entire row store merely to discover that it has no manifest attribute. The real node's lookup separately reads/parses the same store. Linux inotify confirmed two opens per ignore call; a valid 9,900,040-byte fixture took about 1.8–2.4 seconds with the debug CLI. Bypassing just the record-store candidate reduced this to one open and about 1.0 second. This pass runs after reachable_files' read scope closes; moreover the memo excludes documents over 1 MiB, so adding a scope alone would not eliminate the large-store duplicate. Restrict discovery to actual manifest nodes and reuse each resolved root, avoiding the second parse of a potentially large store.

Validation: cargo test -p prov passed (538 unit tests, 16 public API tests, 2 doctests); cargo clippy --workspace --all-targets -- -D warnings passed. Separate CLI fixtures confirmed the conventional absent-root case, dangling symlinks, conventional nested roots, nested-workspace rule prefixing, and suppression beneath an already-ruled ancestor. git check-ignore confirmed /photo matches both a dangling symlink and a directory including its descendants. The added test covers the conventional unheld absent-root case; it does not catch either issue above. Emitting a synthetic absent-path rule is consistent with the intended preventive behavior, although the module's disk-subtraction description now needs qualification.

… once

Review on #23: the absent root was guessed from the node's name, so a
node renamed away from its archive (album.yaml, root: photos/) left the
archive unruled; and the record store was read as a candidate node, so
a 9.5 MB store was parsed twice.

The nodes are now found among the reachable documents small enough to
be one, and a larger one only when no node names it as its store. Each
node's declared root is resolved through manifest_of, one parse, inside
the list's own read scope.
@adammharris

Copy link
Copy Markdown
Member Author

Both points taken, in c6481f9:

  1. The root is now the one each manifest declares (manifest_of → checked_root), not one guessed from the node's name. New test: a_renamed_node_s_absent_root_is_the_one_it_declares, renaming photos.yaml to catalog/album.yaml and removing the archive.
  2. A record store is no longer read as a candidate node. Nodes are found among reachable documents of at most 64 KiB, and a larger one is read only when no node names it as its store. So each store is parsed once, inside the list's own read scope. On the Harris library (a 9.5 MB store), prov ignore takes 0.16 s in a release build.

The module doc now says this is the one rule for a path not on disk.

@adammharris
adammharris merged commit 99155ab into main Oct 28, 2026
8 checks passed
@adammharris
adammharris deleted the manifest-root-absent branch October 30, 2026 01:25
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