fix: apply live data bindings in nemo screenshot (#82) - #86
Merged
Conversation
`nemo screenshot` rendered the initial layout but bound values (`<binding>`/`bind-*`) stayed at their placeholders in the captured PNG, even though they populate correctly in the running app. Root cause is startup ordering. A data source's `start()` broadcasts its initial `full` value immediately, and a tokio `broadcast` channel drops messages sent while no receiver is attached. The runtime subscribed its update loops *after* `data_engine.start_all()`, so each source's first value was lost and the repository was never seeded. Interactive runs recover via a later event (e.g. a file-watcher change); a one-shot capture never does. Fix (two parts): - runtime.rs: subscribe the update loops (`start_data_update_loop`) before `data_engine.start_all()`, so receivers are attached before sources broadcast. This is the root-cause fix and benefits every one-shot / early-read path, not just screenshots. - commands/screenshot.rs: pump the data->binding loop across the `--settle-ms` window in 50ms slices, then do a final refresh + one executor-yield before `render_to_image()` (which reads the last-drawn frame; `refresh()` only marks the window dirty). Verified: examples/data-binding screenshot now shows live timer/HTTP values; 233 nemo + 18 macro tests pass; --features screenshot builds clean. Updated the data-flow KB doc and log. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
=======================================
Coverage 56.59% 56.59%
=======================================
Files 78 78
Lines 6866 6866
=======================================
Hits 3886 3886
Misses 2980 2980 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #82 —
nemo screenshotrendered the initial layout but bound values (<binding>/bind-*) stayed at their placeholders in the captured PNG, even though they populate correctly in the running app.Root cause is startup ordering, not a screenshot-specific rendering bug:
start()broadcasts its initialfullvalue immediately.broadcastchannel drops messages sent while no receiver is attached.data_engine.start_all(), so each source's first value was lost and the repository was never seeded.Changes
runtime.rs(root-cause fix): subscribe the update loops (start_data_update_loop) beforedata_engine.start_all(), so receivers are attached before sources broadcast. Benefits every one-shot / early-read path, not just screenshots.commands/screenshot.rs(capture fix): pump the data→binding loop across the--settle-mswindow in 50ms slices, then do a final refresh + one executor-yield beforerender_to_image()(which reads the last-drawn frame;refresh()only marks the window dirty).concepts/data-flow.mdand alog.mdentry.This branch also carries an earlier doc-only commit adding the screenshot-as-a-plugin KB plan.
Verification
examples/data-bindingscreenshot now shows live timer/HTTP values instead of placeholders.cargo build -p nemo --features screenshotclean; pre-commit clippy/fmt hooks green.🤖 Generated with Claude Code