Repository navigation
test(lsp): cover SCA engine lookups, retry classification, diagnostic counts and mapping fallbacks - #333
Conversation
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
0x73746F66
left a comment
There was a problem hiding this comment.
Reuse review: test-only change in internal/lsp. The new tests build on the package's existing fixture (seedEngine) and the real types (scan.DepGraph, vdb.CliAPIError, protocol severities) rather than introducing local doubles or a second helper, and they exercise the production functions directly (isTransientSCAErr, backoffFor, buildPurls, CountBySeverity/DescribeCounts, severityToLSP, kindToTool). Nothing duplicates an existing Vulnetix test utility or shared package. No changes needed.
654af40 to
4f0bd23
Compare
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
db0de63 to
0f5b2de
Compare
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
b37e98d to
484cd1d
Compare
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
4ed5b63 to
d9337d9
Compare
0x73746F66
left a comment
There was a problem hiding this comment.
Reuse review: no reinvented Vulnetix patterns found. The change stays inside the package it covers, uses stdlib/testify helpers already used by the repo's tests, and adds no new client, auth, config-schema or shared-package duplicate (checked internal/testutils and sibling repos). Rebased onto current main locally: go vet and go test pass for every touched package. The earlier red checks (CodeQL Analyze, Install a release with verified provenance, Lockfile) were GitHub API rate-limit failures, not code failures; this will be re-run on a rebased head before merge.
… and purl helpers isTransientSCAErr over 429/5xx/4xx, not-found, deadline, cancellation, transport and decode errors; backoffFor's floor and cap; CountBySeverity and DescribeCounts; flattenPackages path order; buildPurls index alignment and de-duplication; countVulnerable. Refs #295
…llbacks PackagesFor, VerdictFor, IsManifest, ManifestPaths, IntroducedBy (direct parents in the same directory only, none for a direct or transitive-only parent, none without a graph) and AnchorFor over the seeded engine; the SourceForKind, severityToLSP and kindToTool fallbacks. Closes #295
d9337d9 to
4a651f8
Compare
Vulnetix config planManager
0 to create, 1 to update, 0 to delete, 0 unchanged |
Closes #295
What
Stdlib table tests in two files.
internal/lsp/sca_engine_queries_test.go(overseedEnginefromsca_test.go)PackagesForknown/unknown path;VerdictForfor a vulnerable and a clean package, an unknown version and an empty coordinate;IsManifest;ManifestPathssorted;IntroducedByreturns the sorted direct parents in the same directory group, nothing for a package whose only parent is transitive, a direct package, a group without a graph or an unknown directory;AnchorForresolves throughanchor.Find(1-based line) and refuses a path never parsed.SourceForKinddefault source for an unmapped kind;severityToLSPcase/space handling and theLowAsHintbranch for low, info, empty and unknown severities;kindToToolfor OCI, empty, mapped and custom kinds.internal/lsp/sca_helpers_test.go2.
flattenPackagespath order;buildPurlsindex alignment, de-duplication, empty purls never requested;countVulnerable.3.
isTransientSCAErr: nil; 429/500/wrapped 503 retryable; 400/403 terminal;NotFoundErrorterminal; wrapped deadline retryable; wrapped cancel terminal; transport error retryable; decode error terminal.backoffForfloor and cap.4.
CountBySeverityandDescribeCounts.Test-only.
Verified
go test ./internal/lsp/(new tests) andgo vet ./internal/lsp/pass;gofmtclean.