Repository navigation
fix: read triage metrics from metadata paths - #6288
Conversation
|
Please read our contributing guide before opening pull requests |
|
Whoops apologies, this is assigned to you! (That's what I get for reading my notifications backwards 🙃) |
Haha, totally understandable! |
jess-lowe
left a comment
There was a problem hiding this comment.
Looks great. One small nit on the test :)
| t.Parallel() | ||
|
|
||
| const content = `{"id":"CVE-2024-1234"}` | ||
| server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
There was a problem hiding this comment.
Nit: Currently this spins up a new httptest.NewServer and storage.Client 20 times inside the inner subtest loop. We could lift the server and client creation to the top of TestTriageStore_GetFile_GCS so all subtests share a single client and mock server.
There was a problem hiding this comment.
Thanks, Jess! Updated in the latest commit, all subtests now share a single mock server and storage client.
|
/gcbrun |
|
/gcbrun |
PR title: fix: read triage metrics from metadata paths
Overview
The triage page still requests CVE conversion metrics from their old locations, so it cannot display metrics stored under
metadata/. Update the NVD and CVE5 metrics paths for both test and production buckets.Closes #6211
Details
metadata/nvd/metrics/<CVE-ID>.metrics.json.metadata/cve5/metrics/<CVE-ID>.metrics.json.No breaking changes or new dependencies.
AI assistance: OpenAI Codex (GPT-6.1 Sol, High reasoning effort) assisted with tests and verification.
Testing
Run from
go/unless noted otherwise:go test ./internal/gcs -run TestTriageStore_GetFile_GCS -count=1 -vfailed on the four metrics sources because they requested the old object paths; all six non-metrics sources passed.go test ./internal/gcs ./internal/website -count=1passed, including all 20 new storage read cases and the existing triage HTTP endpoint tests.go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.14.0 run ./internal/gcspassed with zero issues.go build -o /tmp/osv-6211-website ./cmd/websitepassed.git diff --checkpassed.Storage reads were verified using a local HTTP test server and the real GCS client. Live test/production bucket access and the full monorepo test suite were not exercised.