WARNINGs during pc-switcher sync appear swiftly in the "Recent logs" block, but then…
- User
WARNINGs during pc-switcher sync appear swiftly in the "Recent logs" block, but then that block gets overwritten by other blocks like the "Config Sync" and "Source Configuration", or is just pushed away by newer log lines. Use hasn't the time to read the warning well. Need better way to ensure that user at least gets to see all warnings. I won't go and look at the log file on every run. I need at least some indicator that there are warnings and a way to view them.
Proposal: capture-and-resurface, two parts:
- Live counter: a persistent ⚠ N in the status bar (part of the render, not the rolling log, so pauses/scrolls don't lose it).
- End-of-run summary: buffer every ≥WARNING record during the run; after the Live stops, print a static block — ⚠ N warnings this run: then each message — into scrollback (can't be overwritten), ending with a pc-switcher logs pointer for detail. Show it on success too, not just failure.
Mechanism: a small logging handler that tees ≥WARNING records into a buffer the UI owns. The end-summary is the load-bearing part (guarantees you see them); the counter is the live cue.
Assistant
Let me look at the relevant code before responding to the proposal.
Assistant
Let me read the UI and logger modules — they're central to this proposal.
Assistant
Now let me see how the orchestrator drives the UI lifecycle (start/stop) and where an end-of-run summary would slot in.
Assistant
Let me see the run completion / summary area (around line 580-620) and the end of
run().Assistant
Let me see how the CLI wraps
run()and prints the final result — that's where an end-of-run summary belongs (after Live stops).Assistant
I now have the full picture. Let me check existing tests for these modules so I extend the right ones.
Assistant
I have everything I need. The proposal is sound and fits the existing architecture cleanly. Here's how I'll build it, with the design decisions I'm making:
Ownership & threading
TerminalUIowns the warning buffer (_warnings: list[str]) — it already renders the status bar (for the live counter) and the orchestrator can read it for the summary.- A new
WarningCaptureHandler(inlogger.py) tees records into that buffer. It runs on theQueueListenerbackground thread and appends synchronously (atomiclist.append) — nocall_soon_threadsafe. The counter surfaces via the existing 10 Hz Live auto-refresh, so no cross-threadLive.update.
Capture scope
- Handler level = , so it captures (WARNING/ERROR/CRITICAL), per your mechanism. I'll also lower the logger threshold to so warnings still reach the queue even if someone sets file/tui above WARNING ( keeps the display handlers unaffected).
Assistant
Now let me implement. First,
logger.py— extract the line formatter and add the capture handler:Assistant
Now update
UILogHandlerto use the shared formatter and the renamed sink type, and addWarningCaptureHandler:Assistant
Now wire the capture handler into
setup_logging:Assistant
Now update the signature, docstring, handler list, and logger level:
Assistant
Now the handler construction and listener wiring:
Assistant
Now
ui.py— add the buffer,add_warning, the counter render, and an accessor:Assistant
Now the counter in
_render— add a⚠ Ncell to the status bar:Assistant
Now add
add_warningandcollected_warningsmethods, next toadd_log_message:Assistant
Now the orchestrator summary. Let me check the end of
_cleanupand imports:Assistant
I need
Textfrom rich. Let me add the import and the summary print:Assistant
Now lint, typecheck, and run the affected tests:
Assistant
All existing tests pass. Now let me add tests for the new behavior. Let me look at the existing test patterns to match style:
Assistant
Let me look at how the logging tests set up interactive vs non-interactive, to match:
Assistant
The fake sink now needs
add_warningto satisfy the widenedUISinkprotocol. Let me update it and its docstring reference:Assistant
Now add logger tests for the capture handler. Let me check the imports at the top of the test file:
Assistant
Now add a test class for the warning capture. Let me insert it after the
TestUILogHandlerRoutingclass (beforeTestInvalidLogLevel):Assistant
That first assertion line is garbled. Let me fix it:
Assistant
Let me add a quick test for
format_log_line(I imported it) and verifyLogConfigacceptsfile=/tui=kwargs:Assistant
LogConfig takes ints. Let me fix — use
logging.ERROR— and add theformat_log_linetest:Assistant
Now add the UI-side tests (counter render + collected_warnings). Let me append to the terminal UI test file:
Assistant
Two real issues surfaced, and one taught me something important about Rich
Live:- Rich
Liveauto-refresh does not re-call_render()— it redraws the stored renderable. Progress bars animate (theProgressobject is stateful and re-rendered in place), but the status bar/counter (rebuilt fresh each_render()) only change when someone callslive.update(self._render()). So relying on auto-refresh for the counter was wrong — a warning during a quiet moment would never appear. I needadd_warningto trigger a render, marshalled to the loop thread. - The two interactive-path logging tests were sync but the interactive path constructs
UILogHandler, which requires a running loop.
Cleanest fix: keep
WarningCaptureHandlerdumb (synchronous append only, for summary-ordering), and letTerminalUIown its own thread-marshalling — capture the loop instart()and haveadd_warningschedule the live refresh viacall_soon_threadsafe.- Rich
Assistant
Now fix the tests. First the UI counter tests — render
_render()directly instead of relying on Live's stored renderable:Assistant
Now make the two interactive-path logging tests
async(the interactive path constructsUILogHandler, which needs a running loop):Assistant
SLF001 isn't enabled. Remove the noqa:
Assistant
The counter renders correctly — the two
appendcalls just split it across ANSI spans (⚠then2). Let me combine into one append (cleaner output too):Assistant
All pass. Now let me verify the orchestrator summary works end-to-end by driving the actual render path. Let me write a quick standalone check that exercises capture → counter → summary through real logging:
Assistant
End-to-end verified: capture through real logging, counter shows ⚠2, summary reprints both the warning and error with literal markup (no MarkupError), INFO excluded. Let me run the full unit suite and codespell to be sure nothing regressed:
Assistant
Full suite green (509 passed), codespell clean. Let me verify no other references to the renamed symbols exist:
Assistant
Done. Implemented the capture-and-resurface scheme exactly as proposed, with one design correction I discovered mid-build.
- User
push, wait for ci, release, ... so I can test
Assistant
Let me check the current git state before committing.
Assistant
PR #160 already exists (not draft, so CI will run). Let me commit just my feature work (leaving
.vscodeand.planningunrelated changes alone):Assistant
Pushed. Now let me watch CI in the background so I don't fill context with polling. Let me first see what checks exist for this commit:
Assistant
CI is running (Lint, Unit Tests, Integration Tests). Let me delegate the waiting to a background agent so I don't burn context polling:
Assistant
CI is being watched in the background. While it runs, let me figure out the release versioning so I'm ready. Let me check the tag scheme:
Assistant
Version is derived from git tags via
uv-dynamic-versioning, and no workflow auto-creates releases from tags — so releasing is a manual annotated-tag + GitHub Release step (which is why a lightweight tag gives the wrong version). Let me confirm the exact recipe used for alpha.20 so I replicate it:Assistant
Everything's lined up. Here's the state:
- Pushed commit
7823112to01-folder-sync(PR #160). - CI running — Lint, Unit Tests, Integration Tests (being watched in the background; I'll be notified on completion).
- Release recipe confirmed: next version is
v0.1.0-alpha.21. Version is derived from git tags viauv-dynamic-versioning, so I'll create an annotated tag on the green commit via the git data API, then a GitHub pre-release referencing it — matching how alpha.20 was cut (a lightweight tag /gh release create-first would resolve to the wrong version).
I'll cut the release only once CI is green on this commit. Waiting for CI now — I'll proceed automatically when it finishes.
- Pushed commit
Assistant
CI watch finished (exit 0 = all green). Let me confirm the actual check results before tagging:
Assistant
All green, including the 13-minute integration suite. Cutting the release now — annotated tag
v0.1.0-alpha.21on7823112via the git data API, then a GitHub pre-release referencing it.Assistant
Annotated tag created (ref points at a
tagobject, confirming annotated). Now the GitHub pre-release referencing the existing tag:Assistant
Let me verify the release resolves to the correct version (the whole reason for the annotated-tag dance):
Assistant
Released. Everything's ready for you to test.
- CI: all green on
7823112(Lint, Unit Tests, Integration Tests — the full 13-min integration suite included). - Release:
v0.1.0-alpha.21— pre-release, annotated tag pointing at the exact green commit (7823112), so a fresh install resolves to0.1.0a21rather than a dev/distance version.
Note: the local
uv runversion printed0.1.0a5.post178...— that's just this editable checkout's cached build metadata (my working tree still has the unrelated.vscode/.planningchanges uncommitted). It does not reflect what a target installs; a clean install of the tag resolves correctly because the annotated tag sits on the commit.What to look for when testing:
- During a sync, a persistent
⚠ Nin the status bar as soon as any warning fires. - After the run ends (success or failure), a static
⚠ N warning(s) this run:block in scrollback listing each message, ending with thepc-switcher logspointer.
- CI: all green on