vscode: group builders tree by area, extract shared grouping primitives (PIR #818)#890
Merged
Conversation
…habetical-only, single-Uncategorized flatten)
…reaGroupExpansionStore, migrate backlog onto them
…GroupTreeItem, AreaGroupExpansionStore)
Collaborator
Author
Architect ReviewApproved. Builder went beyond the spec'd mirror — extracted the area-grouping primitives that #811 introduced into a new shared module (
Per PIR protocol, Architect review |
amrmelsayed
added a commit
that referenced
this pull request
May 27, 2026
15 tasks
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: Group Builders Tree by Area (mirror #811, dedup primitives)
Fixes #818
Summary
Builders tree in the VSCode sidebar now groups by
area/*label (alphabetical specific areas,Uncategorizedlast), mirroring the backlog grouping that #886 shipped. To avoid duplicating ~67 LOC of structural code across the two views, the PR also extracts three shared primitives (groupByArea<T>,AreaGroupTreeItembase class,AreaGroupExpansionStore+persistAreaGroupExpansionhelper) and migrates the already-shipped backlog view onto them in the same PR. Net effect: builders gains the new feature, backlog loses 50 LOC, and the "rule structurally identical to backlog's" acceptance criterion is enforced byimport, not by reviewer attention.Files Changed
packages/core/package.json(+4 / -0) — new./area-groupingexportpackages/core/src/area-grouping.ts(+44 / -0) — NEW: genericgroupByArea<T>packages/vscode/src/views/area-group-tree-item.ts(+27 / -0) — NEW: sharedAreaGroupTreeItembasepackages/vscode/src/views/area-group-expansion.ts(+59 / -0) — NEW:AreaGroupExpansionStore+persistAreaGroupExpansionpackages/vscode/src/test/area-grouping.test.ts(+82 / -0) — NEW: 7 tests forgroupByArea<T>packages/vscode/src/views/builders.ts(+143 / -50) — two-level provider,getParent, single-Uncategorized flattenpackages/vscode/src/views/builder-tree-item.ts(+13 / -0) —BuilderGroupTreeItemthin subclasspackages/vscode/src/views/backlog.ts(+10 / -61) — migrated onto shared primitivespackages/vscode/src/views/backlog-tree-item.ts(+10 / -0) —BacklogGroupTreeItemthin subclasspackages/vscode/src/test/backlog.test.ts(+1 / -57) — droppedgroupBacklogByAreasuite (covered by generic)packages/vscode/src/extension.ts(+5 / -14) —persistAreaGroupExpansion×2codev/plans/818-vscode-group-builders-in-the-t.md(+334 / -0) — plan artifactCommits
9e838a6c[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Rename wireAreaGroupExpansion → persistAreaGroupExpansiona6561d29[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Thread: log implement phase completion4419a7d7[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Apply area grouping to Builders tree8bd1537c[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Migrate backlog view onto shared area-grouping primitivesd5186d46[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Extract shared area-grouping primitives (groupByArea, AreaGroupTreeItem, AreaGroupExpansionStore)227ea3f3[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Plan revised — extract groupByArea + AreaGroupTreeItem + AreaGroupExpansionStore, migrate backlog onto them6519ea35[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Plan revised — mirror vscode: group backlog tree by area/* label (PIR #811) #886's shipped shape (no toggle, alphabetical-only, single-Uncategorized flatten)b6021767[PIR vscode: group builders in the tree by area (area/* label namespace, identical to backlog) #818] Plan draftTest Results
pnpm --filter codev-vscode check-types: ✓ passpnpm --filter codev-vscode lint: ✓ passpnpm --filter codev-vscode compile(esbuild bundle): ✓ passpnpm --filter codev-vscode test: ✓ pass (90 tests, 7 newsuite('groupByArea'), 4 droppedsuite('groupBacklogByArea')— coverage shifted to the generic)wireAreaGroupExpansion → persistAreaGroupExpansionapplied as part of the same review passArchitecture Updates
No changes to
codev/resources/arch.md. The change is confined to the VSCode extension's view layer — no impact on Tower internals, builder lifecycle, worktree management, shellper protocol, or any other surface arch.md documents.Lessons Learned Updates
Added one entry to
codev/resources/lessons-learned.mdunder Architecture:The original plan (v2) committed knowingly-duplicated code with the "byte-identical to #886" criterion enforced only by prose. The human caught it before approval; v3 added the extraction. The extraction itself was cheap (~3 small files, mechanical backlog migration); the lesson is recognizing the trap at plan time so the extraction lands together with the second consumer, not as a follow-up that competes with other priorities.
Things to Look At During PR Review
packages/vscode/src/views/backlog.tsloses ~50 LOC. The diff is intentionally a no-op —groupBacklogByAreais replaced withgroupByArea(items, i => i.area);setGroupExpanded/readExpansionState/EXPANSION_STATE_KEYare replaced with anAreaGroupExpansionStorefield. Walk the backlog view in VSCode first and confirm zero visible change — that's the highest-blast-radius part of the diff.reveal()in grouping mode:views/builders.tsoverridesgetParentto return the cached group forBuilderTreeItemchildren. The cache (groupParentByBuilderId) is repopulated every timerootChildren()runs in multi-group mode; cleared in the single-Uncategorizedflatten case (builders are root again). Watch for the accordion behaviour with two builders in different areas — expanding one should auto-collapse the other.AreaGroupTreeItemsub-classing pattern:BacklogGroupTreeItemandBuilderGroupTreeItemare 3-line subclasses that exist solely soextension.ts's per-view expand/collapse handlers can scope viainstanceof. Without them, both handlers would fire on every group expand/collapse. Mentioned for clarity; the design isn't novel but the subclasses look almost empty so worth a sentence.OverviewBuilder.areas[](plural) in places. The implementation consumes the single-stringOverviewBuilder.areaprojection that vscode: group backlog tree by area/* label (PIR #811) #886 / core: parseAreaLabels helper + flow areas[] through BacklogItem and BuilderOverview #819 actually shipped. If you'd prefer rolling the wire shape forward to plural, that's a separate change against core: parseAreaLabels helper + flow areas[] through BacklogItem and BuilderOverview #819 — out of scope here.How to Test Locally
For reviewers pulling the branch:
afx dev pir-818main(no visible regression from the migration)<area> (<count>)headers, alphabetical specifics,UncategorizedlastorderForDisplay()(blocked → idle-waiting → active)vscodein Backlog → Builders'vscodegroup stays expanded (separateworkspaceStatekeys)codev.buildersAutoCollapseon, expand one builder → others auto-collapse across groupsarea/*label on an open issue viagh issue edit→ next overview tick (~60s) re-groups the affected builderFlaky Tests
None.