lsp-probe symbols falls back to an ast-grep definition search when workspace/symbol returns nothing #603

Closed
opened 2026-09-16 19:53:19 +00:00 by jared · 3 comments
Owner

Context

Branch lsp-probe-cli (ADR-0197) added bin/lsp-probe, a Thor CLI that spawns ruby-lsp over stdio per call (lib/os_sdlc/lsp_probe/query_runner.rb:21, Open3.popen3). Measured 2026-09-16: one lsp-probe call 4-9 s; bin/evidence collect --root plugins/os-sdlc/lib Model::Db 209 s because lib/os_sdlc/evidence/fingerprint.rb:83-91 runs one LSP query, and so one spawn, per method with no ast-grep sender. LSP workspace/symbol indexing gaps require ast-grep fallback for nested class names.

Owner sketch

class AstDefinition
  PATTERNS = ["class %s", "module %s", "def %s", "def self.%s"].freeze
  def initialize(name:, root:) = ...
  def sites = PATTERNS.flat_map { |p| ast_grep(format(p, @name)) }.map { |h| SymbolMatch.from_ast_hit(h, root: @root) }
end

Cases

  • Remove the second skip in test_symbols_matches_a_nested_class_by_its_final_segment; it passes with outer.rb:2:3 Class Inner.
  • symbols for a private method name defined in a fixture returns its def site.
  • symbols --json marks each match with source equal to ast or lsp.
  • When the LSP list is non-empty, no ast-grep run happens (runner double).

Origin

  • Trigger: evidence performance audit 2026-09-16
  • Improvised this session: none
  • Chain: unskipped test reveals LSP limitation ← workspace/symbol does not index nested class final segments ← ruby-lsp design
  • Root candidate: n/a
  • Where: lib/os_sdlc/lsp_probe/ast_definition.rb
  • Session: 01153d94-6459-43dc-bd20-e68b757af56f
  • Transcript: https://claude.com/claude-code
## Context Branch lsp-probe-cli (ADR-0197) added bin/lsp-probe, a Thor CLI that spawns ruby-lsp over stdio per call (lib/os_sdlc/lsp_probe/query_runner.rb:21, Open3.popen3). Measured 2026-09-16: one lsp-probe call 4-9 s; `bin/evidence collect --root plugins/os-sdlc/lib Model::Db` 209 s because lib/os_sdlc/evidence/fingerprint.rb:83-91 runs one LSP query, and so one spawn, per method with no ast-grep sender. LSP workspace/symbol indexing gaps require ast-grep fallback for nested class names. ## Owner sketch ```ruby class AstDefinition PATTERNS = ["class %s", "module %s", "def %s", "def self.%s"].freeze def initialize(name:, root:) = ... def sites = PATTERNS.flat_map { |p| ast_grep(format(p, @name)) }.map { |h| SymbolMatch.from_ast_hit(h, root: @root) } end ``` ## Cases - Remove the second `skip` in `test_symbols_matches_a_nested_class_by_its_final_segment`; it passes with `outer.rb:2:3 Class Inner`. - `symbols` for a private method name defined in a fixture returns its def site. - `symbols --json` marks each match with `source` equal to `ast` or `lsp`. - When the LSP list is non-empty, no ast-grep run happens (runner double). ## Origin - Trigger: evidence performance audit 2026-09-16 - Improvised this session: none - Chain: unskipped test reveals LSP limitation ← workspace/symbol does not index nested class final segments ← ruby-lsp design - Root candidate: n/a - Where: lib/os_sdlc/lsp_probe/ast_definition.rb - Session: 01153d94-6459-43dc-bd20-e68b757af56f - Transcript: https://claude.com/claude-code
Author
Owner

Work started via os-sdlc pipeline on branch ticket-603 (worktree off lsp-probe-cli at 99394bf5). Session 01153d94.

Work started via os-sdlc pipeline on branch ticket-603 (worktree off lsp-probe-cli at 99394bf5). Session 01153d94.
Author
Owner

Pipeline impl 26 ended implementation_failed verdict:error at programmer: gate HarnessError 'no test file found for lib/os_sdlc/lsp_probe/ast_definition.rb' (Project::Test::Candidates requires a mirror test per changed lib file; the programmer may not write tests). Suite was 1304 green at that point. Hand-finishing: add tests/lsp_probe/ast_definition_test.rb and the --json source field. Session 01153d94.

Pipeline impl 26 ended implementation_failed verdict:error at programmer: gate HarnessError 'no test file found for lib/os_sdlc/lsp_probe/ast_definition.rb' (Project::Test::Candidates requires a mirror test per changed lib file; the programmer may not write tests). Suite was 1304 green at that point. Hand-finishing: add tests/lsp_probe/ast_definition_test.rb and the --json source field. Session 01153d94.
Author
Owner

Resolution

Done: LspProbe::AstDefinition (ast-grep class/module/def/def self. sites) as SymbolsRequest fallback when workspace/symbol is empty; SymbolMatch gains source (lsp|ast) through the daemon wire and --json. Nested-class test un-skipped and green. Commits on ticket-603, merges to lsp-probe-cli.

Evidence: Suite 1309 runs 0 failures 0 skips; rubocop clean. Live: symbols Inner --root -> outer.rb:2:3 Class Inner; --json shows source ast. Pipeline impl 26: 5 dispatches, verdict:error at programmer (gate HarnessError no test file for new lib file); hand-finished.

Follow-ups: Gate maps require a mirror test for every new lib file but the programmer cannot write tests, so any ticket that names a new lib file without a test in the reviewed diff errors out; this is a map/charter gap, add to #605 or #535 lineage. Filed as line here; user decides.

## Resolution **Done:** LspProbe::AstDefinition (ast-grep class/module/def/def self. sites) as SymbolsRequest fallback when workspace/symbol is empty; SymbolMatch gains source (lsp|ast) through the daemon wire and --json. Nested-class test un-skipped and green. Commits on ticket-603, merges to lsp-probe-cli. **Evidence:** Suite 1309 runs 0 failures 0 skips; rubocop clean. Live: symbols Inner --root <tmp> -> outer.rb:2:3 Class Inner; --json shows source ast. Pipeline impl 26: 5 dispatches, verdict:error at programmer (gate HarnessError no test file for new lib file); hand-finished. **Follow-ups:** Gate maps require a mirror test for every new lib file but the programmer cannot write tests, so any ticket that names a new lib file without a test in the reviewed diff errors out; this is a map/charter gap, add to #605 or #535 lineage. Filed as line here; user decides.
jared closed this issue 2026-09-17 07:32:53 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#603
No description provided.