CI: no coverage report; integration tests and scanners not separable

Aberta
#53 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
30/100
Tipo de issue
Funcionalidade
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
docker, github-actions, go
Domínio
ci-cd, devops, testing

Direção de pesquisa

Start with .github/workflows/ci.yml (the test and sandbox jobs) and Makefile, then read the TestIntegration* guards in internal/sandbox/integration_test.go and internal/engine/integration_test.go. Done means the coverage figure is published in CI, make test-short skips the container tests, and TestExternalScannersInstalled in internal/seed/external_test.go can be run against installed scanners. The scanner and CI parts need maintainer input on pinned versions and coverage floors before work starts.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

ci severity: low

Summary

CI reports no coverage, container integration tests cannot be excluded from a plain make test, and the external scanner adapters are never run against the real tools.

Where

  • .github/workflows/ci.yml:40
  • .github/workflows/ci.yml:73
  • internal/sandbox/integration_test.go:19
  • internal/engine/integration_test.go:55
  • internal/bench/run_test.go:381
  • Makefile:22
  • internal/seed/external_test.go:410
  • internal/seed/external_test.go:415
  • internal/seed/external_test.go:433
  • .github/workflows/ci.yml:41

Details

No workflow, Makefile target or make.ps1 target produces a coverage profile (a search for coverprofile, codecov and coverage in .github, Makefile, make.ps1 and action.yml finds only rm -rf ... coverage.out in clean). Coverage therefore fell to 30.0% for internal/cli and 52.8% for internal/gitx with nothing reporting it. Separately, the 13 TestIntegration* tests have no build tag and no testing.Short() guard (sandbox/integration_test.go:19-32, engine/integration_test.go:55-73); they run in every plain go test ./... on a machine with Docker, and the Linux test job runs them twice per push (once in test, once in sandbox). In this audit's run they took 9 to 19 seconds each (internal/sandbox 58 s in total), and TestRunDeterministicRealCorpus took 50 s; only that test and the scanner test honor -short (bench/run_test.go:381, seed/external_test.go:418). There is no documented fast loop: CONTRIBUTING.md:65 and AGENTS.md:16 give only make test.

TestExternalScannersInstalled runs each adapter only when its binary is on PATH and skips otherwise (external_test.go:415-417); for semgrep, osv-scanner and trivy a failed run is also turned into a skip (433-435). No workflow installs any of the five scanners, and there is no equivalent of SPACKLE_REQUIRE_RUNTIME for them, so in CI all five subtests skip on every run. In this audit's run 4 of 5 skipped (only gitleaks is installed here). The rest of external_test.go checks parsers against JSON written by hand in the test file.

Impact

Coverage gaps like the ones above appear without notice. Local make test takes several minutes on a developer machine with Docker running, which discourages running it.

The command lines Spackle builds (external.go, 837 lines) and the output shapes it parses are pinned only to hand-written samples. A scanner release that renames a flag or a JSON field makes the adapter fail or return nothing for users, and CI stays green. A missing lead source is a silent loss of recall.

Suggested fix

(1) In the Linux test job add -coverprofile=coverage.out -coverpkg=./internal/... to one matrix cell, print go tool cover -func to the job summary, and fail when the total or a named package (internal/cli, internal/gitx, internal/engine) drops below an agreed floor. (2) Make the integration tests skip under -short (add the check to integrationRuntime and to TestIntegrationRealSandboxProofAndFix, but keep SPACKLE_REQUIRE_RUNTIME=1 overriding it), add a test-short target to Makefile and make.ps1 running go test -short -shuffle=on ./..., and document it and the single-test form (go test -run TestName ./internal/pkg) in CONTRIBUTING.md. (3) Run the matrix test job with -short on Linux so the container tests run once, in the sandbox job.

Add a scheduled and manually triggered Linux job that installs pinned versions of gitleaks, hadolint, semgrep, osv-scanner and trivy and runs go test -run TestExternalScannersInstalled ./internal/seed with a new SPACKLE_REQUIRE_SCANNERS=1 that turns both skips into failures (mirroring integration_test.go:25-27). In that mode also assert a minimum result per tool on the planted tree: semgrep reports the os.system call, hadolint reports the latest tag or root user, gitleaks reports the planted token (already asserted at external_test.go:440). Save one real output file per pinned scanner version under internal/seed/testdata/ and feed it to the existing parser tests so parser regressions are caught on every PR without the tools.

Acceptance criteria

  • CI publishes a coverage figure
  • A short-mode or tag separates container tests
  • One CI job runs the adapters against installed scanners
  • make lint, make test and make build pass

Getting started

  • Relevant files: .github/workflows/ci.yml, internal/sandbox/integration_test.go, internal/engine/integration_test.go, internal/bench/run_test.go, Makefile, internal/seed/external_test.go
  • How to run tests: make test (Unix) or .\make.ps1 test (Windows PowerShell); lint with make lint
  • Related docs: CONTRIBUTING.md, AGENTS.md, docs/ARCHITECTURE.md

Filed by repo-audit/full-audit at 35948f7. Severity: low. Effort: M. audit-key: ci|.github/workflows/ci.yml|jobs.test

Linguagem predominante
Go
Estrelas
0
Forks
1
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TMHSDigital/Spackle

Todas as issues de TMHSDigital/Spackle

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.