Skip to content

DocumentProfile comment summary + comments-toggle count badge (bd-0rsk07il) - #601

Merged
cscheid merged 8 commits into
mainfrom
feature/bd-0rsk07il-document-profile-comments
Aug 25, 2026
Merged

DocumentProfile comment summary + comments-toggle count badge (bd-0rsk07il)#601
cscheid merged 8 commits into
mainfrom
feature/bd-0rsk07il-document-profile-comments

Conversation

@cscheid

@cscheid cscheid commented Aug 25, 2026

Copy link
Copy Markdown
Member

Closes #445.

Teaches Pass-1's DocumentProfile about editorial comments so downstream tooling gets comment-awareness without processing the whole document, and ships the first consumer: a count badge on hub-client's comment-display toggle.

What's here

DocumentProfile v13 — new comments: Vec<ProfileComment>: every [>> … ] / […]{.quarto-edit-comment} mark in the body, in source order, each carrying its plain-text projection, source span, typed in-band author= / date= attributes ([>> text ]{author="…" date="…"} is now an interpreted convention; ISO 8601 UTC), and remaining attr kvs. Comments in included files count toward the host. The version bump is deliberate even though the field is serde-additive: a cached v12 profile would deserialize cleanly and silently report "no comments" — cached entries regenerate automatically (the version is in the cache-key hash domain).

Response surfaceUnwrapProfileStage now moves the profile onto StageContext instead of discarding it; run_pipeline bridges it to RenderContext, both WASM Pass-2 renderers carry it on WasmPassTwoOutput (same seam as theme_fingerprint), and RenderResponse.comments (new JsonComment transport type in quarto-core: 1-based Monaco positions, mapped source file) is populated on both the single-doc and project-active branches.

hub-client badgeReactPreview reports RenderResponse.comments via a new onCommentsChange callback → PreviewRouterEditorReplayDrawer; a single count pill on the comments-mode toggle group, hidden at zero.

Design decisions, review notes, and the phase log: claude-notes/plans/2026-08-25-document-profile-comments.md.

Verification

  • TDD throughout: 14 new tests (unit + pipeline integration + component), each verified failing first. Workspace suite green (13399); hub-client build:all, unit (1005), and wasm-tier (133) green.
  • Real-browser e2e against npm run local-prod: badge shows 2 for a doc with two marks; an edit makes it 3; adding a comment through the bubble UI writes the mark to source and shows 4; resolving via ✓ deletes it and shows 3.
  • Known-unrelated: cargo xtask verify's ts-packages leg fails on a pre-existing KaTeX \tag{N} test that is red on main too (.katex-tag missing) — filed as bd-kn7ln981.

Follow-ups filed

  • bd-juei440d — hub add-comment path stamps in-band author=/date= (write side of the convention this PR reads).
  • bd-lh3lgb20 — project-wide per-file comment summary map for file-sidebar badges.
  • bd-kn7ln981 — the pre-existing red KaTeX test.

🤖 Generated with Claude Code

cscheid and others added 8 commits August 25, 2026 11:44
…k07il)

Plan draft covering profile field shape (per-comment text + span +
in-band author/date attr interpretation), version bump rationale,
WASM RenderResponse surfacing, and the hub-client comment-toggle
badge as first consumer. Awaiting review before execution.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Entries+spans confirmed (cache privacy verified: .quarto/ is gitignored
by q2 create scaffolding); active-page-only first cut; single badge
location; author=/date= with ISO 8601 UTC and display-name identity,
write-side stamping as follow-up strand.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Adds comments: Vec<ProfileComment> to the profile — every editorial
comment ([>> ... ] / [...]{.quarto-edit-comment}) in the body, in
source order, with plain-text projection, source span, typed in-band
author=/date= attrs, and remaining-kv passthrough. The walk keys on
the quarto-edit-comment span class (the reader's postprocess rewrites
EditComment nodes into that form) with a defensive EditComment arm,
and mirrors LinkResolutionStage's traversal; comment marks are leaves.

Version bump 12 -> 13: the field is serde-additive, but a cached v12
profile would silently report 'no comments' — the semantic misread
the version check exists for. Cached entries regenerate automatically
(version is in the cache-key hash domain).

Tests: 5 unit tests (TDD, verified failing first) + include-splice
pipeline integration test. Contract doc updated (version tag,
guarantees row, change log). Full workspace suite green (13395).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…7il)

Retention: UnwrapProfileStage moves the Pass-1 profile onto
StageContext.document_profile instead of discarding it; run_pipeline
bridges it to RenderContext.document_profile; both WASM Pass-2
renderers copy it onto WasmPassTwoOutput (same seam as
theme_fingerprint). The q2-preview pipeline keeps both checkpoint
stages, so single-doc and project-active branches populate alike.

Transport: JsonComment (quarto-core, natively tested) carries text,
in-band author/date, kv passthrough, the mapped source file, and
1-based Monaco positions with diagnostic_to_json's end-position
fallback. RenderResponse gains comments: Option<Vec<JsonComment>>
(absent = zero). TS: RenderComment + RenderResponse.comments in
preview-renderer's diagnostic.ts, the shared definition.

TDD: 4 new tests verified failing first. Workspace suite green
(13399); npm run build:wasm compiles the WASM side cleanly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…k07il)

ReactPreview reports RenderResponse.comments through a new
onCommentsChange callback after each successful preview-pipeline
render (absent-on-wire maps to []; parse-only formats and render
failures preserve the last-good count, matching the AST and theme-
fingerprint semantics). PreviewRouter threads it to Editor, which
keeps the count and hands it to ReplayDrawer; CommentsModeToggle
renders a single count pill on the toggle group (both drawer
states), hidden at zero.

TDD: ReplayDrawer.commentsBadge.test.tsx verified failing first.
build:all (strict tsc -b), unit (1005) and wasm-tier (133) suites
green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Full verify green except pre-existing KaTeX \tag failure (also red on
main; filed bd-kn7ln981). Real-browser e2e against local-prod: badge
2 -> 3 -> 4 (UI add writes the mark to source) -> 3 (UI resolve
deletes it). Follow-ups bd-juei440d, bd-lh3lgb20 filed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@posit-snyk-bot

posit-snyk-bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cscheid
cscheid merged commit 0896237 into main Aug 25, 2026
10 checks passed
@cscheid
cscheid deleted the feature/bd-0rsk07il-document-profile-comments branch August 25, 2026 21:08
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.

teach DocumentProfile about the presence of comments

2 participants