Skip to content

fix on singleton class returning python as current lang always#1878

Merged
Saga4 merged 4 commits intomainfrom
fix/bug_lang_detection
Mar 19, 2026
Merged

fix on singleton class returning python as current lang always#1878
Saga4 merged 4 commits intomainfrom
fix/bug_lang_detection

Conversation

@Saga4
Copy link
Contributor

@Saga4 Saga4 commented Mar 19, 2026

No description provided.

@claude
Copy link
Contributor

claude bot commented Mar 19, 2026

Claude finished @Saga4's task in 7m 19s —— View job


PR Review Summary

  • Gather context
  • Triage PR size — SMALL (1 file, 13 lines changed)
  • Lint and type check — ruff format issue fixed, mypy errors are pre-existing
  • Resolve stale threads — none found
  • Code review
  • Duplicate detection
  • Post summary

Prek Checks

Ruff format wanted to collapse the multi-line function signature back to single-line (it fits within 120 chars). Fixed and pushed as style: auto-fix ruff formatting in get_git_diff signature.

Mypy errors in the file are pre-existing (unrelated to this PR — they're in other functions like get_remote_url, confirm_proceeding_with_no_git_repo, etc.).

Code Review

The fix is correct.

The bug: current_language_support().file_extensions was called in get_git_diff via a lazy import. Since current_language_support() is a singleton that returns Python before language detection runs, this caused Java/JS/TS files to be silently dropped from the diff results.

The fix replaces it with set(get_supported_extensions()) which uses all registered extensions across all languages. This is the right approach — get_git_diff is an infrastructure-level function that shouldn't be limited to the currently-detected language.

Also correctly removes the duplicate supported_extensions = set(get_supported_extensions()) assignment that PR #1858 had placed after the if/elif/else block (it was overwriting the buggy value, but the first assignment was never fixed until now).

No bugs, security issues, or breaking API changes found.

Duplicate Detection

No duplicates detected. get_supported_extensions() is the appropriate shared utility from languages/registry.py.

Test Fixes

Two tests (test_java_diff_ignored_when_language_is_python and test_mixed_lang_diff_filters_by_current_language) were testing the old filtering-by-current-language behavior and were failing in CI. Updated them to assert the new correct behavior — all supported extensions are returned regardless of the current language setting. All 3 tests in TestGetGitDiffMultiLanguage now pass.

Pushed as test: update git_diff tests to match new all-extensions behavior.


Last updated: 2026-03-19

Saga4 and others added 3 commits March 19, 2026 23:29
Co-authored-by: Sarthak Agarwal <undefined@users.noreply.github.com>
get_git_diff now uses all registered extensions instead of filtering
by current language, so update tests to reflect the new behavior.

Co-authored-by: Sarthak Agarwal <undefined@users.noreply.github.com>
@Saga4 Saga4 merged commit 668c6d8 into main Mar 19, 2026
26 of 27 checks passed
@Saga4 Saga4 deleted the fix/bug_lang_detection branch March 19, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant