Skip to content

feat(S-66): /dotfiles-sync audits S-64 watcher health#101

Merged
tieubao merged 1 commit into
mainfrom
feat/sync-watcher-audit
May 12, 2026
Merged

feat(S-66): /dotfiles-sync audits S-64 watcher health#101
tieubao merged 1 commit into
mainfrom
feat/sync-watcher-audit

Conversation

@tieubao
Copy link
Copy Markdown
Member

@tieubao tieubao commented May 12, 2026

Summary

Notify-only watcher health audit closes the post-S-64 gap where the watcher was the only first-class subsystem of the dotfiles workflow with no sync-time check.

  • New dotfiles watch doctor verb (POSIX sh) probes six conditions: both LaunchAgents state = running, plist fingerprint matches chezmoi managed | sha256sum (cached at ~/.cache/dotfiles-watcher.managed.sha256, written from the existing run_onchange wiring), lock absent or <60s, fswatch --version works, log mtime within 30d. Headless boxes self-skip with one [ok] line. Each non-[ok] line carries an inline Fix: <cmd> suffix.
  • /dotfiles-sync skill gains a "Watcher health (notify-only)" subsection between Secret cache and SA token rotation; grep-filters [warn]/[err] so healthy machines stay silent. Notify-only by design per the S-64 philosophy (operator runs the fix, never the sync).
  • Tests at tests/dotfiles-watch.sh § 4 add 8 cases via fake launchctl + fake fswatch + extended fake chezmoi data shims (FAKE_LC_WP, FAKE_LC_FS, FAKE_HEADLESS, NOW_OVERRIDE env knobs). Suite now 26/26 (up from 17).

Spec: docs/specs/S-66-dotfiles-sync-watcher-audit.md. Extends S-64 (the watcher itself) and S-65 (post-ship doc sweep).

Test plan

  • shellcheck --severity=warning home/dot_local/bin/executable_dotfiles-watch-doctor tests/dotfiles-watch.sh clean
  • fish -n home/dot_config/fish/functions/dotfiles.fish clean
  • chezmoi execute-template < home/.chezmoiscripts/run_onchange_after_dotfiles-watcher.sh.tmpl | bash -n clean
  • bash tests/dotfiles-watch.sh → 26/26 pass on Mac mini
  • chezmoi managed | wc -l → 187 (no regression)
  • End-to-end on Mac mini: clean state → 6× [ok] exit 0; launchctl bootout of fswatch agent → [err] agent: com.truonghan.dotfiles-watcher-fswatch not loaded — Fix: dotfiles watch install exit 1; bootstrap → silent again exit 0

Notable

Secret-guard hook (S-62) caught an early test sentinel using deadbeef... (64-hex = sha256-shaped, looked like a private key). Swapped to stale-fingerprint-non-hex-sentinel so the test fixture can never collide with a real hash. Validates that the hook trips even on test code that looks secret-shaped.

🤖 Generated with Claude Code

Notify-only watcher health audit closes the post-S-64 gap where the
watcher was the only first-class subsystem with no sync-time check.

New `dotfiles watch doctor` verb probes six conditions: both LaunchAgents
running, plist fingerprint matches `chezmoi managed | sha256sum`, lock
absent or <60s, `fswatch --version` works, log mtime within 30d. Headless
boxes self-skip. Each non-[ok] line carries an inline `Fix: <cmd>` suffix
so the operator can remediate without cross-referencing the spec.

Wiring script writes the managed-set sha256 to
`$HOME/.cache/dotfiles-watcher.managed.sha256` as a side effect so the
doctor has something to diff against.

`/dotfiles-sync` skill gains a "Watcher health (notify-only)" subsection
between Secret cache and SA token rotation; it grep-filters [warn]/[err]
so healthy machines stay silent. Notify-only by design per S-64
philosophy: operator runs the fix, never the sync.

Tests at tests/dotfiles-watch.sh § 4 add 8 cases driven by fake launchctl
+ fake fswatch + extended fake chezmoi shims (FAKE_LC_WP/FAKE_LC_FS/
FAKE_HEADLESS/NOW_OVERRIDE env knobs). Suite now 26/26 (up from 17).
End-to-end verified on Mac mini: clean state silent; bootout of fswatch
agent surfaces `[err] ... Fix: dotfiles watch install`; bootstrap
restores silence.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tieubao tieubao merged commit 36c1a27 into main May 12, 2026
2 checks passed
@tieubao tieubao deleted the feat/sync-watcher-audit branch May 12, 2026 18:08
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