Skip to content

feat: log successful uploads in combine-to-osv#5050

Merged
jess-lowe merged 5 commits intogoogle:masterfrom
jess-lowe:feat-log-successful-uploads-4993282174164612787
Mar 16, 2026
Merged

feat: log successful uploads in combine-to-osv#5050
jess-lowe merged 5 commits intogoogle:masterfrom
jess-lowe:feat-log-successful-uploads-4993282174164612787

Conversation

@jess-lowe
Copy link
Contributor

It's nice to know how many records were actually changed on the combine to osv run

google-labs-jules bot and others added 2 commits March 15, 2026 22:29
This modifies the cveworker `uploadToGCS` and `writeToDisk` routines
to return a boolean flag indicating if a file was actually modified or
written (i.e. not skipped due to matching hash).
The `Worker` method now accepts an `atomic.Uint64` pointer to accumulate
the success counts.
Finally, the main `Upload` function creates the counter, passes it to the
workers, and logs the total successful uploads upon completion.

Co-authored-by: jess-lowe <86962800+jess-lowe@users.noreply.github.com>
This modifies the cveworker `uploadToGCS` and `writeToDisk` routines
to return a boolean flag indicating if a file was actually modified or
written (i.e. not skipped due to matching hash).
The `Worker` method now accepts an `atomic.Uint64` pointer to accumulate
the success counts.
Finally, the main `Upload` function creates the counter, passes it to the
workers, and logs the total successful uploads upon completion.

Fixes golangci-lint nlreturn issue on writeToDisk.

Co-authored-by: jess-lowe <86962800+jess-lowe@users.noreply.github.com>
@jess-lowe jess-lowe requested review from a team, another-rex and tobyhawker March 15, 2026 22:57
google-labs-jules bot and others added 3 commits March 15, 2026 23:08
This modifies the cveworker `uploadToGCS` and `writeToDisk` routines
to return a boolean flag indicating if a file was actually modified or
written (i.e. not skipped due to matching hash). It also adds documentation
to these functions explaining the new boolean return value.
The `Worker` method now accepts an `atomic.Uint64` pointer to accumulate
the success counts.
Finally, the main `Upload` function creates the counter, passes it to the
workers, and logs the total successful uploads upon completion.

Fixes golangci-lint nlreturn issue on writeToDisk.

Co-authored-by: jess-lowe <86962800+jess-lowe@users.noreply.github.com>
This modifies the cveworker `uploadToGCS` and `writeToDisk` routines
to return an error rather than logging errors internally. It introduces
`ErrUploadSkipped` to gracefully communicate that an upload was
bypassed due to a matching hash.
The `Worker` method now handles these errors, logs them appropriately,
and accepts an `atomic.Uint64` pointer to accumulate successful writes
and uploads.
Finally, the main `Upload` function creates the counter, passes it to the
workers, and logs the total successful uploads upon completion.

Co-authored-by: jess-lowe <86962800+jess-lowe@users.noreply.github.com>
Comment on lines +195 to +197
if counter != nil {
counter.Add(1)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we expecting the counter to ever be nil? I think we can get rid of this check, and just panic if we forgot to pass in a counter.

@jess-lowe jess-lowe merged commit bf94e41 into google:master Mar 16, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants