Repository navigation
fix(watcher): correct swapped error messages for ErrMissingImageTag and ErrMissingImageID - #445
Conversation
…sages Signed-off-by: Rucha0901 <imt_2025071@iiitm.ac.in>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
matthyx
left a comment
There was a problem hiding this comment.
Approve: the two-line change fixes the diagnostic mismatch reported in #444. validateContainerData already returns the correct sentinel for each missing field; correcting watcher/watchhandler.go:22–23 makes its message accurate without changing validation, sentinel comparisons, or retry behavior. No blocking findings. Independent code and architecture reviews agree (architecture: CLEAR).
Reviewed head 3ba595a47e9845b090fdd98df1665218030f20ba, targeting main. GitHub reports base 6bd65ac2c08716930d00313bcab897ebdde928ab; the actual main ref is 085cb557b44208c9030674e47a8b37825dcd7b7d, whose additional change is confined to continuous scanning and leaves the watcher unchanged.
History: searched repository issues/PRs across all states for both sentinel names, “missing image”, “image tag”, “swapped”, and “watchhandler” (100 results/query; none reached that cap). #379, merged with maintainer approval, fixes #378's separate missing-WLID problem; it does not fix these messages. Its bounded-retry decision remains unaffected. #218 concerns registry tag scanning and #134 deployment image naming; neither supersedes this correction. No rejected equivalent approach was found; this keyword search cannot establish exhaustive absence. Existing PR reviews/inline comments contained no outstanding objections.
Validation: a source-level literal-message assertion fails on current main and passes at this head; git diff --check passes. Existing watcher tests assert sentinel identity, so adding literal-message assertions would be useful but nonblocking. In a credential-free Docker container (Go 1.27.1, read-only source snapshot, no host sockets), go test -count=1 -run 'TestValidateContainerData|TestHandleSBOMEvents' ./watcher passed (15.851s). This covers the direct validator and SBOM event/retry tests, not the full suite, integration tests, or a separate lint/build run.
GitHub's pull_request_created workflow is action_required, so its tests/lint have not run; DCO, CodeRabbit, GitGuardian, and the two FOSSA status contexts report success. No merge or source changes performed.
Overview
Signed Commits
In
watcher/watchhandler.go,ErrMissingImageTaghad the error message"missing image ID"andErrMissingImageIDhad"missing image tag". This PR swaps them so each sentinel error contains the correct message matching its variable name.How to Test
Run the watcher unit tests:
go test -v -run "TestValidateContainerData|TestHandleSBOMEvents" ./watcherScreenshot
Related issue:
Summary by CodeRabbit