Repository navigation
fix(handlers): bound the invalid shared values warning set (#711) - #714
Merged
Merged
Conversation
warnedInvalidSharedValues was a package-level sync.Map: every new version of an invalid shared values entry added a key for the life of the process. It is now an internal/cache TTLCache with a one-hour TTL (invalidSharedValuesWarnTTL): a reported version is forgotten after an hour, so the set stays bounded and a broken entry is reported again each hour while it stays broken. The Get and the Set are not one atomic step, so two concurrent values builds can both log the same version; that is harmless for a warning. A new test checks that a version is forgotten and logged again after the TTL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
Fixes #711.
warnedInvalidSharedValues(internal/api/handlers/shared_values_loader.go) was a package-levelsync.Map. Every new version of an invalid shared values entry added a key that stayed for the life of the process.Change: it is now an
internal/cacheTTLCachewith a one-hour TTL (invalidSharedValuesWarnTTL). A reported entry version is forgotten after an hour, so the set stays bounded.Behaviour change: a broken entry was logged once per process. It is now logged again each hour while it stays broken.
The cache check and the store are not one atomic step. Two values builds at the same moment can both log the same version, which is harmless for a warning and noted in a code comment.
Tests
TestWarnInvalidSharedValuesuses a fresh cache instead of a freshsync.Map.TestWarnInvalidSharedValues_ReportedAgainAfterTTL(50 ms TTL): a version is logged once within the TTL, forgotten after it, and logged again.Checks
-race -count=10.go test ./... -short -raceandgo vetpass.make lint: 0 errors.make gosec: 0 issues.🤖 Generated with Claude Code