Skip to content

Fix step-usage CodeLens anchor: connector method-name backfill never matched real wire data - #497

Merged
clrudolphi merged 2 commits into
masterfrom
diag/connector-backfill-logging
Aug 27, 2026
Merged

Fix step-usage CodeLens anchor: connector method-name backfill never matched real wire data#497
clrudolphi merged 2 commits into
masterfrom
diag/connector-backfill-logging

Conversation

@clrudolphi

Copy link
Copy Markdown
Collaborator

🤔 What's changed?

ConnectorDiscoveryService.BuildRegistry backfills the AST-precise method-identifier location for connector-discovered bindings (issue #484), meant to replace the connector's raw PDB sequence-point location — which lands on the first executable statement inside the method body, not the declaration line (the "N step usages" lens rendering below the method instead of above it).

That backfill compared sd.Method against Roslyn's bare MethodDeclarationSyntax.Identifier.Text, but DiscoveryResultTransformer.GetMethodReference (connector side) actually emits "{DeclaringTypeName}.{MethodName}({ParamTypeNames})" — e.g. "Steps.SetFirstNumber(Int32)" — never a bare name. The comparison could never match on real data, so every connector-discovered binding silently fell back to the imprecise PDB line. #484's own regression test passed only because its fixture used an artificially bare Method value that doesn't occur in production — masking the bug (that PR's "Live verification in VS Code" checklist item was also left unchecked).

  • Added BindingImporter.ExtractBareMethodName to strip the wire-format reference down to the bare identifier before the name comparison, with pass-through for an already-bare name so existing callers/fixtures are unaffected.
  • Added logging (verbose for the expected/benign "no local source" case, warning for a genuine parse/match failure) at each point the backfill can fail, so a stuck lens can be diagnosed from the server log going forward.
  • Rewrote the demonstrating regression test to assert the fix instead of the bug (line/column now correct, no warning logged); added direct unit tests for ExtractBareMethodName.

⚡️ What's your motivation?

Investigating a live report that the step-usage CodeLens was still rendering below the binding method declaration led back to issue #484, which was believed fixed but never actually verified live. Digging into the fix revealed it was checking a name shape that real connector output never produces.

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

🧩 Area(s) touched

  • LSP server (src/LSP)

♻️ Anything particular you want feedback on?

The new tests prove the fix with realistic wire data, but I haven't done a live VS Code verification against a real built solution — worth doing before merge given #484's history of an untested fix shipping.

📋 Checklist:

  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • Users should know about my change
    • I have added an entry to the "[vNext]" section of the CHANGELOG, linking to this pull request & included my GitHub handle to the release contributors list.

🤖 Generated with Claude Code

clrudolphi and others added 2 commits August 26, 2026 20:57
…matched real wire data

ConnectorDiscoveryService.BuildRegistry backfills the AST-precise method-identifier
location for connector-discovered bindings (issue #484), replacing the connector's raw
PDB sequence-point location (which lands inside the method body, not on the declaration
line -- the "renders below the method" symptom).

That backfill compared sd.Method against Roslyn's bare MethodDeclarationSyntax.Identifier.Text,
but DiscoveryResultTransformer.GetMethodReference (connector side) actually emits
"{DeclaringTypeName}.{MethodName}({ParamTypeNames})", e.g. "Steps.SetFirstNumber(Int32)" --
never a bare name. The comparison could never match on real data, so every
connector-discovered binding silently fell back to the imprecise PDB line. #484's own
regression test passed only because its fixture used an artificially bare Method value
that doesn't occur in production, masking the bug (the PR's "Live verification in VS Code"
checklist item was also left unchecked).

- Add BindingImporter.ExtractBareMethodName to strip the wire-format reference down to
  the bare identifier before the name comparison, with pass-through for an already-bare
  name so existing callers/fixtures are unaffected.
- Add logging (verbose/warning) at each point the backfill can fail, so a stuck lens can
  be diagnosed from the server log going forward.
- Rewrite the demonstrating regression test to assert the fix instead of the bug; add
  direct unit tests for ExtractBareMethodName.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@clrudolphi
clrudolphi force-pushed the diag/connector-backfill-logging branch from 7ebdfc4 to f544d82 Compare August 27, 2026 01:57
@clrudolphi
clrudolphi merged commit b7cc2e1 into master Aug 27, 2026
17 checks passed
@clrudolphi
clrudolphi deleted the diag/connector-backfill-logging branch August 27, 2026 13:15
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