Listing and seeding repeat per-file work (binary sniff, YAML parse, stat)
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 55/100
- Tipo de issue
- Refatoração
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- go, yaml
- Domínio
- cli, performance
Direção de pesquisa
Read internal/walk/walk.go around ListWith and looksBinary, internal/seed/k8s.go around k8sLeads, and internal/seed/external.go around ignoreFiles. Start by running the existing walk and seed tests, then address one checklist item at a time; done means all three acceptance criteria hold and those tests pass unchanged.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Summary
Three small, independent costs in the deterministic scan path that grow with the number of files and are cheap to remove.
Where
internal/walk/walk.go:308,:391(looksBinaryinside the single-threaded walk)internal/seed/k8s.go:66,:154,internal/seed/infra.go:59(k8sLeadsparses every YAML file in full)internal/seed/external.go:400-435(ignoreFilesstats once per listed file)
Details
- Binary sniff is serial.
ListWithopens, reads up to 8000 bytes and closes every regular file inside theWalkDircallback, on one goroutine, also when the map comes from the cache. Every listed file is opened again by the stage that reads it. Fix: collect candidates in the callback and sniff on a bounded worker pool (results stored by index so order is kept), aseachFiledoes for the seeders. - Kubernetes check parses first, filters second.
k8sLeadsbuilds a full YAML node tree for every non-workflow YAML file up to 1 MiB, and only then drops documents with noapiVersionor a non-workloadkind. Fix: return early when the text contains neitherapiVersionnorkind(accept the substring test only when the text holds no backslash, if escaped keys matter). - Ignore-file lookup stats per file. After semgrep or gitleaks returns,
ignoreFilescallsos.Stat(<dir>/<ignore name>)for every listed file; theseenmap only removes duplicates from the output. Fix: remember directories already checked.
Impact
Estimates from the code, not measured. At 100,000 listed files the serial sniff is about a second on Linux and an estimated 5 to 60 seconds on Windows under real-time antivirus; a repository with about 60 MB of non-Kubernetes YAML spends several CPU seconds per scan in the parser; with both scanners installed the ignore lookup makes 200,000 stats where a tenth would do.
Suggested fix
See the checklist above. Each item is independent and can land on its own.
Acceptance criteria
- Binary sniffing runs on a worker pool and listing order is unchanged
-
k8sLeadsskips files that cannot hold a workload without parsing them -
ignoreFilesstats each directory once - Existing walk and seed tests pass unchanged
Related: #18, #90
Getting started
- Relevant files: internal/seed/external.go, internal/seed/k8s.go, internal/walk/walk.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: S. audit-key: performance|internal/walk/walk.go|looksBinary
- Linguagem predominante
- Go
- Estrelas
- 0
- Forks
- 1
- Merge médio
- 8h 14min
- PRs com merge (30d)
- 3
Preparar o ambiente
Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.
- Inclui um Dockerfile ou arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
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 TMHSDigital/Spackle
-
ci good first issue severity: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
TMHSDigital/Spackle#206 ·
Mantenedores costumam responder em até 1 dia
-
ci severity: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
TMHSDigital/Spackle#205 ·
Mantenedores costumam responder em até 1 dia
-
bug good first issue severity: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
TMHSDigital/Spackle#199 ·
Mantenedores costumam responder em até 1 dia
-
bug good first issue severity: low
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 87/100
TMHSDigital/Spackle#195 ·
Mantenedores costumam responder em até 1 dia
-
documentation good first issue severity: medium
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
TMHSDigital/Spackle#188 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de TMHSDigital/Spackle
Issues semelhantes
-
bug effort:s impact:med raised-by:worker risk:low to:worker
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
medici-finance/assay#8120 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
factory:subtask
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 72/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 77/100
agent-substrate/substrate#4308 ·
Mantenedores costumam responder em até 2 dias
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
celestiaorg/celestia-app#8877 ·
Mantenedores costumam responder em até 1 dia
-
sweep
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 84/100
bketelsen/truenas-mcp#112 ·
Mantenedores costumam responder em até 1 dia