Skip to content
This repository was archived by the owner on Sep 2, 2026. It is now read-only.

[Spec #94] Classify spec / ticket / idea ghosts from the issue body - #102

Merged
64ix merged 8 commits into
mainfrom
64ix/issue-94-classify-spec-ticket-idea-ghosts-from-t
Aug 27, 2026
Merged

64ix merged 8 commits into
mainfrom
64ix/issue-94-classify-spec-ticket-idea-ghosts-from-t

Conversation

@64ix

@64ix 64ix commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​411 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​409
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​178 $\color{#cf222e}{\Huge{\mathbf{−}}}$​19 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​159

Summary

The feature board's Idea column was a dumping ground: every open base-remote issue whose title didn't start with [Spec] landed there, so a spec's six Ticket — … children sat next to genuine ideas with nothing telling them apart.

This classifies each issue as spec / ticket / idea in the main process, from the title and the search/issues payload's body — which was already being fetched and thrown away. Zero extra API calls, works retroactively on existing issues, and the body itself never crosses the wire: only two derived fields do.

  • Specs route to the Spec column under every convention /implement-spec recognises, not just [Spec].
  • An issue with a ## Parent heading naming an issue is a sub-ticket and never becomes a ghost — unconditionally, whether or not its parent is open, visible, or in the selected repos.
  • A spec ghost card carries a 6 tickets badge, so the covered set stays visible without expanding anything.

Spec & Tickets

Closes #94

No child tickets — the spec is autosufficient and was implemented as a single unit.

Acceptance criteria

Criterion Verdict Evidence
New pure module src/shared/spec-ticket-shape.ts exports deriveSpecTicketShape({ title, body }) ✅ src/shared/spec-ticket-shape.ts:52 — SPEC_TITLE_PATTERN (line 6) covers [Spec], Spec:, Spec —, Spec -, [PRD], PRD: case-insensitively; ## Success Criteria → spec; ## Parent naming an issue → ticket; else undefined
Same module exports parseParentIssueNumber(body), reusing the parseReferencedIssueNumbers rules ✅ spec-ticket-shape.ts:39, over the shared parseIssueReferenceNumbers (line 14) that parseReferencedIssueNumbers now delegates to
GitHubWorkItem gains optional specShape / parentIssueNumber; mapIssueWorkItem stamps them, body is not carried ✅ src/shared/github/work-item-types.ts:34, src/main/github/client/map/work-item.ts:26 + :58; test asserts body is absent from the item
Remote wire: both fields optional and absent from an older host's payload; renderer falls back to title-only [Spec] and excludes nothing new ✅ feature-board-ghost-candidates.ts:130 guards on specShape === undefined; feature-board-ghost-candidates.test.ts:168. The RPC layer validates params only and returns the result unserialized through a schema, so a new host's fields reach the client intact
buildFeatureBoardGhostCandidates routes specShape === 'spec' to spec, legacy title match still routes there ✅ feature-board-ghost-candidates.ts:130; tests at :161
An issue with a parentIssueNumber never becomes a ghost candidate, unconditionally ✅ feature-board-ghost-candidates.ts:124; test at :196 uses a parent number absent from openIssues entirely. The exclusion stayed literally unconditional through the review fix below — a spec simply never carries the field
Existing referencedIssueNumbers / dismissal / wayfinder / linked-issue / cross-repo exclusions unchanged ✅ None of that filter logic was touched; the 19 pre-existing tests in feature-board-ghost-candidates.test.ts pass unmodified
GhostCandidate gains childTicketCount, counted before candidate filtering so excluded tickets still count ✅ feature-board-ghost-candidates.ts:87 builds the count map ahead of the candidate loop; tests at :209, including the dismissed-ticket-still-counts case
FeatureBoardGhostCard renders a 6 tickets badge when childTicketCount > 0, i18n key + en.json, not expandable ✅ FeatureBoardGhostCard.tsx:94 reuses the existing Badge variant="outline" chip; components.featureBoard.ghost.childTicketCount in en.json
Unit tests across every title convention, both body headings, Ticket — with no ## Parent, routing / exclusion / counting, card render presence + absence ✅ spec-ticket-shape.test.ts (26 cases), feature-board-ghost-candidates.test.ts:157-256, work-item.test.ts:38-79, FeatureBoardGhostCard.test.tsx

Changes

Classification (shared, provider-neutral) — new src/shared/spec-ticket-shape.ts: deriveSpecTicketShape, parseParentIssueNumber, and the #N reference scanner both it and the renderer's parseReferencedIssueNumbers now share.

Main process — mapIssueWorkItem parses item.body to stamp specShape / parentIssueNumber via conditional spreads, so an unclassified issue carries neither key. GitHubWorkItem gains the two optional fields.

Ghost derivation — buildFeatureBoardGhostCandidates counts child tickets per parent before any exclusion runs, drops every issue carrying a parentIssueNumber, and prefers specShape over the legacy title match while falling back to it when the field is absent.

Card — the count renders as an outline badge in the existing badge row.

Review fix — deriveSpecTicketFields in src/shared/spec-ticket-shape.ts:64 is now the single source for both fields, and mapIssueWorkItem spreads it rather than calling the two derivations independently. See below.

Code review

/code-review on the branch found one real bug, reproduced before it was fixed:

A spec whose body also carried a ## Parent heading — a spec nested under an epic, or one with both ## Success Criteria and ## Parent — disappeared from the board entirely: not in Idea, not in Spec. deriveSpecTicketShape deliberately lets a spec title win over a ## Parent heading, but mapIssueWorkItem called parseParentIssueNumber independently, so the issue was stamped with both specShape: 'spec' and parentIssueNumber. The unconditional sub-ticket exclusion then fired before the spec routing and dropped it. Probe confirmed it: the mapper yielded both fields and the derivation returned [].

The fix goes in the derivation layer, not the board: a spec is never a sub-ticket, so deriveSpecTicketFields only sets parentIssueNumber alongside specShape: 'ticket', and it is now the only thing callers spread. That keeps the board's exclusion literally unconditional as the criterion requires, and puts the precedence in one place so the two cannot drift apart again. buildFeatureBoardGhostCandidates was not touched.

Verified by mutation rather than on trust: removing the specShape === 'ticket' guard turns exactly 3 tests red across the mapper, the shared module, and the ghost derivation; restoring it returns 59/59.

Test changes rather than additions

Two existing test files were edited, both type-level only, because GhostCandidate.childTicketCount is required rather than optional:

  • FeatureBoardColumn.test.tsx — added childTicketCount: 0 to a satisfies GhostCandidate<…> literal.
  • use-feature-board-ghost-candidates.test.tsx — same, in the ghostEntry() helper.

No pre-existing assertion was changed, weakened, or removed anywhere; no skips, no tolerances, no regenerated snapshots. One test added in this PR was rewritten while the review fix landed: the mapper/derivation parity test in feature-board-ghost-candidates.test.ts originally imported mapIssueWorkItem, which broke typecheck because main-process modules aren't on the renderer tsconfig project allowlist; it was repointed at deriveSpecTicketFields — the value the mapper spreads — and the mapper itself stays directly covered by work-item.test.ts's 'parentIssueNumber' in item assertion.

Both units landed test-first: commit 2b8c47f is test-only and runs 13 of the new tests red before 099c8b0 makes them green; e21c8b9 is test-only for the review fix and fails with expected 1 to be undefined before c78a407.

Decisions taken without asking

  • Problem: the criterion says to reuse the parseReferencedIssueNumbers rules, but that function lives in a renderer component file that src/shared/ must not import. Resolution: the regex moved into the shared module as parseIssueReferenceNumbers, and the renderer's function delegates to it — identical behavior, existing tests untouched, no cross-layer dependency.
  • Problem: precedence when a title matches a spec convention and the body has a ## Parent heading. Resolution: title wins — a spec that catalogues its own parent stays a spec. Covered by a test.
  • Problem: heading matching strictness. Resolution: an exact heading line (^#{1,6}\s+<text>\s*$), not a substring.
  • Problem: pluralising the badge. Resolution: left invariant ({{value0}} tickets), matching the existing count badges on this surface.
  • Out of scope, deliberately left alone: the hook's linkedIssues still uses the title-only isOrphanSpecIssue to decide whose body to fetch for referencedIssueNumbers, so a worktree-linked Spec — … doesn't contribute #N exclusions. The new unconditional parentIssueNumber exclusion already covers its sub-tickets, and the criterion asks for that path to stay unchanged. GitLab's work item type is untouched — the board only consumes GitHubWorkItem today, and the new module is provider-neutral so a future wiring reuses it as-is.

QA plan

  • Open the feature board on a repo with a Spec — … issue and its Ticket — … children: the spec sits in Spec, and none of the children appear in Idea.
  • The spec's ghost card shows a N tickets badge matching the number of open children; the card does not expand when clicked (it grabs the issue).
  • A genuine idea issue — no spec-style title, no ## Parent, no ## Success Criteria — still appears in Idea with its capture badges.
  • Dismiss one child ticket, reload: the spec's badge count is unchanged (the count precedes filtering).
  • A legacy [Spec] … issue still routes to Spec.
  • A spec whose body carries both ## Success Criteria and ## Parent appears in Spec — it does not vanish from the board (the review finding).
  • Pair a client against a host that predates this change: ghosts still render, [Spec]-titled issues route to Spec, no issue disappears from Idea, and no badge shows.

64ix added 7 commits August 27, 2026 17:52
Red first: new tests fail because spec-ticket-shape.ts does not exist yet,
GhostCandidateIssue/GitHubWorkItem lack specShape/parentIssueNumber, and
GhostCandidate lacks childTicketCount. Covers title-convention + body-heading
shape derivation, ## Parent number parsing, ghost routing/exclusion/counting,
mapIssueWorkItem stamping, and the ghost card's child-ticket badge.

Refs #94
…body

New src/shared/spec-ticket-shape.ts (provider-neutral) derives spec/ticket
shape from title conventions ([Spec]/Spec:/Spec —/Spec -/[PRD]/PRD:) and
body headings (## Success Criteria, ## Parent), and parses the first #N
under ## Parent, reusing the referenced-issue #N/URL/anchor rule.

GitHubWorkItem gains optional specShape/parentIssueNumber; mapIssueWorkItem
stamps them from the search payload's body (never itself carried onto the
item). Both fields are optional so an older host's payload — missing them
entirely — falls back to today's title-only [Spec] classification, per
remote-wire-compatibility.md Rule 1.

buildFeatureBoardGhostCandidates routes specShape==='spec' to the spec
column (falling back to isOrphanSpecIssue when the field is absent),
unconditionally excludes any issue with a parentIssueNumber from ghost
candidacy, and computes GhostCandidate.childTicketCount over the repo's
open issues before any exclusion so a dismissed/linked sub-ticket still
counts.

FeatureBoardGhostCard renders a "N tickets" badge when childTicketCount > 0
(components.featureBoard.ghost.childTicketCount, en.json), following the
existing outline-badge pattern; the card stays non-expandable.

Test change: FeatureBoardColumn.test.tsx, use-feature-board-ghost-candidates.test.tsx
— existing GhostCandidate literals now include childTicketCount: 0 (type-only
addition; the new required field, not a behavior change).

Refs #94
…ding

A [Spec]-titled issue whose body also has a ## Parent heading gets stamped
with both specShape:'spec' and parentIssueNumber by mapIssueWorkItem, even
though deriveSpecTicketShape's own title-vs-body precedence says a spec is
never a sub-ticket. The unconditional parentIssueNumber exclusion in
buildFeatureBoardGhostCandidates then drops the issue from every column.

- work-item.test.ts: mapIssueWorkItem stamps parentIssueNumber (bug)
- feature-board-ghost-candidates.test.ts: mapper/derivation parity — the
  mapped issue vanishes instead of routing to the spec column (bug)

Refs #94, #102
deriveSpecTicketShape's title-vs-body precedence says a spec is never a
sub-ticket, but mapIssueWorkItem called deriveSpecTicketShape and
parseParentIssueNumber independently, so a [Spec]-titled issue whose body
also had a ## Parent heading got stamped with both specShape:'spec' and
parentIssueNumber. buildFeatureBoardGhostCandidates' unconditional
sub-ticket exclusion (which must stay unconditional) then dropped the
issue from every board column instead of routing it to Spec.

Add deriveSpecTicketFields as the single source of both derived fields:
parentIssueNumber is only ever set alongside specShape:'ticket'.
mapIssueWorkItem now spreads its result instead of computing the two
fields separately. deriveSpecTicketShape and parseParentIssueNumber stay
exported and unchanged, per the spec's own tests.

Also repoints the ghost-candidates parity test at deriveSpecTicketFields
(shared) instead of the main-process mapper: src/main/github/client/map
is not on the tc.web/node tsconfig project allowlists, so importing it
from a renderer test broke pnpm run typecheck.

Fixes review finding on PR #102, refs #94
@64ix
64ix marked this pull request as ready for review August 27, 2026 17:43
…ec lookup

Four gaps found while implementing #94 independently, ported onto this branch.

The linked-spec lookup still tested the title for `[Spec]`, so a worktree linked
to a `Spec — …` issue resolved no body and excluded none of the tickets that spec
covers — they all resurfaced in Idea, which is the mixing #94 exists to stop.
Extract `isSpecShapedIssue` so the hook and the candidate derivation agree.

Also: accept `PRD —` / `Spec- ` / `Spec :` in the title convention, read a parent
named on the heading line (`## Parent: #25`), and give the counter badge a
singular form so one ticket no longer reads "1 tickets".
@64ix
64ix merged commit d87d3c2 into main Aug 27, 2026
47 checks passed
@64ix 64ix mentioned this pull request Aug 27, 2026
14 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Classify spec / ticket / idea ghosts from the issue body so Idea stops mixing spec sub-tickets in

1 participant