Skip to content

Remove leftover [embed:trace] debug logging from the window-open/first-frame path#696

Draft
azchohfi wants to merge 2 commits into
mainfrom
azchohfi-remove-embed-trace-logging
Draft

Remove leftover [embed:trace] debug logging from the window-open/first-frame path#696
azchohfi wants to merge 2 commits into
mainfrom
azchohfi-remove-embed-trace-logging

Conversation

@azchohfi

Copy link
Copy Markdown
Collaborator

What

PR #543 (commit f810c021, "Spec 056: Visual Studio embedded preview — Phase 1") left unguarded Console.Error.WriteLine("[embed:trace] ...") printf-debugging in the window-open / first-frame code path. This PR removes it.

There is no #if DEBUG, no log level, no abstraction — these are bare stderr writes. Two files:

  • src/Reactor/Hosting/ReactorApp.cs (OpenWindowCore)4 success-path traces that fired unconditionally on EVERY window open, including the non-embed path ("OpenWindowCore enter", "ReactorWindow ctor ok", "configure ok", "MountAndActivate ok"), plus 3 ...THREW traces inside catch blocks that immediately rethrow.
  • src/Reactor/Hosting/ReactorWindow.cs (embed setup) — 6 embed-only traces ("entering embed setup", "VerifyEmbedDpiAwareness ok", "ApplyEmbedInitialStyles ok", "EmbedHostWatchdog started", "embed setup THREW", ex.ToString()).

Behavior preserved exactly

  • The MountAndActivate catch keeps its real cleanup (UnregisterWindow(window) + window.Dispose()) before rethrow — only the trace line was dropped (catch (Exception ex)catch since ex is now unused).
  • The ctor / configure / embed-setup try-catch blocks only logged-then-rethrew. Once the logs are gone they are no-op catch { throw; } wrappers, so they were simplified away — exceptions now propagate naturally with identical observable behavior.
  • No control-flow, ordering, or RegisterWindow/MountAndActivate sequencing changes. VerifyEmbedDpiAwarenessApplyEmbedInitialStyles → watchdog start order is unchanged. No replacement diagnostics / logging framework introduced (out of scope).

Consumer check (done before deleting)

Grepped src/, tests/, src/vscode-reactor/, src/vs-reactor/, and src/Reactor.Cli/ for any consumer of these stderr lines. Result: pure leftover — nothing programmatic depends on them.

  • The VS embedded-preview handshake is CAPTURE_PORT= / CAPTURE_TOKEN=, parsed from the child's stdout (ReactorChildLauncher.OnStdoutLine, and extension.ts).
  • The child's stderr is purely diagnostic: ReactorChildLauncher.OnStderrLine appends to a 16 KB LastStderr tail buffer and forwards to the VS Output pane; extension.ts appends stderr to its output channel. Neither pattern-matches stderr for any progress/handshake signal.
  • No test asserts on [embed:trace] output. The only non-source reference was a troubleshooting note in tests/stress_perf/ci/README.md that quoted "MountAndActivate ok" as a diagnostic landmark; reworded so it no longer depends on the removed line.

Verification

  • dotnet build src/Reactor/Reactor.csproj -c Release (core lib promotes trim/AOT warnings to errors): 0 warnings / 0 errors.
  • dotnet test tests/Reactor.Tests: 9702 passed, 0 failed, 64 skipped (headless WinUI skips).
  • dotnet test tests/Reactor.SelfTests (live WinUI, real OpenWindowCore window-open path): 1229 passed, 0 failed.

Note: dotnet build Reactor.slnx -c Release fails locally in tests/perf_bench (net472 XamlCompiler) — pre-existing on clean main, unrelated to this change.

Status

Draft / HOLDsrc/Reactor runtime change held for the project owner's personal review per standing instruction. Gate-clean but not to be merged yet.

…t-frame path

PR #543 (Spec 056 embedded preview Phase 1) left unguarded
Console.Error.WriteLine("[embed:trace] ...") printf-debugging in the window-open
path: four success-path writes fire on EVERY window open (even non-embed) plus
catch-block traces, and six embed-only writes in ReactorWindow setup.

Removed all of them while preserving behavior exactly: the MountAndActivate catch
keeps its real cleanup (UnregisterWindow + Dispose) before rethrow; the
ctor/configure and embed-setup try/catch blocks only logged-then-rethrew, so after
removing the logs they are no-ops and were simplified away (exceptions propagate
identically). No control-flow, ordering, or Register/Mount sequencing changes.

Consumer check: the [embed:trace] lines go to stderr only; the VS preview handshake
is CAPTURE_PORT/CAPTURE_TOKEN parsed from stdout (ReactorChildLauncher.cs,
extension.ts). stderr is purely diagnostic (16KB tail buffer + Output pane), so
nothing programmatic depends on these lines. Also updated a stale troubleshooting
landmark in tests/stress_perf/ci/README.md that referenced the removed
"MountAndActivate ok" trace.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Removes leftover unguarded [embed:trace] Console.Error.WriteLine(...) printf-style debug logging from the window-open / first-frame activation path (including embed setup), keeping behavior and ordering unchanged while eliminating unconditional stderr noise.

Changes:

  • Removed unconditional stderr trace lines from ReactorApp.OpenWindowCore and simplified no-op try/catch wrappers that only logged-then-rethrew.
  • Removed embed-only trace lines from ReactorWindow embed setup and simplified the same log-only exception wrapper.
  • Updated the stress-perf CI troubleshooting note to no longer rely on the removed trace landmark.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/Reactor/Hosting/ReactorApp.cs Drops unconditional stderr traces in OpenWindowCore; preserves cleanup-on-activation-failure behavior.
src/Reactor/Hosting/ReactorWindow.cs Removes embed setup stderr traces; keeps embed init ordering and watchdog start behavior intact.
tests/stress_perf/ci/README.md Rewords troubleshooting guidance to avoid referencing removed trace output.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…race

The pr-review skill flagged that .github/skills/perf-compare/SKILL.md still
referenced the removed "MountAndActivate ok" trace as a headless-crash landmark.
Reworded to "during first-frame window activation" to match the README change so
the skill no longer points readers at a stderr line that no longer prints.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comment thread src/Reactor/Hosting/ReactorApp.cs
Comment thread src/Reactor/Hosting/ReactorWindow.cs
Comment thread src/Reactor/Hosting/ReactorWindow.cs
Comment thread src/Reactor/Hosting/ReactorWindow.cs
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