Skip to content

feat(roadmap): find symbol definitions with tree-sitter - #4820

Merged
dan-petty merged 3 commits into
mainfrom
feat/4638-tree-sitter-symbol-definitions
Nov 12, 2026
Merged

dan-petty merged 3 commits into
mainfrom
feat/4638-tree-sitter-symbol-definitions

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

The definition lookup of the stage probe, the refine context and the implement premise check read only *.py files, so the probe said that a Rust function that a dreamscaper issue cites has no definition. Now one git grep finds the lines that name the identifier in the source files of each language that tree-sitter reads, Markdown excepted, and Python keeps its definition expression. When no Python file defines the name, one more git grep reads the other files, and TreeSitterEngine confirms a symbol of that name. The probe lists an identifier that its bound leaves undecided as not probed, and the context names the definitions. The grammar tag queries were rejected: bash, HCL, Dockerfile and YAML ship none.

Closes #4638

Change: openspec/changes/archive/2026-11-11-4638-find-symbol-definitions-with-tree-sitter/

@dan-petty dan-petty added type/feature Type feature: a new function scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them labels Nov 11, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Measurements and checks

Dreamscaper. Issue #3 of dan-petty/dreamscaper cites the Rust functions explorer_patrol_system and sync_agent_destinations. I ran the code read-only on a local clone of that repository.

  • Base (origin/main): definition_lines gives no line for either name. The probe says "explorer_patrol_system has no definition at the staging commit. No commit in the history added or removed its text." The context has no symbol section.
  • This change: definition_lines gives src/game/unit.rs:81:fn explorer_patrol_system( and src/engine/ai/ai_plugin.rs:80:fn sync_agent_destinations(. The probe confirms both with 4 commands. The context section says Defined at: src/game/unit.rs:81 and lists src/game/unit.rs under Callers:.

Python result. I took 60 identifiers at origin/main of this repository: 58 that a Python file defines, and 2 words from the shell and YAML files. Base and change gave the same lines for all 60. The 60 lookups took 182 s on base and 108 s with this change, on a host that ran other test runs at the same time.

Tests. The new tests failed on base (commands is no argument, and the Rust and shell lookups gave no line). tests/roadmap/test_premise.py, tests/roadmap/stage/test_roadmap_stage_probe.py and tests/roadmap/refine/test_roadmap_refine_context.py pass with the change (50 tests). devops ci --check --only lint,format,typecheck,openspec,docs,constructs,test-tree,startup-imports,swallowed-failures passes.

Live steps. None. The change adds no setting and changes no ConfigMap or Secret. The Service uses the new lookup when its image rolls.

The definition lookup of the stage probe, the refine context and the
implement premise check read only Python files. A Rust function that an
issue cites got the probe line that it has no definition.

One git grep now finds the lines that name the identifier in the source
files of each language that tree-sitter reads, Markdown excepted. The
Python definitions come from the same expression as before. When no
Python file defines the name, one more git grep reads the other files,
and TreeSitterEngine confirms a symbol of that name. The probe lists an
identifier that the bound leaves undecided as not probed. The symbol
section of the context lists these files and names the definitions.
A definition lookup that reads only the first CONST_ROADMAP_DEFINITION_READ_FILES files of other languages and finds no definition now returns None, so the stage probe lists the identifier as not probed and writes no false premise. The limit table gives both new constants a class.
@dan-petty
dan-petty force-pushed the feat/4638-tree-sitter-symbol-definitions branch from 2159ef2 to 3d04e00 Compare November 12, 2026 01:58
@dan-petty

Copy link
Copy Markdown
Owner Author

Review fixes for the two findings on this pull request.

  1. Blocking: two new limits had no class (tests/roadmap/test_roadmap_limit_classes.py). Confirmed: on the old head, test_every_numeric_limit_of_the_roadmap_jobs_has_a_class failed with ['CONST_ROADMAP_DEFINITION_READ_FILES', 'CONST_ROADMAP_REFINE_DEFINITIONS_PER_SYMBOL'] != []. Fix: the LIMITS table now gives each constant the class kept and a reason. The constants stay in config/constants.py, so the table keeps them in its registry.

  2. Major: a cut read gave "no definition" (src/devops_cli/roadmap/premise.py). Confirmed: with 21 Rust files that call shared_helper and the definition in src/z_util.rs, definition_lines returned (), and the stage probe would write a false "has no definition" line. Fix: when the lookup reads fewer files than name the identifier and finds no definition, it returns None (undecided). The stage probe then lists the identifier as not probed, and the refine context writes no "Defined at" line. New tests: test_a_cut_read_that_finds_no_definition_is_undecided (premise) and test_a_cut_definition_read_leaves_the_function_not_probed (stage probe). The first failed on the old head with assert () is None. The docstring, the constant comment, docs/roadmap/stage.md, the design, the tasks and the requirements of roadmap-stage and roadmap-implement-job now state the case.

The branch is rebased on the current origin/main, and the OpenSpec archive is the last commit again.

@dan-petty
dan-petty merged commit 3b3fddc into main Nov 12, 2026
27 checks passed
@dan-petty
dan-petty deleted the feat/4638-tree-sitter-symbol-definitions branch November 12, 2026 02:05
dan-petty pushed a commit that referenced this pull request Nov 12, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.115.0](v0.114.1...v0.115.0)
(2026-11-12)


### Features

* **design:** add the design tokens and their build
([#4811](#4811))
([db4b19a](db4b19a))
* **roadmap:** find symbol definitions with tree-sitter
([#4820](#4820))
([3b3fddc](3b3fddc))


### Bug Fixes

* **ai:** the gateway group that answered decides the local label
([#4907](#4907))
([0da637f](0da637f))
* **ci:** replay a changed gate check in fail-to-pass
([#4898](#4898))
([59bfc57](59bfc57))
* **config:** read each config file as YAML 1.2
([#4858](#4858))
([c3130a3](c3130a3))
* **roadmap:** loosen the caps that turn a stage refusal into a loss
([#4869](#4869))
([4492fc3](4492fc3))
* **roadmap:** refine reads a dependency named by title
([#4877](#4877))
([2829f9c](2829f9c))
* **roadmap:** refine sends a judge refusal to an agent round
([#4874](#4874))
([e4fc6a9](e4fc6a9))
* **tests:** refuse test writes under the real home
([#4857](#4857))
([0f6ac1b](0f6ac1b))
* **tests:** the plain-Python helper test keeps PYTHONPATH
([#4914](#4914))
([99c109d](99c109d))


### Performance Improvements

* **ci:** direct pytest runs wait for a gate slot
([#4901](#4901))
([e80db62](e80db62))
* **roadmap:** status lane reads the snapshot, skips idle stops
([#4887](#4887))
([f285cf8](f285cf8))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/roadmap The roadmap jobs: intake, refine, stage, implement and the Service that runs them type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(roadmap): find symbol definitions with tree-sitter tags

1 participant