bug(web): Intermediate directory nodes in buildFileTree receive child leaf paths instead of directory paths
Mantenedores costumam responder em até 1 dia
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 88/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript
Direção de pesquisa
Comece em packages/web/src/features/git/utils.ts, em buildFileTree, depois inspecione packages/web/src/app/(app)/browse/components/fileTreePanel.tsx e o endpoint getTree. Reproduza o exemplo de caminho aninhado e verifique se os nós de diretório intermediários expõem seus próprios caminhos de diretório, incluindo a expansão correta das pastas e a saída da API.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the Bug
In packages/web/src/features/git/utils.ts, buildFileTree constructs a nested FileTreeNode hierarchy from a flat list of { type, path } objects.
When creating intermediate directory nodes (lines 68-74), the new node's path property is assigned item.path (the full path of the current leaf file being processed), instead of the path of that directory:
// packages/web/src/features/git/utils.ts:67-75
if (!next) {
next = {
name: part,
path: item.path, // <--- Bug: assigns leaf file's path to intermediate directory node
type: nodeType,
children: [],
};
current.children.push(next);
}
Impact
- Broken Folder State & Expansion in UI: In
packages/web/src/app/(app)/browse/components/fileTreePanel.tsx, folder expand/collapse state is tracked viaopenPaths.has(node.path)and route sync viapathParts.slice(0, i + 1).join('/'). Because directory nodes receive the child file's path instead of their own directory path, clicking folders or deep-linking to nested paths causes folder state tracking and auto-expansion to fail. - Public API Corruption: The
getTreeendpoint (/api/git/tree) returnsFileTreeNodewith corrupted directory paths to API consumers.
Reproduction
const flatList = [
{ type: 'blob', path: 'src/components/buttons/PrimaryButton.tsx' }
];
const tree = buildFileTree(flatList);
const srcDir = tree.children[0];
console.log(srcDir.name); // "src"
console.log(srcDir.path); // Expected "src", but Got "src/components/buttons/PrimaryButton.tsx"
Proposed Fix
Reconstruct the directory node's path using parts.slice(0, i + 1).join('/'):
if (!next) {
next = {
name: part,
path: parts.slice(0, i + 1).join('/'),
type: nodeType,
children: [],
};
current.children.push(next);
}
For intermediate directory levels (i < parts.length - 1), this evaluates to the proper directory path (e.g. "src", "src/components"), and for leaf files (i === parts.length - 1), it matches item.path.
- Linguagem predominante
- TypeScript
- Estrelas
- 3.9k
- Forks
- 374
- Merge médio
- 17h 15min
- PRs com merge (30d)
- 38
Preparar o ambiente
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de sourcebot-dev/sourcebot
-
fix(web): multiline highlight ranges are broken / omitted in LightweightCodeHighlighterTalvez já em andamento @riteshvish02 assumiu há 7 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
sourcebot-dev/sourcebot#1698 ·
Mantenedores costumam responder em até 1 dia
-
[bug] Search result hydration performs duplicate repository lookups within the same chunkTalvez já em andamento @dipeshbabu assumiu há 14 dias. Abertabug triage needed
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
sourcebot-dev/sourcebot#1681 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
Linux ctags build instructions in CONTRIBUTING.md are missing build dependenciesTalvez já em andamento @The-AarushiSingh assumiu há 20 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
sourcebot-dev/sourcebot#1633 ·
Mantenedores costumam responder em até 1 dia
-
Generic Git URL configs keep percent-encoded repo namesTalvez já em andamento @Tyagiquamar assumiu há 20 dias. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
sourcebot-dev/sourcebot#1384 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
-
MCP ask_codebase rejects explicit languageModel: getLanguageModelKey includes displayName which the MCP schema doesn't exposeTalvez já em andamento @pranav718 assumiu há 37 dias. Abertaask_sb bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
sourcebot-dev/sourcebot#1137 · 4 comentários ·
Mantenedores costumam responder em até 1 dia
Todas as issues de sourcebot-dev/sourcebot
Issues semelhantes
-
DB-plane provider_chat_options.* is accepted by config set but never merged into the loaded configAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Bump Firebase JS SDK (12.19.0 → 13.0.0)Talvez já em andamento @SelaseKay assumiu hoje. AbertaNeeds Attention type: enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
invertase/react-native-firebase#9364 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
clouflaure de fernandoAbertaenhancement
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
cloudflare/mcp#271 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
Mantenedores costumam responder em até 4 dias
-
[fullsend] E2E: rhdh-version-override — run-e2e.sh overrides RHDH_VERSION to non-existent 2.1Abertae2e-failure ready-to-code
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
redhat-developer/rhdh-plugin-export-overlays#4261 · 1 comentário ·
Mantenedores costumam responder em até 1 dia