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

Ouverte
#53 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
30/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
docker, github-actions, go
Domaine
ci-cd, devops, testing

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
Go
Étoiles
0
Forks
1
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de TMHSDigital/Spackle

Toutes les issues de TMHSDigital/Spackle

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.