Skip to content

dev-env: a stale venv can silently test a different tree-sitter grammar than CI, inverting parser results #1625

Closed

Description

@Shashankss1205

Hit this while reviewing #1610 and it produced a confidently wrong review, so it's worth a guard.

pyproject.toml pins:

tree-sitter-language-pack>=1.6,<2.0

A venv created before that pin was raised can still hold 0.13.0 and nothing complains — pytest runs, the suite passes, and parser behaviour differs materially from CI.

Why it matters

The Kotlin single-line-object misparse (#1600) is entirely grammar-dependent:

grammar 1.14.3 (pinned):  object A { fun x() = 1 }  ->  infix_expression, 0 object_declaration captures
grammar 0.13.0 (stale) :  object A { fun x() = 1 }  ->  object_declaration, captures = ['A']

So on a stale venv the bug does not reproduce, and #1610 looks like a no-op that can be closed. I nearly did exactly that. The reporter and I would have disagreed indefinitely with both of us running pytest and both seeing green.

This cuts the other way too: a parser fix developed against 0.13.0 could pass locally and fail in CI.

Suggested guards

Any one of these would have caught it:

  1. A session-scoped test assertion that the installed tree_sitter_language_pack.__version__ satisfies the pin, failing loudly rather than skipping. Cheap and self-maintaining.
  2. tests/run_tests.sh verifying installed versions against pyproject.toml before running (e.g. pip check plus an explicit version compare) — pip check alone does not catch this, since the stale package satisfies no broken dependency graph, it just predates the pin.
  3. Documenting a pip install -e . --upgrade step in the contributing guide for anyone with an older checkout.

(1) is the most robust because it fails on the machine that's actually wrong.

Related: my local venv also had codegraphcontext 0.4.16 installed while the repo was at 0.5.7, which made cgc --version report 0.4.16 — a false positive for #1262. Same root cause: a long-lived venv drifting from the repo.

Activity

  1. github-actions commented on Aug 13, 2026

    @github-actions
    Contributor

    Hi! 👋 Join our CodeGraphContext Discord channel to collaborate: https://discord.gg/dR4QY32uYQ

  2. pushkalachepuri commented on Aug 14, 2026

    @pushkalachepuri

    Hi
    Please assign it to me under GSSoC 2026.
    /assign

  3. moved this from Backlog tasks to In progress in CGC Progress Boardon Aug 18, 2026
  4. moved this from In progress to Done in CGC Progress Boardon Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions