Repository navigation
fix(hooks): stamp 20-home-labels.sh after the body runs - #327
Conversation
20-home-labels.sh was the last Utah setup hook still on the legacy `version-script` gate, which records completion before the body runs: a first-boot `restorecon` failure left /var/home mislabelled and the hook skipped forever after. Migrate it to the projectbluefin/common#1196 check/commit pair, add `set -e` so a failing body aborts before the commit, and shim both helpers so the hook is correct against the pinned pre-#1196 common image in either merge order. Adds tests/test_setup_hook_version_contract.py and a setup-hooks skill recording the once-only contract and the deliberate-vs-transient skip rule, per the AGENTS.md self-improvement requirement. Assisted-by: Space Bunny (pi) via hive Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Hive-Run: projectbluefin#326 Hive-Plan: fix/home-labels-version-script-commit Hive-Spec: common#1196 Signed-off-by: dtg01100 <dtg01100@users.noreply.github.com>
There was a problem hiding this comment.
docs-currency
docs/skills/setup-hooks.md:24-30— says hooks live in "two directories" then lists three, and the first (system-setup.hooks.d/) does not exist in Utah's tree at 02ff49a (onlyuser-setup.hooks.d/andprivileged-setup.hooks.d/undersystem_files/shared/usr/share/ublue-os/). Drop the phantom dir or fix the count.docs/skills/setup-hooks.md:77-78— claimsjust check"shellchecks ... every hook throughscripts/check-script-syntax.py". That script only runsbash -n(scripts/check-script-syntax.py:81-82); no shellcheck is invoked fromJustfileor CI. Say "syntax-checks" only, or the skill will send agents looking for a gate that isn't there.
No findings from: correctness, security, intent-alignment, style.
Confidence: 3/5 (needs attention) — 1 perspective requested changes
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
The skill listed three hook directories under "two directories", including system_files/shared/usr/share/ublue-os/system-setup.hooks.d/, which does not exist in this tree -- only user-setup.hooks.d and privileged-setup.hooks.d do. It also claimed `just check` shellchecks every hook; check-script-syntax.py only runs `bash -n`, and no shellcheck gate exists in the Justfile or CI. Signed-off-by: dtg01100 <dtg01100@users.noreply.github.com> Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed at head 0fd70a7. Hook logic, shim, and ordering match the #259 siblings and the common #1196 check/commit semantics; just test (412 OK) and a clean generate_skill_index.py --write confirmed locally.
style
system_files/shared/usr/share/ublue-os/privileged-setup.hooks.d/20-home-labels.sh:22usesset -xewhile every other Utah hook (e.g.10-tailscale.sh:8on main,:17on #259) and the new skill's own template (docs/skills/setup-hooks.md:39) useset -xeuo pipefail. Low: aligning it avoids a second idiom; notetests/test_setup_hook_version_contract.py:57pins the literalset -xe, so change both together.
docs-currency
docs/skills/setup-hooks.md:62says "until #1196 lands" — a bare#1196in this repo resolves to utah#1196, not common#1196; the hook comment (20-home-labels.sh:11) and the rest of the doc useprojectbluefin/common#1196. Low.
No findings from: correctness, security, intent-alignment.
Confidence: 5/5 (safe)
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Matches 10-tailscale.sh and the setup-hooks skill template, so the hook does not introduce a second idiom. The contract test pinned the literal "set -xe"; both are updated together. Also qualifies the bare #1196 in docs/skills/setup-hooks.md, which resolved to utah#1196 in this repo rather than projectbluefin/common#1196. Refs projectbluefin#327
Addressed in
|
There was a problem hiding this comment.
Reviewed at head 0b71930. Non-blocking notes only.
correctness
20-home-labels.sh:22-27— withset -eand the commit moved after the body, a persistentrestorecon -RF /var/homenon-zero exit (e.g. a home on a mount that rejects xattr relabel) now re-runs a full recursive relabel of every home directory on every boot, with no attempt cap. That is the intended retry contract from common#1196, but it is a new steady-state cost this hook did not have before; worth a line in the hook comment or the skill doc.
intent-alignment
- PR body uses "Addresses #326" — not a GitHub closing keyword, so #326 stays open after merge. Change to
Closes #326if this PR is meant to resolve it.
docs-currency
docs/skills/setup-hooks.md:63-64says "in either merge order each hook defines a shim", but at this head only20-home-labels.shhas the shim;10-tailscale.sh:8,11-framework-ucsi-workaround.sh,99-flatpaks.sh:8anduser-setup.hooks.d/20-framework.shstill call legacyversion-script(pending #259). The sentence is also missing a break before "in either merge order". Suggest "…until common#1196 lands. Each hook therefore defines a shim so it works in either merge order:".
No findings from: security, style.
Confidence: 5/5 (safe)
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
…scope Addresses the three non-blocking findings on utah#327: - the hook comment now states that a persistently failing restorecon re-runs a full recursive relabel of /var/home on every boot, and that there is no attempt cap; - the compat-shim section no longer implies every hook already has a shim -- only 20-home-labels.sh does, the rest still call legacy version-script pending projectbluefin#259; - the shim section splits the run-on sentence so 'in either merge order' reads as its own clause.
Addressed in
|
Closes #326, the follow-up noted in the review of #259:
20-home-labels.shlanded on main after that branch was cut (via #261) and was the last Utah setup hook still on the legacy burn-before-body contract.What
privileged-setup.hooks.d/20-home-labels.shcalledversion-script home-labels privileged 1 || exit 0, which records the version before the body runs. A first-bootrestorecon -RF /var/homethat failed left/var/homemislabelled and the hook skipped forever after — exactly the failure modeprojectbluefin/common#1196splitsversion-scriptinto a check/commit pair to remove.version-script-check, stamp withversion-script-commitafterrestoreconset -e(wasset -x) so a failing body aborts before the commit and retries next bootCOMMON_IMAGE_SHAhas noversion-script-check/-commityet, so the hook defines no-op fallbacks and behaves correctly under both contracts in either merge ordertests/test_setup_hook_version_contract.pylocks the contract on this hook (no legacy gate, check before acting, commit after,set -epresent, shim present). It is scoped to this hook rather than the whole tree because the other Utah hooks are still covered by #259.Per AGENTS.md's self-improvement rule, this PR also adds the
setup-hooksskill (the once-only contract, the deliberate-vs-transient skip rule, the shim) and links it from thedocs/SKILL.mdrouter;docs/skills/index.json/index.mdregenerated withscripts/generate_skill_index.py --write.just checkandjust test(412 tests) pass locally;bash -nandshellcheckare clean on the hook.8523690records the review follow-ups: the hook comment now says plainly that a persistently failingrestoreconre-runs the full recursive relabel on every boot with no attempt cap, and the skill's compat-shim section no longer implies every hook already has a shim (only20-home-labels.shdoes; the rest are pending #259).— hive: backend=pi model=kilocode/stealth/space-bunny-alpha
🐝 Hive Agent:
contributor| SHA:02ff49a