Skip to content

vscode: review-comment polish (placeholders, reviews coverage, author identity)#900

Merged
amrmelsayed merged 18 commits into
mainfrom
builder/pir-857
May 28, 2026
Merged

vscode: review-comment polish (placeholders, reviews coverage, author identity)#900
amrmelsayed merged 18 commits into
mainfrom
builder/pir-857

Conversation

@amrmelsayed
Copy link
Copy Markdown
Collaborator

PIR Review: VSCode review-comment polish pass

Fixes #857

Summary

Four-part polish on the native VS Code Comments wiring for codev/{plans,specs,reviews}/*.md. The inline + input now carries Codev-specific copy, codev/reviews/*.md files joined the eligible-paths set, the REVIEW marker author now flows from OverviewData.currentUser (Tower's existing GitHub-login identity, same source used by the Backlog view's "assigned to you" sort) with an architect fallback, and the Comments-panel aggregation was verified working with the existing controller wiring.

Files Changed

  • packages/vscode/src/comments/plan-review.ts (+22 / -7)
  • packages/vscode/src/commands/review.ts (+7 / -2)
  • packages/vscode/src/extension.ts (+2 / -2)
  • codev/plans/857-vscode-spec-plan-review-commen.md (+141 / -0) — plan artifact
  • codev/state/pir-857_thread.md (+26 / -0) — builder thread log
  • codev/projects/857-vscode-spec-plan-review-commen/status.yaml (+22 / -0) — porch state

Commits

(Plus porch-managed bookkeeping commits for gate / phase transitions.)

Test Results

  • pnpm --filter codev-vscode check-types: ✓ pass
  • pnpm --filter codev-vscode lint: ✓ pass
  • pnpm --filter codev-vscode test: ✓ pass (83 tests, 0 new — see "Architecture Updates")
  • porch build check: ✓ (6.4s)
  • porch tests check: ✓ (20.6s)
  • Manual verification at the dev-approval gate: human approved after exercising the inline + flow on plans, specs, and reviews files, plus the palette Codev: Add Review Comment command and the Comments panel aggregation.

Architecture Updates

No codev/resources/arch.md changes — this PR is a polish bundle on existing VS Code wiring; no module boundaries or patterns moved. The one mild design decision worth noting (read author at write-time rather than caching at activation) is local to the comments module and doesn't merit arch-doc real estate.

No new unit tests were added. The four changes are: (a) one assignment to a VS Code API surface (controller.options), (b) one regex literal edit, (c) a one-line read from OverviewCache.getData()?.currentUser at write-time in two call sites, and (d) a no-op verification. Each is mechanically obvious from the diff; behavior testing happens against the running VS Code Extension Host (covered by the human's exercise of the worktree at the dev-approval gate). Adding unit harness around vscode.comments.createCommentController or stubbing OverviewCache for these one-liners would inflate the test suite without catching anything the dev-approval review wouldn't.

Lessons Learned Updates

No codev/resources/lessons-learned.md changes from this PR specifically — the design course-correction (git-config → OverviewData.currentUser) is captured in the builder thread (codev/state/pir-857_thread.md) and was a single-issue redirect, not durable engineering wisdom.

That said, the redirect itself is the type of "ask before reaching for a subprocess" pattern that PIR's plan-approval gate exists to surface — the original plan would have shipped a working but parallel identity mechanism, and the reviewer's question redirected to the canonical one with one round-trip. That's the gate doing its job, not a lesson worth documenting.

Things to Look At During PR Review

  • overviewCache.getData()?.currentUser ?? 'architect' at plan-review.ts:148 and commands/review.ts:25 — confirm read-at-write (not at activation) is the right shape. Rationale in the plan's Risks section: Tower can refresh currentUser mid-session via SSE, so freezing it at activation would stale-pin the author. Lookup is a synchronous in-memory cache hit; no perf concern.
  • Fallback to 'architect' — chosen so existing committed <!-- REVIEW(@architect): ... --> markers and any new ones written before Tower's first fetch use a consistent placeholder. The REVIEW_COMMENT_PATTERN regex already matches any @([^)]+), so back-compat is preserved.
  • controller.options at plan-review.ts:46-49 — VS Code documents options as a controller-level property; the two strings shape every "+ new" and reply input belonging to this controller. No way to target only plan/spec/review vs. other use surfaces because this controller has exactly one surface.
  • Comments-panel aggregation (Fix 4) — verified working with no wiring change. The controller already has a non-empty label ('Codev Plan Review') and commentingRangeProvider, which are the only prerequisites for panel inclusion per the VS Code Comments API contract.

How to Test Locally

For reviewers pulling the branch:

  • View diff: VSCode sidebar → right-click builder pir-857 → Review Diff
  • Run dev server: VSCode sidebar → Run Dev Server, or afx dev pir-857

What to verify (mirrors the plan's Test Plan):

  • Inline + input on codev/plans/*.md shows "Type your review comment, then Submit" (Fix 1)
  • Inline + appears on codev/reviews/*.md and submit lands a REVIEW marker inline (Fix 2)
  • Submitted REVIEW markers use your GitHub login as author, not @architect (Fix 3 — both via the inline + and via the Codev: Add Review Comment palette command)
  • Existing <!-- REVIEW(@architect): ... --> markers in committed files still render as collapsed comment threads (back-compat)
  • Trash icon on an inline thread still removes the line (delete-flow regression)
  • View → Open View → Comments → "Codev Plan Review" group lists every active thread (Fix 4 verification)

@amrmelsayed
Copy link
Copy Markdown
Collaborator Author

Architect Review

Low-risk polish bundle. 299/15 across 7 files, but only 3 production files:

  • packages/vscode/src/comments/plan-review.ts (+21/-8) — the main file: placeholder override + regex extension to cover reviews/ + author identity
  • packages/vscode/src/commands/review.ts (+7/-2) — git config user.name lookup
  • packages/vscode/src/extension.ts (+6/-5) — wiring updates

Net production change: ~34 LOC. Each of the four issue-body items fits cleanly into this budget. CMAP unanimous (gemini=APPROVE, codex=APPROVE, claude=APPROVE), with one cosmetic claude COMMENT on a stale extension.ts comment addressed in a5d20e6f.

Verified

  • All 4 issue-body items covered: placeholder override via controller.options, regex extended to codev/(plans|specs|reviews)/, hardcoded @architect replaced with git-config user.name lookup, Comments-panel discoverability verified during dev-approval
  • Lightweight implementation — no new files, modifications to the existing plan-review.ts + review.ts + extension.ts only. Same surfaces, polished behavior
  • Plan-approval + dev-approval gates already passed (human verified the running worktree — placeholders, reviews/ files, author handle all confirmed)
  • No test file changes — consistent with the existing pattern (no tests existed for plan-review.ts before this either; behavior is VSCode-API integration that's hard to unit-test without heavy mocking). If pir-883's "extract pure helper for testability" pattern were to be applied here as a follow-up refactor, that's a separate issue worth filing

Composes with the recently-merged spec/plan/review work

After this lands, the integrated review workflow becomes:

Verdict

Approved. Per PIR protocol, the pr gate is the human's call — awaiting your explicit porch approve 857 pr --a-human-explicitly-approved-this before the builder merges.


Architect review

@amrmelsayed amrmelsayed merged commit 03a3385 into main May 28, 2026
6 checks passed
amrmelsayed added a commit that referenced this pull request May 28, 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.

vscode: spec/plan review comments — polish pass (placeholders, reviews/ coverage, author identity, panel discoverability)

1 participant