Skip to content

fix(cli): remove stale RED PHASE docblocks and redundant cast in symbol matcher#123

Merged
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-122
Mar 28, 2026
Merged

fix(cli): remove stale RED PHASE docblocks and redundant cast in symbol matcher#123
Looted merged 2 commits intodevelopfrom
copilot/sub-pr-122

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

Three review comments on the symbol coordinate matcher that were left over from the planning/draft phase: two test docblocks still described hypothetical future behavior using "RED PHASE" language, and one push call carried a double-cast that became redundant once the type union was settled.

Changes

  • symbols-ts.test.tsexportedWinsOverInternal docblock: Replaced "RED PHASE: The current implementation only scans exported declarations" with accurate present-tense description of the live exported-first priority rule.
  • symbols-ts.test.tsambiguousInternalTitlesFailClosed docblock: Replaced "RED PHASE: The current scanner ignores non-exported declarations" with accurate description of the now-live fail-closed behaviour when multiple internal declarations share the same title.
  • symbols-ts.ts:248 — redundant cast removed:
    // Before
    methodCandidates.push({ node: method as unknown as NamedDeclarationCandidate, getNameNode: () => nameNode });
    
    // After
    methodCandidates.push({ node: method, getNameNode: () => nameNode });
    MethodDeclaration extends Node, which is already a member of the NamedDeclarationCandidate union — the as unknown as escape hatch was unnecessary.

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI changed the title [WIP] Align entity guidance and documentation across multiple files fix(cli): remove stale RED PHASE docblocks and redundant cast in symbol matcher Mar 28, 2026
Copilot AI requested a review from Looted March 28, 2026 10:15
@Looted Looted marked this pull request as ready for review March 28, 2026 10:16
Copilot AI review requested due to automatic review settings March 28, 2026 10:16
@Looted Looted merged commit bad5b58 into develop Mar 28, 2026
1 check passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Cleans up the TypeScript symbol coordinate matcher guardrail tests and matcher implementation by removing draft-phase language and simplifying a now-unnecessary type cast, keeping the documentation and code aligned with the current exported-first matching behavior.

Changes:

  • Updated two test docblocks to describe the current exported-first and fail-closed behaviors (removing stale “RED PHASE” wording).
  • Removed a redundant as unknown as cast when recording class method candidates in the TS symbol matcher.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/cli/tests/extractors/symbols-ts.test.ts Updates docblocks to reflect current matcher behavior and priorities.
packages/cli/src/extractors/symbols-ts.ts Removes redundant cast when pushing method candidates.

Comment on lines +94 to +97
* The matcher now scans non-exported top-level functions, but when multiple
* internal declarations share the same title and there is no exported
* declaration to disambiguate, it must treat the match as ambiguous and
* emit no coordinates. This test locks in that fail-closed behaviour.
Copy link

Copilot AI Mar 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The updated docblock says that when multiple internal declarations share the same title (and no export exists) the matcher must emit no coordinates. In the current implementation, ambiguity among non-exported top-level functions can still fall through to the class-method scan, which may return coordinates if there is exactly one matching method. Consider tightening the wording to explicitly describe ambiguity handling for non-exported top-level functions (and/or mention the method fallback) so the comment matches the actual priority rules.

Suggested change
* The matcher now scans non-exported top-level functions, but when multiple
* internal declarations share the same title and there is no exported
* declaration to disambiguate, it must treat the match as ambiguous and
* emit no coordinates. This test locks in that fail-closed behaviour.
* The matcher now scans non-exported top-level functions before falling
* back to class or instance methods. When multiple non-exported top-level
* declarations share the same title and there is no exported declaration
* to disambiguate, that top-level match is treated as ambiguous and MUST
* emit no coordinates, even if a unique method with that title exists.
* This test locks in that fail-closed behaviour for top-level functions.

Copilot uses AI. Check for mistakes.
@Looted Looted deleted the copilot/sub-pr-122 branch March 28, 2026 10: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.

3 participants