-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Track file modifications to prevent footguns #26
Comments
Shadow53
added a commit
that referenced
this issue
Aug 30, 2021
* feat: create unique UUID for each system * test: fix tests * feat: impl last paths checks and force flag This commit includes the relevant `LastPaths` types, implementing checks for changed paths. Also includes a `--force` flag for allowing the operation to continue without the check. * test: add last_path tests * refactor: create and use Checker trait for LastPaths * feat: add Operation Checker * fix: fix clippy lints * ci: add proper integration test for last_paths * style: run cargo fmt * ci: try to fix running python script in CI * fix(ci): fix imports in test.py * fix(test.py): args -> argv * ci: do not error if files don't exist yet * ci(test.py): create parent directories as needed * ci(test.py): parent is attribute, not method * ci(test.py): don't shadow variables * ci(test.py): args might be a list * ci: attempt to set home folder for integration tests * ci: fix hardcoded home directories * ci: use single instead of double quotes * fix: show what environment variable failed to expand * ci: see if setting shell fixes setting env * ci: fix env in test.py * ci(test.py): use correct env values * fix: process paths after getting matches Resolves #28 * ci(config.toml): add unix to exclusivity list * feat: improve hoard env processing Rather than creating a sum of scores, which can easily have collisions between different sets of scores, keep track of every score in the tree path. A path is considered a better match using the following algorithm: 1. The path with more nodes is better. 2. If paths are equal length, the one with more higher numbers is better. - Of `A: [7, 3, 2, 1]` and `B: [5, 4, 3, 2]`, `B` is the better match because it generally has higher scores than `A`. 3. If the paths have equal numbers of higher scores, abort with error. * style: run cargo fmt * ci: trace integration tests * fix: improve debugging messages in envtrie * fix(envtrie): set score correctly on created nodes * chore: run cargo update * fix: change how weighted map is calculated Previously, a topological sort of a DAG gave every environment a unique weight. When setting scores on nodes was fixed, this broke an integration test that ensures an error occurs in ambiguous situations. Given: ``` exclusivity = [ ["foo", "bar"], ["baz", "bar"] ] [hoards.example] "foo" = "/some/path" "baz" = "/other/path" ``` Should foo or baz be chosen? The answer is neither, because they are equal precedence over bar. The DAG method gave them unique weights, though, so no error occurred. This is fixed by simplifying how weights are determined: just use the reverse-order index in the exclusivity list. In this case, inserting a mutually exclusive item between foo and bar will cause foo to be chosen over baz. This is fine though, since we interpret this to mean that foo is more specific than baz. * ci: remove trace for integration tests * ci: more explicitly make sure env is set every time * ci: fix config file, revert setting env explicitly * ci(test.py): fix calls to running hoard * ci: skip jobs when things haven't changed * ci: set revision on paths-filter * ci(test.py): list expected files in directories * ci(test.py): direntries must be strings * ci(test.py): undo overzealous find/replace * ci(test.py): reposition the force flag * ci(test.py): make kwargs explicit * fix(config): localize use of LocalPaths * ci(test.py): insert missing command * ci(test.py): print debugging information on error * ci(test.py): convert Path to str before subprocess.run * ci(test.py): build Path instead of using strings * ci(test.py): fix script errors * ci: use action to install latest Python * ci: add branch to python-install action * ci: add C drive to config.toml * style: run cargo fmt * test: add operation checker integration test * fix: fix operations checker, add more logging * fix: make clippy and rustfmt happy * ci: add operations integration check to CI * refactor: minor cleanup * refactor: use only HashMaps, not also BTreeMaps * refactor: actually impl Checker and use the impls * style: run cargo fmt * fix: last_paths tests * ci: install tree on macos * test: no need to truncate; move around whitespace
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This serves as a meta-issue for both #12 and #21.
Track:
Usage:
hoard diff
command. (Detect file diffs #12)hoard restore
(use last local checksum) (Handling deleted files #21)hoard backup
(Handling deleted files #21)TODO:
The text was updated successfully, but these errors were encountered: