Skip to content

[Feature]: W4: Desktop Structured Logger & CLI-to-Desktop IPC Stream Unification #1846

Open

Description

@skevetter

Parent Epic: #1841

Overview

Align the Electron Desktop app's internal logger (desktop/src/main/logging.ts), CLI subprocess stream parser (desktop/src/main/cli.ts), and renderer error boundary with the unified log/slog JSON schema (ts, level, msg, component, plus structured attributes).


Subtasks & Engineering Specifications

  • Task 4.1: Structured Desktop Logger & Rotating File Sink (desktop/src/main/logging.ts) (size/m)

    • Target Files:
      • desktop/src/main/logging.ts
      • desktop/src/main/__tests__/logging.test.ts (new)
    • Implementation Details:
      1. Upgrade mainLog in desktop/src/main/logging.ts to emit structured JSON records ({ ts, level, msg, component, ...attrs }) matching the Go slog schema.
      2. Add a bounded rotating file sink under Electron's app.getPath("logs")/devsy-desktop.log (e.g., 10 MB max size, 3 rotated files) alongside human-readable console output in dev mode.
      3. Add mainLog.child({ component: "daemon" | "ipc" | "updater" | "analytics" | "cli" }) and honor DEVSY_LOG_LEVEL.
  • Task 4.2: Preserve trace/debug Levels and Structured Attributes in desktop/src/main/cli.ts (size/s)

    • Target Files:
      • desktop/src/main/cli.ts
      • desktop/src/shared/cli-error.ts
      • desktop/src/main/__tests__/cli.test.ts
      • desktop/e2e/log-level-protocol.e2e.ts
    • Implementation Details:
      1. Expand StreamLine.level in desktop/src/shared/cli-error.ts and normalizeLevel in desktop/src/main/cli.ts to preserve "trace" | "debug" | "info" | "warn" | "error" (currently trace is collapsed into debug).
      2. Preserve structured attributes (phase, step, operation_id, provider, workspace_id, duration_ms, error_code) on parsed StreamLine objects for the Desktop workspace log viewer and error dialogs.
  • Task 4.3: Renderer Error Boundary & IPC Log Forwarding (size/s)

    • Target Files:
      • desktop/src/preload/index.ts
      • desktop/src/main/ipc.ts
      • desktop/src/renderer/
    • Implementation Details:
      1. Expose a rate-limited, payload-validated IPC channel (log:renderer) in preload/main so unhandled Svelte renderer exceptions (window.onerror, unhandledrejection) are recorded in mainLog (component: "renderer").

Verification & Acceptance Criteria

  • mise run desktop:check and mise run desktop:test pass.
  • Desktop E2E protocol suites (desktop/e2e/log-level-protocol.e2e.ts, desktop/e2e/no-status-protocol.e2e.ts) pass.

