[ty] Add Git-aware diagnostic diff mode - #27554
Draft
Gankra wants to merge 3 commits into
Draft
Conversation
Typing conformance resultsNo changes detected ✅Current numbersThe percentage of diagnostics emitted that were expected errors held steady at 96.96%. The percentage of expected errors that received a diagnostic held steady at 92.96%. The number of fully passing files held steady at 106/133. |
Contributor
Author
|
Notable caveat: this approach necessarily doesn't induce venv updates if your branch changed a dependency. Fixing that would require more leveraging of uv integration (we could pass uv --isolated and potentially tell it to reuse the isolated venv it hands us on the second run). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
(Disclaimer: I had codex spit this out on a whim, I haven't looked at it, although the PR description reflects the desired behaviour/motivation of the PR.)
Adds
ty check --diff [REVISION], which reports only diagnostics introduced by the current branch or working-tree changes, analogous to git-clang-format:The point of this feature is twofold:
Existing diagnostics are matched by file, mapped source location, rule, severity, and message, so inserting lines above an existing error or renaming its file ideally does not incorrectly report it as new.
Rather than filtering diagnostics to modified lines, we check the project at the Git merge base, update the same Salsa database to the current working tree, and compare the resulting diagnostics. This lets us catch errors introduced in unchanged files, such as existing call sites affected by a changed function signature. This is ostensibly performant because it can lean on ty lsp machinery for handling diffs.