Skip to content

Future document diagnostics: broken links, HTML checks and live browser console #466

Open

Description

@raiseCatError

Status

Deferred, no implementation during current release. Investigate current Markdown/HTML parser, source editor, and browser preview after Claude lands them; avoid duplicate validation or console infrastructure.

Goal

Add a low-noise, offline-first Problems surface while editing Markdown/HTML/CSS, and an optional browser console for runtime errors and resource failures in trusted previews. Go from an actionable warning to the exact source location without disrupting the document workspace.

Related

#460 hybrid editing, #461 source/render workspace, #462 Markdown/HTML features, #402 native editor. Leverage browser CDP Runtime, Log and Network selectively; don't recreate a giant devtools stack.

Scope

Static, local checks: missing local image/font/CSS paths, unresolved relative Markdown links or file fragments, duplicate heading IDs, malformed image/link references, basic HTML parse issues, common accessibility mistakes (e.g., img missing alt, explicit controls lacking labels where checkable), obvious invalid local CSS if a trustworthy parser is available. Do not flag every unconventional but valid construct as broken. Dynamic HTML/JS may not be statically provable.
Runtime browser console (opt-in when trusted preview/browser active): JavaScript exceptions, console warnings/errors, network/resource failures and source URLs/line/column when provided. Safe ordering, bounded log entries, search/filter by severity, clearing and copying reviewed diagnostics. Map to editable local source only when reliable; otherwise label external/generated scripts.
Editor UX: gutter indications, a collapsible Problems/Console view, click/keyboard jump to source, understandable explanation and optional reviewed fix. Errors should not interrupt typing; diagnostics are debounced and cancel stale versions on edit.

Safety

  • Opening an untrusted local file for static checks must not run JavaScript or contact external URLs. For path checks, restrict target resolution and never read network endpoints, credentials, symlinks outside allowed root without documented permission.
  • Browser console is not a code execution panel by default; keep arbitrary expression evaluation outside initial scope. Scrub/redact URLs, headers, query tokens, secrets and file paths as appropriate; do not implicitly persist all runtime messages in transcripts or share telemetry.
  • Debounce/cap parsing and watcher work; no CPU saturation on long documents; no interpreter process when closed.
  • Never bypass the fileEdit atomic/conflict pipeline for suggested fixes. Respect NO_COLOR, Safe Glyphs, keyboard/terminal ownership and accessible severity text.

Acceptance / tests

  • Code/data model for diagnostic id, source span, severity, confidence, version, source type (static/runtime) and dismiss/recheck behaviour.
  • Fixtures with missing local assets, duplicate slugs, broken anchors, valid odd syntax, mixed local/remote refs and hostile paths produce bounded truthful results.
  • Refresh and unsaved-buffer diagnostics update without disk writes or stale locations; edits/undo/redo update exact source anchor.
  • Trusted runtime JavaScript exception and 404 resource show in live console; JS-off untrusted preview doesn't execute or make network requests.
  • Error navigation preserves editor focus; UI handles long/multiline diagnostics and 30/50/80/120 columns.
  • Redaction, cleanup, restart, file watcher/child process count, and physical Ghostty/Zed QA tracked.

Non-goals

Full LSP server, automatic lint downloads, silently fixing files, full DevTools or making browser runtime mandatory for static checks.

Activity

  1. raiseCatError commented on Oct 21, 2026

    @raiseCatError
    OwnerAuthor

    Resumed for v0.24 (the earlier pause protected the v0.22/v0.23 schedule; the issue text predates v0.23, so scope is reconciled against the current code before implementation). Order and dependencies: docs/development/v024-ledger.md on branch feature/v024-draft-recovery (PR #489).

  2. added 2 commits that reference this issue on Oct 21, 2026
  3. raiseCatError commented on Oct 22, 2026

    @raiseCatError
    OwnerAuthor

    Runtime Console merged into dev (PR #504, merge be3f6ab). Automated checks are green on the exact head (64831e3, run 39767603153). Physical QA: NOT RUN.

    What changed: C in the Chromium preview of a Markdown or HTML document shows what the page reported for the loaded document:

    • script exceptions
    • console errors, warnings and messages
    • failed loads and HTTP errors
    • CSP refusals
    • requests NMSh refused

    It is read-only. It never turns scripts or the network on, evaluates nothing, and records nothing from /browser pages or the Mermaid renderer. Entries are redacted before they are stored, and stay in memory with fixed limits.

    Keys: Tab filters by severity. Typing searches. Shift+↑↓ marks entries. Del clears. Ctrl+C shows the exact text before copying. Enter goes to the line only for an HTML document that hasn't changed since the page loaded; otherwise it says why.

    To test (Ghostty and Zed): follow docs/testing/v024-editor-physical-qa.md → Browser Console (#466).

    1. Use an HTML file with a throwing inline script, console.error/console.warn, a missing image and a remote <img>.
    2. With scripts off, only the missing image and the refusal appear.
    3. Press T to turn scripts on. After the reload, the exception appears, and Enter on it lands on the exact line.
    4. Edit the text without refreshing: Enter now refuses the jump. Press r to refresh.
    5. Copy entries and paste them. Check that there is no preview token and no query or password= value.
    6. Check that the caret, selection, dirty marker and undo are unchanged after closing the Console.
    7. Check at 30, 50, 80 and 120 columns, with NO_COLOR and with Safe Glyphs.

    Automated: browserConsole, browserConsoleView and browserConsoleChrome (real Chromium), plus an independent security review whose confirmed findings were fixed with regression tests. Details are in docs/design/document-workspace.md → Console.

    Still open for #466: the Problems gutter marker, further languages, and physical QA.

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions