Repository navigation
Conversation
…orker # Conflicts: # go/cmd/osv-linter-worker/main.go # go/cmd/osv-linter-worker/main_test.go
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6509 +/- ##
==========================================
+ Coverage 58.61% 58.94% +0.32%
==========================================
Files 228 228
Lines 24740 24773 +33
==========================================
+ Hits 14502 14602 +100
+ Misses 10235 10168 -67
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…and simplify safeJoin
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Improves runtime, peak memory, disk usage, and GCS write efficiency in
osv-linter-workerwithout changing external behavior or output formats.Details
osv-linterJSON into typed structs: Replacescmd.Output()+map[string][]map[string]anywithcmd.StdoutPipe()+json.NewDecoderintomap[string][]linterFinding(includingomitemptySuppressed/SuppressedReasonfields to keep suppressedresult.jsonoutput byte-for-byte identical), draining stdout beforecmd.Wait()and logging stderr on invalid/empty output.unzip& archive cleanup: HardenssafeJoinwithfilepath.IsLocal(rejecting empty, absolute, and..traversal paths), deduplicates parent directories once before extracting with a boundederrgroupworker pool, and removes the temporary GCS-downloadedall.zipafter extraction (preserving-local-data).storage.Client: Passesrun()'s existingstorageClientintoprepareData()instead of creating a second client.--parallelwith CPU quota: Adds a-parallelflag defaulting toruntime.GOMAXPROCS(0)(cgroup-aware, clamped to>= 1) instead of hardcoded--parallel 10.result.jsonlazily inside upload workers and compares Castagnoli CRC32C againstattrs.CRC32Creturned byImportFindingsStore.ListResultSources(map[string]uint32), skipping redundant GCS writes (which also preserves GCS generation/updated timestamps for the website cache).Testing
go/cmd/osv-linter-worker/main_test.gocovering parallel nestedunzip+ path-traversal rejection and CRC32C skip / changed upload / stale delete.go/:gofmt -s -l ./cmd/osv-linter-worker ./internal/models ./internal/database/datastore(clean)go vet ./cmd/osv-linter-worker/... ./internal/models/... ./internal/database/datastore/...(clean)go build ./...(clean)go test -count=1 -race -shuffle=on ./cmd/osv-linter-worker/... ./internal/gcs/... ./internal/website/...(all pass)go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 run ./cmd/osv-linter-worker/... ./internal/models/... ./internal/database/datastore/...(0 issues)(This PR was authored with AI assistance.)