Skip to content

fix(graph): repo map language label covers the generic tree-sitter tier - #852

Draft
hr1juldey wants to merge 1 commit into
trailhq:mainfrom
hr1juldey:fix/762-repo-map-language-label
Draft

hr1juldey wants to merge 1 commit into
trailhq:mainfrom
hr1juldey:fix/762-repo-map-language-label

Conversation

@hr1juldey

Copy link
Copy Markdown

Fixes #762.

Problem

sortedLanguages() (the language list behind repo map's header line and the per-directory languages entries) consults only languageLabelOf() — the hand-written depth-tier extension table (.ts/.js/.py/.go/…). Languages indexed by the generic tree-sitter tier are registered in graph/generic.ts and never consulted, so on a Cargo workspace with a small embedded website every .rs label came back null and the header read … · javascript for a Rust codebase.

Fix

The same fallthrough the build banner already applies (graph/build.ts):

const label = languageLabelOf(p) ?? genericLangOf(p)?.name ?? null;

Two lines in sortedLanguages; both the header totals and the per-directory rows pick it up, since they share the function. No rebuild needed — the label is computed from the graph at query time, as the report notes.

Tests

Regression in test/graph-map.test.ts: a graph with src/lib.rs + static/app.js reports ["javascript", "rust"] in totals.languages and the rendered header contains rust. Before the fix only javascript appeared. Full suite: 4549 tests, the only delta is the new test — the six failures present on clean main (49d36b7) are unchanged and pre-date this branch.

sortedLanguages consulted only the depth-tier EXTENSIONS table, so languages
indexed by the generic tier (rust, c, …) dropped out of the set: a Rust repo
with a few website .js files was labeled javascript. Fall through to
genericLangOf, the same fallback the build banner already applies.

Fixes trailhq#762
@trailhq-graft

trailhq-graft Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

🌱 graft blast radius

1 area changed → 4 areas can be affected. 4 dependent symbols, depth 2.
Tests: no test reaches Language Mapping.
Tag: @anirudhkumar-nanonets — 3 of 5 areas · @shhdwi — 5 of 5 areas · Rushabh Nagda — Hub Onboarding

flowchart TB
  A0(("Tool Invocation<br/>1 symbol"))
  A1(("CLI Interface<br/>1 symbol"))
  A2(("Workspace Federation<br/>1 symbol"))
  A3(("Hub Onboarding<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3 reached;
Loading
Can be affected Symbols Nearest hop Reached from
Tool Invocation 1 src/mcp/tools.ts:L265-L351 callSingleTool — calls, depth 2 Language Mapping
CLI Interface 1 src/cli.ts:L1-L3499 cli.ts — calls, depth 2 Language Mapping
Workspace Federation 1 src/graph/workspace.ts:L608-L627 federateMap — calls, depth 2 Language Mapping
Hub Onboarding 1 src/cloud/onboarding.ts:L396-L420 lookupOnHub — calls, depth 2 Language Mapping
Who knows this code — 4 people across 5 areas
Area Who knows it
Language Mapping · changed @shhdwi — 4 commits, last 4mo ago · @anirudhkumar-nanonets — 3 commits, last 3mo ago
Tool Invocation · affected @shhdwi — 17 commits, last 27d ago · @anirudhkumar-nanonets — 8 commits, last 28d ago
CLI Interface · affected @anirudhkumar-nanonets — 75 commits, last yesterday · @shhdwi — 51 commits, last 22d ago
Workspace Federation · affected @shhdwi — 7 commits, last 1mo ago · Buseong Kim — 2 commits, last 3mo ago
Hub Onboarding · affected @shhdwi — 5 commits, last 26d ago · Rushabh Nagda — 4 commits, last yesterday

Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 4 dependent symbols, grouped by area

Tool Invocation — 1 symbol in 1 file

  • src/mcp/tools.ts:L265-L351 — callSingleTool (calls, depth 2)

CLI Interface — 1 symbol in 1 file

  • src/cli.ts:L1-L3499 — cli.ts (calls, depth 2)
    1213: grouped(program.command("map"), GROUP.find)

Workspace Federation — 1 symbol in 1 file

  • src/graph/workspace.ts:L608-L627 — federateMap (calls, depth 2)

Hub Onboarding — 1 symbol in 1 file

  • src/cloud/onboarding.ts:L396-L420 — lookupOnHub (calls, depth 2)
Test signal per changed area — 1 ✗

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • ✗ Language Mapping — 0 of 1 reached · no test file reaches it
    • not reached: sortedLanguages
5 test suites also reference this code

5 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/graph-languages.test.ts
  • test/graph-posix-paths.test.ts
  • test/graph-resolve-typed.test.ts
  • test/regression-single-repo.test.ts
  • test/trail-connect.test.ts

graft blast · origin/main...HEAD · depth 2 · 2 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Nov 18, 2026
@hr1juldey
hr1juldey marked this pull request as draft November 18, 2026 15:58

This branch has not been deployed

No deployments
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.

repo map language label drops generic-tier languages: a Rust repo with a few .js files is labeled "javascript"

1 participant