Skip to content

Detect external bootc status changes via fsnotify (milestone 4d)#59

Open
alicefr wants to merge 6 commits into
bootc-dev:mainfrom
alicefr:milestone-4d
Open

Detect external bootc status changes via fsnotify (milestone 4d)#59
alicefr wants to merge 6 commits into
bootc-dev:mainfrom
alicefr:milestone-4d

Conversation

@alicefr

@alicefr alicefr commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Bootc changes are detected via fsnotify or via a polling mechanism.

@alicefr alicefr force-pushed the milestone-4d branch 4 times, most recently from 8021bcf to 74c721d Compare June 12, 2026 13:43
@alicefr alicefr force-pushed the milestone-4d branch 4 times, most recently from 069de0b to 55db9c1 Compare June 22, 2026 11:38
Comment thread internal/daemon/reconciler.go Outdated
Comment thread cmd/daemon/main.go Outdated
Comment thread internal/daemon/watcher.go
@alicefr alicefr force-pushed the milestone-4d branch 3 times, most recently from d52771b to a676abe Compare June 25, 2026 10:57
@alicefr

alicefr commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Implemented the caching mechanism suggested by #59 (comment) mostly included in commit: 48032ff

@jlebon jlebon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly nits, though one comment about change detection I think is important.

Otherwise looks sane to me.

Comment thread internal/daemon/watcher.go Outdated
Comment thread internal/daemon/watcher.go
Comment thread internal/daemon/watcher.go Outdated
Comment thread internal/daemon/watcher.go
Comment thread internal/daemon/watcher.go Outdated
Comment thread cmd/daemon/main.go
Comment thread internal/daemon/suite_test.go
alicefr added 6 commits June 30, 2026 07:19
Add a StatusWatcher component that detects external bootc status
changes via fsnotify, with a configurable polling interval as a
safety net. It auto-detects the correct path to watch based on
the storage backend: ostree (ATTRIB on /proc/1/root/ostree/bootc)
or composefs (CREATE on /proc/1/root/sysroot/state/deploy).

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Turn the StatusWatcher into an informer-style cache for bootc
status. The watcher owns the Executor, refreshes the cached
*bootc.Status on fsnotify/poll events, and exposes GetStatus()
for consumers. Polling only activates after fsnotify fails.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Test warm cache, cold cache, poll deferral, and refactor existing
tests to use a shared newTestWatcher helper.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
The reconciler reads bootc status from the watcher's cache via
GetStatus() instead of shelling out on every reconcile.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Each unit test creates its own watcher with a fresh cache via
newTestEnv() to avoid test pollution.

Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>
Assisted-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Alice Frosi <afrosi@redhat.com>

@jlebon jlebon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits, but LGTM as is. CI is failing though.

}

// refresh reads bootc status from the host and updates the cache.
// Returns the new status or an error.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docstring needs update.

return nil, false, err
}
w.mu.Lock()
changed := !bytes.Equal(data, w.lastRaw)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why keep lastRaw and not just compare the bootc.Status objects themselves?

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.

2 participants