Repository navigation
fix: fall back to file extension for usages language with custom match patterns - #598
Merged
Merged
Conversation
jonathannorris
marked this pull request as ready for review
October 13, 2026 17:41
jonathannorris
requested review from
suthar26
and
a balanced review from Copilot
and removed request for
Copilot
October 13, 2026 17:41
Copilot stopped reviewing on behalf of
jonathannorris due to an error
October 13, 2026 17:42
There was a problem hiding this comment.
🟡 Changes recommended
Prototype-inherited map entries can violate the helper’s string return contract, and the integration test uses unsafe shared state.
2 open findings
What changed in this PR
Adds safe language fallback handling for custom usage match patterns.
Changes:
- Maps unknown safe extensions to lowercase language names.
- Defaults unsafe extensions to
unknown. - Adds HTML fixture and unit/integration coverage.
| File | Description |
|---|---|
test-utils/fixtures/usages/sample.html |
Adds HTML usage fixture. |
src/utils/parsers/language.test.ts |
Tests language mapping and fallbacks. |
src/utils/parsers/index.ts |
Adds extension-to-language fallback. |
src/utils/parsers/BaseParser.ts |
Applies fallback to usage references. |
src/commands/usages/usages.test.ts |
Tests custom HTML pattern output. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
JamieSinn
approved these changes
Oct 14, 2026
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
dvc usagessets each reference'slanguagefromLANGUAGE_MAP, which only covers the built-in parser extensions. Files matched with a custom--match-patternfor any other extension (e.g.html) gotlanguage: undefined, whichJSON.stringifydrops, so the code usages upload fails since the API requireslanguage.LANGUAGE_MAP.[a-z0-9]{1,16}; otherwise fall back tounknown.htmlmatch pattern with--format json.