Repository navigation
feat(cli): add pinned fleet inventory listing - #784
Conversation
Signed-off-by: hushen <[email protected]>
Signed-off-by: hushen <[email protected]>
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at 6d6c13af6c4276197fb12c7ae66ae55c13be44d3. Approving.
You caught the trap the issue named: SocketTarget::try_from_str accepts "" and relative/path, and your parser refuses both itself. Reading each [[host]] as a toml::Value first, so an entry that fails to deserialise is still reported by its name, is a nice touch.
Your tests and five mutants, in a container at this head with cargo test -p sysknife-cli --offline --locked fleet:
== pristine
running 7 tests ... test result: ok. 7 passed; 0 failed
running 2 tests ... test result: ok. 2 passed; 0 failed
== M1 zero-host check off
test fleet::tests::refuses_empty_inventory ... FAILED
== M2 Host deny_unknown_fields off
test fleet::tests::refuses_unknown_fields ... FAILED
== M3 relative unix path allowed
test fleet::tests::refuses_empty_relative_and_invalid_sockets ... FAILED
== M4 duplicate socket allowed
test fleet::tests::refuses_duplicate_names_sockets_and_keys ... FAILED
== M5 duplicate key allowed
error[E0282]: type annotations needed for `HashSet<_>`
== pristine again
restored
test result: ok. 7 passed; 0 failed
test result: ok. 2 passed; 0 failed
M5 was my mistake (the mutant did not compile), so it counts for nothing either way. The four that compiled each failed the test written for them.
#784, #785 and #786 all move tests/evidence/workspace-tests.json from 2108, so whichever lands first will put the other two in conflict on that one line. That comes from merge order and is not something you did wrong. When it happens, merging main and re-running UPDATE_TEST_BASELINE=1 scripts/test_baseline.sh is the whole fix. The CHANGELOG line is mine to write.
Signed-off-by: hushen <[email protected]>
vladimirrott
left a comment
There was a problem hiding this comment.
Approving at bc25ea8.
Thanks for the merge and the baseline refresh. Your merge commit adds one hunk beyond what git's own merge of 6d6c13a and main produces, and it is the evidence file:
$ for n in 784:6d6c13af 785:06c3c184 786:08f15fbd; do echo "== ${n%%:*}"; t=$(git merge-tree --write-tree origin/main ${n#*:} 2>/dev/null | head -1); git diff --stat $t p${n%%:*}; done
== 784
tests/evidence/workspace-tests.json | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
You resolved it to 2123. Main is at 2114 and the three-dot diff adds nine #[test] attributes and removes none, so 2114 + 9 = 2123 is right.
I re-ran the guard from my earlier review against this head through the merge gate, in podman:
$ timeout 2400 maintainer-merge verify 784 bc25ea8889de2b0aa3e10ec041587ab646c60ebd refuses_empty_inventory 's/ if inventory.host.is_empty() {/ if false {/' > verify-784.log 2>&1; echo "verify_rc=$?" >> verify-784.log
running 'refuses_empty_inventory' unmutated
rust suite: evidence of 1 executed unit(s), passing unmutated
applying the mutation and re-running
receipt recorded for #784 at bc25ea88 (observed: clean pass, mutated fail)
verify_rc=0
The red security-audit comes from main: cargo audit fails on RUSTSEC-2026-0538 against quinn-udp 0.5.14 in Cargo.lock, and main's own run at b83fda8 fails the same way. cargo update -p quinn-udp --precise 0.5.16 clears it, and that lockfile change is mine to land. You don't need to do anything for it. After it lands, this branch needs an update and a fresh run before it can merge.
One thing to expect: #784, #785 and #786 each count from 2114, so whichever two land after the first will conflict on that one line again. I'm sorry for the churn. A UPDATE_TEST_BASELINE=1 scripts/test_baseline.sh after merging main resolves it each time, and I will approve again when that file is the only change.
|
@QinXi-ai I merged #786 first, so this branch now conflicts with main on one file, To clear it, merge main into the branch and re-record the baseline: #785 also adds tests, so whichever of the two lands second needs the same step once more. My approval holds for the code I verified at bc25ea8. After your push I confirm that the diff between that head and the new one touches only the baseline file, re-run the mutation from my review on the merged tree, and merge once the board is green. |
Signed-off-by: hushen <[email protected]>
vladimirrott
left a comment
There was a problem hiding this comment.
Reviewed at 8a9435e6795041cf0833e29d6d354d587c2e64aa. Approving again. Thank you for merging main a second time; the first conflict came from my merge order, and so did this one.
Your merge resolved nothing by hand. Against the tree git builds on its own from main and the head I approved (bc25ea88), the only difference is the baseline:
$ git diff --stat "$(git merge-tree --write-tree origin/main bc25ea88 | head -1)" 8a9435e6
tests/evidence/workspace-tests.json | 6 +-----
The count is right: 2128 = 2119 on main plus the nine #[test] lines this branch adds.
The guard still bites at this head:
$ maintainer-merge verify 784 8a9435e6795041cf0833e29d6d354d587c2e64aa refuses_empty_inventory 's/ if inventory.host.is_empty() {/ if false {/'
rust suite: evidence of 1 executed unit(s), passing unmutated
applying the mutation and re-running
receipt recorded for #784 at 8a9435e6 (observed: clean pass, mutated fail)
All checks pass (14 pass, 1 skipped). I'm merging it now.
Summary
Adds
sysknife fleet hosts <inventory.toml>to validate and list pinned hosts without contacting a daemon. Text output shows a 12-character key prefix;--jsonreturns all entries with their full keys in file order.The parser rejects empty inventories, duplicate names/sockets/keys, missing or malformed keys, unknown fields, invalid names and relative Unix socket paths. Invalid entries return exit code 4 and identify the host.
Related Issue
Fixes #654.
Validation
UPDATE_TEST_BASELINE=1 scripts/test_baseline.shafter syncing main at3bc1e07.tests/evidence/workspace-tests.json.Notes for Reviewers
Bare absolute paths and
unix://paths to the same socket count as duplicates. The format and command are documented indocs/cli.md.