Repository navigation
fix(config): compute default write path once per process - #270
Merged
Merged
Conversation
What/Why defaultWritePath embedded time.Now() at second precision and was called both by NewConfig and by test assertions, so any call pair straddling a second boundary produced different paths. This made TestNewConfig flaky in CI and meant multiple configs in one run could log to different directories. Memoize the path with sync.OnceValue so it is stable for the life of the process. Proof it works go test ./... passes; go vet ./config/... clean. Added an assertion in TestDefaultWritePath that two calls return the same path. Risk + AI role Low. Behavior change is limited to reusing one timestamped directory per process instead of one per NewConfig call. AI-generated (Claude Fable 5), human-reviewed. Review focus Whether a single shared log directory per process is the intended behavior for long-running processes that construct multiple configs. Signed-off-by: jmeridth <jmeridth@gmail.com>
eddie-knight
approved these changes
Aug 5, 2026
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.
What/Why
defaultWritePath()embeddedtime.Now()at second precision and was called both byNewConfigand by test assertions, so any pair of calls straddling a second boundary produced different paths. This madeTestNewConfigflaky in CI (example: the failed run on #269) and meant multiple configs in one process could log to different directories. The path is now memoized withsync.OnceValueso it is stable for the life of the process.Proof it works
go test ./...passes. Added an assertion inTestDefaultWritePaththat two calls return the same path, which fails against the old implementation when calls straddle a second boundary.Risk + AI role
Low. Behavior change is limited to reusing one timestamped directory per process instead of one per
NewConfigcall. AI-generated, human-reviewed.Review focus
Whether a single shared log directory per process is the intended behavior for long-running processes that construct multiple configs.