Activity

  1. added
    enhancement
    on Nov 15, 2026
  2. skevetter commented on Nov 20, 2026

    @skevetter
    ContributorAuthor

    At Core head 1f33a68d, the real CLI and unpackaged Electron passed the hosted Linux context and error-toast scenario. Both screenshots were inspected. Desktop CI passed on that head. The workstream stays open until the equivalent checks pass on the final dependency-pinned revision and the Desktop changes merge. Core PR #1850

  3. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Desktop and child CLI flags now use the canonical arguments in the stacked draft. All 87 local Desktop tests and Svelte check passed on 9cf3f608ceda1c8ac26aa602cecdb0f6dfdf68d9. The same Linux real-CLI and Electron scenario is included for hosted verification on this head.

  4. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The CLI flag retirement draft removes the last Desktop argument fallback after canonical callers migrate. All 87 Desktop unit tests passed locally. Hosted checks are open on the caller migration and the retirement draft.

  5. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics at 27e2e8c5 is updated on merged main and passed 12 focused Desktop tests. The canonical Desktop caller draft at a6f14e16 and retirement draft at e5a8c628 also have fresh hosted verification running.

  6. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics is ready for review at the same signed head 27e2e8c5fdfde082f91234d7e0314027d07dcc10. Hosted CI passed on this head, and CodeRabbit started automatically. This draft transition did not change source or create a dependency on the Core redactor. The current review remains open.

  7. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The signed renderer diagnostics update at 5c6b43f9194d11b92c88f726a2c2f906fe320a04 closes the four privacy findings from the prior review. Regressions covered serialization hooks, passphrases, truncated quoted values, and escaped quotes. All 1,474 Desktop tests, Svelte checks, and local hooks passed. Fresh Desktop CI is queued and the automatic CodeRabbit review hit its rate limit.

  8. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics remains at 5c6b43f9. PR CI passed, and the Desktop workflow is building Flatpak after the other platform builds passed. CodeRabbit accepted one full review request.

  9. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics passed Desktop CI and PR CI on 5c6b43f9194d11b92c88f726a2c2f906fe320a04. The full review covered that head and opened two findings. Masking a registered value can hide a credential label, and Error accessors can run during serialization. Both threads are open.

  10. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics at signed 065a3c16784aeac5a3a29d3dcae6dfa96765ea44 masks overlapping credential ranges against the original text and reads Error data fields without invoking getters. Both regressions failed before the fix, all 1,476 Desktop tests passed afterward, and both redaction and Error threads are resolved. Independent review passed. Hosted checks and fresh CodeRabbit are pending.

  11. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics at 065a3c16 passed 1,476 local tests and resolved both prior findings. Hosted Desktop CI and fresh review are open. CodeRabbit estimated capacity around 09:02 UTC. The caller migration at ccb83269 and flag retirement at 5cff91dd retain their bases and include the new module pin.

  12. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics remains at 065a3c16. PR CI and Desktop CI passed, including Flatpak and all three native builds. CodeRabbit started the requested full review on this head.

  13. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics passed both hosted workflows at signed 065a3c16784aeac5a3a29d3dcae6dfa96765ea44. CodeRabbit completed its full review on that commit. The six prior threads are resolved. One new pre-IPC masking finding is open. An isolated runtime check reproduced synthetic credentials in summaries for access_token, client_secret, and private key.

  14. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Renderer diagnostics at signed dd217509bee919f2077b1cd192ad16f669dbe8d9 shares credential key classification and typed masking between renderer and main. Before-and-after forwarding fixtures cover the reported compound labels, chained assignments, and incomplete values. All 1,485 Desktop tests and independent review passed. The review thread is resolved. Hosted CI is queued, and CodeRabbit reported a wait until around 10:31 UTC.

  15. 8 remaining items

  16. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Shared scanner at signed 037b753 is published separately for review. Seven fixtures, 256 generated checks, Go races, workflow lint and independent review passed. The Desktop integration will use the merged scanner source after the shared PR passes its gates.

  17. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Shared scanner at signed 037b753 passed hosted Pre-commit. Shared Logging CI is queued and CodeRabbit reported rate limiting. The Desktop integration awaits the scanner merge. Its six-path preview passed 1,497 tests and bundled the exact shared source into both Electron-Vite processes.

  18. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Shared scanner at signed 037b753 passed hosted Pre-commit and Shared Logging. Remaining hosted checks are active. CodeRabbit reported rate limiting. Desktop integration awaits the shared scanner merge.

  19. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The shared scanner at 037b7535 passed the shared logging check and native Linux and Windows unit tests. macOS unit tests and the broader integration matrix are still running or queued. The automatic CodeRabbit review was rate-limited. A single review request follows successful hosted CI. Desktop integration remains gated on the scanner merge. Scanner · Hosted CI · Desktop

  20. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    CodeRabbit confirmed capacity and accepted one full review of the shared scanner at 037b7535. Linux and Windows unit tests and all three CLI builds passed. The macOS unit job and broader integration matrix are active. Exact review check · Hosted CI · Desktop integration

  21. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The signed scanner correction at b6af9914 fixes qualified compound labels, documents credential registration, and specifies the Node.js test requirements. All eight local scanner tests, scoped checks, and independent review passed. All three previous review threads are resolved. CodeRabbit accepted the one review on the new head and fresh CI is queued. Scanner · CodeRabbit · CI

  22. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The signed README correction at 34cef71b describes the scanner as a module capability and Desktop adoption as a follow-up. The wording thread is resolved. The prior Shared Logging job passed for identical scanner source. Fresh CI is queued, and CodeRabbit estimates its next review slot around 14:52 UTC. Scanner · CI · Rate-limit reply

  23. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The signed README correction at 34cef71b describes the provided scanner and Desktop adoption as a follow-up. The wording thread is resolved and the README audit found no other claim of current consumer adoption. Current Pre-commit and Shared Logging passed. The wider matrix and the single accepted CodeRabbit review are in progress. Scanner · CI · Review

  24. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The shared scanner at 34cef71b passed CI Success and completed an exact-head CodeRabbit review with zero open threads. The last three jobs passed for Docker, Kubernetes inactivity, and Docker Compose. Desktop adoption follows the scanner merge. Scanner · CI · Review

  25. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The shared scanner is merged. Desktop now imports its exact source from main, and the signed consumer head removes the duplicate scanner. All 1,497 Desktop tests, eight shared scanner tests, the preload fixture, and both bundle provenance checks passed. Both prior threads are resolved. Fresh CI is active and the automatic review paused. Merged scanner · Desktop · Desktop CI · PR CI

  26. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The shared scanner is merged and the signed Desktop consumer at 5fc7eb46 uses its exact source. PR CI, Desktop lint and tests, and hosted tray smoke passed. Both previous review threads are resolved. Desktop packages and the single accepted CodeRabbit review are active. Scanner source · Desktop · Desktop CI · Review

  27. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The Desktop consumer at 5fc7eb46 passed PR CI, lint, unit tests, tray smoke, and Linux, macOS, and Windows packaging. Flatpak is still running. CodeRabbit completed and opened three findings about registered numeric values, paths containing spaces, and incomplete structured details. Desktop · Desktop CI · Review

  28. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    The Desktop consumer at 5fc7eb46 passed both hosted workflows, including tray smoke, Linux, macOS and Windows packages, and Flatpak. CodeRabbit completed with three open findings about registered numeric values, paths containing spaces, and incomplete structured details. Desktop · Desktop CI · PR CI · Review

  29. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Desktop diagnostics now masks registered numeric values in both sinks at signed head 3f0b1d2c. The new regression failed before the fix, all 1,498 Desktop tests passed afterward, and independent review confirmed the two remaining examples fall outside the scanner contract. All three prior threads are resolved. Desktop CI and the new review are pending.

  30. skevetter commented on Nov 21, 2026

    @skevetter
    ContributorAuthor

    Desktop diagnostics is at signed head 83360bf6. All 1,498 tests passed with scalar masking separated from recursive traversal. CodeFactor passed and the prior three threads are resolved. CodeRabbit accepted one review. Desktop CI is running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsize/m

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions