[PIR #808] vscode: inject issue title into architect reference#899
Merged
Conversation
- BacklogTreeItem now carries issueTitle as a typed field alongside issueId/issueUrl (vs parsing it out of the composite display label). - buildArchitectReferenceInjection (new pure helper, separate file so it can be unit-tested without mocking vscode) formats the injection as #<id> "<title>" with double-quote escaping; falls back to #<id> if the title is missing or empty. - codev.referenceIssueInArchitect resolves the title via extractIssueTitle and passes both to the helper. - Updated source-sentinel test to assert the helper call instead of the old inline template literal; added 6 direct unit tests for the helper covering escape, multi-quote, undefined/empty fallback, and backslash passthrough.
Collaborator
Author
Architect ReviewLow-risk small PR. 332/5 across 10 files, but most is bookkeeping — 4 plan/project/review/thread artifacts + 2 test files. Real production change is ~46 LOC across 4 files:
CMAP unanimous (gemini=APPROVE, codex=APPROVE, claude=APPROVE). Verified
VerdictApproved. Per PIR protocol, the Architect review |
amrmelsayed
added a commit
that referenced
this pull request
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PIR Review: Inject issue title into backlog → architect reference
Fixes #808
Summary
The Backlog inline action Reference Issue in Architect previously injected only
#<id>into the architect terminal's prompt buffer, forcing the user (and the architect AI) to look up the title before the prompt carried any working context. This PR threads the title through as a typed field onBacklogTreeItem, formats the injection as#<id> "<title>"(with"→\"escaping and a fallback to the old#<id>form for empty/missing titles), and adds direct unit coverage for the formatting helper.Files Changed
packages/vscode/src/architect-reference-injection.ts(+21 / -0, new) — pure helper that builds the injection string; novscodedeps so it can be unit-tested directly.packages/vscode/src/__tests__/architect-reference-injection.test.ts(+47 / -0, new) — 6 tests covering title-present formatting, multi-quote escape, undefined/empty fallback, and backslash passthrough.packages/vscode/src/extension.ts(+25 / -1) —extractIssueTitle(arg)alongsideextractIssueId(arg);codev.referenceIssueInArchitectresolves both and passes them to the new helper.packages/vscode/src/views/backlog-tree-item.ts(+1 / -0) —issueTitle: stringadded as a readonly typed field onBacklogTreeItemnext toissueId/issueUrl.packages/vscode/src/views/backlog.ts(+1 / -1) —makeRowpassesitem.title(the undecorated title fromOverviewBacklogItem) into the newBacklogTreeItemconstructor slot.packages/vscode/src/__tests__/extension-architect-commands.test.ts(+5 / -3) — source-sentinel regex updated to assert on the helper call rather than the old inline template literal; the spirit of the assertion (still no architect-name arg → defaults to'main') is preserved.codev/plans/808-vscode-backlog-architect-refer.md,codev/state/pir-808_thread.md— protocol artifacts.Commits
5160a438[PIR vscode: backlog → architect reference should include the issue title alongside the id #808] Inject issue title into architect referencef55896c8[PIR vscode: backlog → architect reference should include the issue title alongside the id #808] Update thread for implement phase792b56bb[PIR vscode: backlog → architect reference should include the issue title alongside the id #808] Plan draft(Porch state-transition commits omitted from the human-relevant list — they're visible in
git logfor audit.)Test Results
pnpm check-types(vscode): ✓ pass (clean, no errors)pnpm lint(vscode): ✓ passnode esbuild.js(vscode): ✓ passpnpm test:unit(vscode): ✓ 55 tests pass (49 baseline + 6 new inarchitect-reference-injection.test.ts)implement → dev-approval:build✓ (5.4s),tests✓ (20.5s)dev-approvalgate and approved.Architecture Updates
No arch changes — the change is local to the VSCode extension's backlog command handler and one tree-item class. No new module boundaries, no new patterns. The "pure helper in its own file so it can be unit-tested without mocking
vscode" approach (architect-reference-injection.ts) is a continuation of the existing precedent set byprune-builder-terminals.ts, not a new architectural rule.Lessons Learned Updates
No lessons captured — the change was mechanical (thread a field, escape one character, branch on a fallback). The one decision worth noting in the per-PR review (and already in the plan) was extracting the helper into its own file rather than exporting from
extension.ts, but that's a re-use of an existing pattern, not new wisdom.Things to Look At During PR Review
buildArchitectReferenceInjectionwould be exported fromextension.ts. I moved it intopackages/vscode/src/architect-reference-injection.tsso the unit test can import the live function —extension.tsimportsvscodeat top level and won't load under vitest's node env without mocking the whole module. Same precedent asprune-builder-terminals.ts. The plan's intent (direct unit coverage of escape + fallback) is preserved."escaping only; titles with literal\pass through unmodified. The rationale is inarchitect-reference-injection.ts's docstring: double-escaping would diverge from the visible row label (#id title @author), surprising the user.extractIssueTitlereturnsundefinedfor an empty string so the fallback branch in the helper is identical to the missing-title path. The helper also guards against''independently — defense in depth in case a future caller skips the wrapper.extension-architect-commands.test.ts:84regex-matched the literalinjectArchitectText(\#${issueId} `). The new assertion matchesinjectArchitectText(buildArchitectReferenceInjection(...)` — tight enough to catch a regression to the old inline shape, broad enough to not break if the helper's argument order or layout changes. Worth eyeballing.How to Test Locally
For reviewers pulling the branch:
pir-808→ View Diffafx dev pir-808#<id> "<title>"with the cursor after the trailing space, no Enter sent."(the unit test'Has "quoted" word'covers this in code — for a live test, any GitHub issue with quotes in its title works). The buffer should show\"for each occurrence.No new dependencies, no contribution-point changes, no settings.