Skip to content

Conversation

@MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Oct 16, 2025

Summary

Fixes a panic in list_modules_in (which is called by the completions request) when the file root for editable installs or a custom typeshed path was missing.

Funnily enough, there were existing tests covering this already. Unfortunately, they also used their custom logic to register the file roots, so that the test passed, but the same request failed in production.

I used this PR as an opportunity to improve our file-root related logging and the information we include if a file root is missing.

Fixes astral-sh/ty#1363

Test Plan

Updated existing tests, added new test

@MichaReiser MichaReiser requested a review from carljm as a code owner October 16, 2025 12:03
@MichaReiser MichaReiser added bug Something isn't working server Related to the LSP server ty Multi-file analysis & type inference labels Oct 16, 2025
@MichaReiser MichaReiser added bug Something isn't working server Related to the LSP server ty Multi-file analysis & type inference labels Oct 16, 2025
@github-actions
Copy link
Contributor

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

@MichaReiser MichaReiser changed the title [ty] Fix 'missing root' during completion [ty] Fix panic 'missing root' when handling completion request Oct 16, 2025
@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@Danielkonge
Copy link
Contributor

Just a note: I checked out this branch and tried it out, and it indeed fixes the problem I kept encountering in the linked issue.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

With the heavy caveat that I don't know much about the list_modules_in function, this makes sense to me

@MichaReiser MichaReiser merged commit 058fc37 into main Oct 16, 2025
46 checks passed
@MichaReiser MichaReiser deleted the micha/fix-missing-root-during-completion branch October 16, 2025 14:23
dcreager added a commit that referenced this pull request Oct 16, 2025
…rable

* origin/main:
  [ty] Support dataclass-transform `field_specifiers` (#20888)
  Bump 0.14.1 (#20925)
  Standardize syntax error construction (#20903)
  [`pydoclint`] Implement `docstring-extraneous-parameter` (`DOC102`) (#20376)
  [ty] Fix panic 'missing root' when handling completion request (#20917)
  [ty] Run file watching tests serial when using nextest (#20918)
  [ty] Add version hint for failed stdlib attribute accesses (#20909)
  More CI improvements (#20920)
  [ty] Check typeshed VERSIONS for parent modules when reporting failed stdlib imports (#20908)
dcreager added a commit that referenced this pull request Oct 17, 2025
* main:
  [ty] Prefer declared type for invariant collection literals (#20927)
  [ty] Don't track inferability via different `Type` variants (#20677)
  [ty] Use declared variable types as bidirectional type context (#20796)
  [ty] Avoid unnecessarily widening generic specializations (#20875)
  [ty] Support dataclass-transform `field_specifiers` (#20888)
  Bump 0.14.1 (#20925)
  Standardize syntax error construction (#20903)
  [`pydoclint`] Implement `docstring-extraneous-parameter` (`DOC102`) (#20376)
  [ty] Fix panic 'missing root' when handling completion request (#20917)
  [ty] Run file watching tests serial when using nextest (#20918)
  [ty] Add version hint for failed stdlib attribute accesses (#20909)
  More CI improvements (#20920)
  [ty] Check typeshed VERSIONS for parent modules when reporting failed stdlib imports (#20908)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Server panic on every letter of pkg in import pkg completion (not just #1277)

4 participants