Skip to content

[Wails] M5: Consumer drift warning (snapshot + banner)#142

Open
josh-padnick wants to merge 1 commit intofeat/wails-rewritefrom
josh-padnick/m5-drift-warning
Open

[Wails] M5: Consumer drift warning (snapshot + banner)#142
josh-padnick wants to merge 1 commit intofeat/wails-rewritefrom
josh-padnick/m5-drift-warning

Conversation

@josh-padnick
Copy link
Copy Markdown
Collaborator

Summary

  • Backs the Consumer drift warning piece of M5 from the plan: reviewers in consumer mode see a non-blocking banner when the gruntbook tree drifts from what they opened, protecting them from executing scripts that changed underneath them.
  • Introduces core/watcher/ with OS-free Walk + Classify primitives so the snapshot/diff logic is testable with fake filesystems and portable into hosted mode later.
  • WatcherService.StartWatch now takes a baseline snapshot (sha256-hashed, output-path-aware) and recursively registers every subdirectory with fsnotify. Debounced changes emit a classified watch:<watchID>:drift event alongside the existing :change.
  • WatcherService.ResetSnapshot re-baselines after Reload so subsequent edits are measured against the just-reloaded state.
  • Frontend: useWatchMode now returns { resetSnapshot } and accepts onDrift. New DriftBanner component (expand/collapse changed-file list, Reload, Dismiss). RunbookView renders it in consumer mode only; Author Mode continues to auto-reload and suppresses the banner.

Test plan

  • go test ./core/watcher/... ./services/... ./core/... — passes (snapshot Walk skips .git/node_modules/output path, Classify is deterministically sorted, architecture test still blocks OS imports from core/).
  • cd web && npx tsc -b — clean.
  • cd web && npx vitest run — 229 tests pass.
  • Manual: task desktop:dev, open a gruntbook, edit a script outside the app → banner appears; Reload re-baselines (banner stays gone for content-identical writes); Dismiss hides; next change re-opens with cumulative delta.
  • Manual: toggle --watch (author mode) → auto-reload still fires and banner never renders.

🤖 Generated with Claude Code

Reviewers on consumer-mode opens now see a non-blocking banner when
files under the gruntbook tree change after they opened it — protects
them from executing scripts that drifted from the reviewed state.

Adds core/watcher primitives (Walk + Classify) hash-compared against
a baseline snapshot taken at StartWatch time. WatcherService now walks
the tree, adds every subdirectory to fsnotify, and emits a classified
drift event on every debounced change. ResetSnapshot re-baselines
after the user clicks Reload. Author Mode unchanged — auto-reload
still wins and the banner stays hidden.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
runbooks Ready Ready Preview, Comment Apr 23, 2026 4:20pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7dab714-0d67-4ad1-a52b-01c090840899

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch josh-padnick/m5-drift-warning

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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