Skip to content

Migrate ClassCandidates onto the SymbolSource seam - #375

Merged
Firehed merged 2 commits into
mainfrom
slice/S2.2
Jul 28, 2026
Merged

Migrate ClassCandidates onto the SymbolSource seam#375
Firehed merged 2 commits into
mainfrom
slice/S2.2

Conversation

@Firehed

@Firehed Firehed commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Slice S2.2 — Migrate ClassCandidates to search

Slice: S2.2 (docs/architecture/build-manifest.md, Wave 1)
Plan step: docs/architecture/0002-execution-plan.md Step 2 (§5.5 consumer-migration table; §5.4 lightweight SymbolDefinition) — a consumer migration onto the S2.1 seam, no behavior change.
Depends on: S2.1 (SymbolSource / SymbolSink + delegating facade, #374) — merged.
RFC sections: 0001 §4.2 (Symbol Discovery Authority), §4.4 (FQN-based knowledge queries).

Routes ClassCandidates' workspace prefix search through SymbolSource::searchClassLikes instead of naming SymbolIndex directly. The one DelegatingSymbolSource facade is constructed in Server.php and shared; subsequent Step 2 slices route the remaining consumers onto the same instance (Plan §5.5).

Behavior preservation

The plan requires this migration be identical (same backing). searchClassLikes searches the whole class-like namespace and returns each match with its kind, so the per-position kind narrowing that the index query used to do stays in the consumer, applied against each result's own kind — before the ClassCandidateFilter::accepts() predicate. That ordering matters: accepts resolves through the ClassRepository, which cannot vouch for a symbol whose declaration it cannot reach (e.g. an indexed interface with no resolvable file), so the index's authoritative kind must gate first. testNewCompletionExcludesIndexedInterfaces pins exactly this.

Proven by the existing completion suite across every filter (Any / Instantiable / TypeHint / …) and by the frozen PrefixSearchParityTest golden, which stays unchanged because this slice does not touch the search surface itself.

Acceptance criteria

  • ClassCandidates reads class-like prefix search through SymbolSource::searchClassLikes, no longer naming SymbolIndex directly.
  • Offered candidates are identical across all ClassCandidateFilter positions (existing CompletionHandlerTest coverage green, including the synthetic-interface and abstract-class exclusion cases).
  • The PrefixSearchParityTest golden is unchanged (the search surface is untouched).
  • The shared facade is wired once in Server.php; NamespaceCandidates still reads the raw catalog (its migration is S2.3).
  • composer test green (PHPStan + tests + PHPCS).

Not in this slice

  • The §4.2 enforcement rule that forbids naming SymbolIndex / ClassRepository / NamespaceCatalog outside a backend lands in S2.6 (scoped-exempt), once the other consumers (S2.3–S2.5) have migrated.

Candidate closes

None — the manifest lists no Closes for S2.2.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.14%. Comparing base (ae41c97) to head (9becb8b).

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #375   +/-   ##
=========================================
  Coverage     98.13%   98.14%           
- Complexity     1710     1711    +1     
=========================================
  Files           107      107           
  Lines          4297     4308   +11     
=========================================
+ Hits           4217     4228   +11     
  Misses           80       80           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Firehed
Firehed merged commit e2cf6b0 into main Jul 28, 2026
7 checks passed
@Firehed
Firehed deleted the slice/S2.2 branch July 28, 2026 18:21
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.

1 participant