Skip to content

Keep the engine quiet in release builds - #11

Merged
Vithanco merged 2 commits into
mainfrom
smoke-quiet-console
Nov 12, 2026
Merged

Vithanco merged 2 commits into
mainfrom
smoke-quiet-console

Conversation

@Vithanco

@Vithanco Vithanco commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

Summary

The wasm engine's ConsoleLogger called console.log through JavaScriptKit for log, warn and debug in every build. That bypasses WASI, so a plugin cannot silence it.

 ConsoleLogger
   log(message)            // warn and debug arrive here too
-    console.log(message)
+    #if DEBUG: console.log(message)
   error(message)
     console.error(message)

Release builds ship in the Obsidian and VS Code plugins, where Obsidian's guidelines allow only errors in the console. Debug builds keep the full trace.

Companion: Vithanco/obsidian-vithanco#20, which stops the plugin's WASI output and the generated glue the directory review flagged.

Evidence

  • Before: the new smoke check, rendering writes nothing to the console, fails on the released 1.0.11 with 24 lines: DEBUG: [GraphvizLibLayoutEngine] === DOT Output ===, the full DOT for each render, and [EdgeRenderer] Rendered 1 edges.
    After: just obsidian-smoke passes all 6 checks in Obsidian 1.15.1 with a release engine from this branch.
  • just test passes: Swift suites (3 known issues, unchanged), 66 wasm smoke, 216 editor browser, shell tests.

Merge Danger

Door: two-way

Blast Radius: console

Release builds of the website editor log no engine trace either; use a debug build for that.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Routine console messages are now limited to debug builds, reducing noise in production. Error messages continue to be reported.
  • Tests
    • Added a browser smoke test that checks for console messages while rendering a note in light and dark themes.

Obsidian asks plugins not to log. The released plugin printed the
engine's DEBUG trace, including the DOT for every render.
ConsoleLogger called console.log for log, warn and debug in every build,
bypassing WASI, so a plugin could not silence it. Release builds ship in
the plugins and now pass only errors on; debug builds keep the trace.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Release builds no longer call console.log through ConsoleLogger.log(_:). A browser smoke test captures console messages during light- and dark-theme rendering, removes its listener, and asserts that no messages were logged.

Changes: Console output during rendering

Layer / File(s) Summary
Gate logging and verify rendered output
VGraphWasm/VGraphEditor/ConsoleLogger.swift, VGraphWasm/Tests-Browser/obsidian/smoke.spec.js
ConsoleLogger.log(_:) calls console.log only in DEBUG builds. The browser test checks console output during light- and dark-theme rendering and removes its listener in a finally block.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Possibly related PRs

  • Vithanco/VGraph#8: Adds the Obsidian Playwright smoke suite and recipe used by the browser test.
Merge Risk: Minimal · up to 61d5f

Release builds stop emitting informational console messages, while debug builds keep them and errors still use console.error. No concrete merge-blocking risk was established.

Pre-merge checks: Passed 7

Check name Status Explanation
Title check Passed The title "Keep the engine quiet in release builds" matches the main change. The ConsoleLogger.log(_:) method now calls console.log only in DEBUG builds, so release builds emit no log output. The erro…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Swiftgraphviz Compatibility Passed The check does not apply. git diff --name-status over the reviewed range lists only two modified files: VGraphWasm/Tests-Browser/obsidian/smoke.spec.js and `VGraphWasm/VGraphEditor/ConsoleLogger.s…
Wasm Engine Export Break Disclosure Passed The check applies only when a @JS public func in VGraphWasm/Sources/Main.swift is removed, renamed, or has its parameters or return type changed. The PR range changes only two files: VGraphWasm/Test…
Adr Conflicts Are Explicit Passed The check fails only when the change reverses or contradicts a decision recorded in docs/adr/ and neither the PR description nor an ADR edit says so. Evidence gathered: - The PR changes two files: `VG…
Full details: Title check

Explanation

The title "Keep the engine quiet in release builds" matches the main change. The ConsoleLogger.log(:) method now calls console.log only in DEBUG builds, so release builds emit no log output. The error(:) path still calls console.error, which the title does not mention but does not need to cover. The companion smoke test supports the same goal.

Full details: Swiftgraphviz Compatibility

Explanation

The check does not apply. git diff --name-status over the reviewed range lists only two modified files: VGraphWasm/Tests-Browser/obsidian/smoke.spec.js and VGraphWasm/VGraphEditor/ConsoleLogger.swift. The check's trigger files are Package.swift and Package.resolved (root and VGraphWasm/), plus anything under Sources/VGraphvizLib. None of those changed, so no SwiftGraphviz requirement, resolved version, or Sources/VGraphvizLib symbol usage was touched. The PR description's lack of a dependency rationale is not a failure condition here, because the PR does not raise the requirement.

Full details: Wasm Engine Export Break Disclosure

Explanation

The check applies only when a @JS public func in VGraphWasm/Sources/Main.swift is removed, renamed, or has its parameters or return type changed. The PR range changes only two files: VGraphWasm/Tests-Browser/obsidian/smoke.spec.js and VGraphWasm/VGraphEditor/ConsoleLogger.swift. Main.swift is not in the changed-file list. A diff search for @JS or public func lines in the PR range returned no matches. The exported functions in Main.swift (for example mountEditor, renderGraph, layoutGraph, exportToVGL) are unchanged. The ConsoleLogger.swift change only alters the body of log(_:) to call console.log in DEBUG builds. It does not change any exported declaration, and the raw summary lists no altered public declarations. The check's failure condition is not met, so the missing consumer disclosure in the PR description does not cause a failure.

Full details: Adr Conflicts Are Explicit

Explanation

The check fails only when the change reverses or contradicts a decision recorded in docs/adr/ and neither the PR description nor an ADR edit says so. Evidence gathered: - The PR changes two files: VGraphWasm/VGraphEditor/ConsoleLogger.swift and VGraphWasm/Tests-Browser/obsidian/smoke.spec.js. No file under docs/adr/ is changed. - The logger change wraps ConsoleLogger.log(_:) in #if DEBUG. error(_:) is unchanged. - I searched all ADRs (0001–0036) for console, log, logger, logging, debug, DEBUG, WASI, stdout, trace, and quiet/silent. No ADR records a decision about console output, engine logging, or debug/release log levels. - The closest ADRs do not conflict: - ADR 0001 covers the editor UI architecture and release size. - ADR 0007 and ADR 0013 cover ports and WASI constraints. - ADR 0036 covers the release process (who builds and publishes), which this PR does not change. - The "silent" references in ADRs 0011, 0019, 0021, and 0022 concern domain diagnostics and user-facing editing behavior, not console output. The change does not reverse any recorded decision, so no ADR-conflict disclosure is required. The PR description does not mention ADRs, but that omission matters only when a conflict exists.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9644800 and 61d5fb6.

Files selected for processing: 2

  • VGraphWasm/Tests-Browser/obsidian/smoke.spec.js
  • VGraphWasm/VGraphEditor/ConsoleLogger.swift
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@Vithanco
Vithanco merged commit d69f1d2 into main Nov 12, 2026
10 checks passed
@Vithanco
Vithanco deleted the smoke-quiet-console branch November 12, 2026 17:35
@Vithanco Vithanco mentioned this pull request Nov 12, 2026
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