Problem
internal/config/defaults.go stamps UpdatedAt: time.Now() on every entry of
the DefaultSettings slice. These are static compile-time defaults; the
timestamp reflects the binary start time, not when any setting was actually
updated. This is meaningless and misleading (finding 04-N2 from report 04).
Evidence: 28 entries in DefaultSettings each carry UpdatedAt: time.Now()
which evaluates once at package init. Any code comparing this value to a
real user-updated timestamp from the DB will get a false-positive "recently
changed" signal. The existing test TestDefaultSettings_UpdatedAtSet asserts
non-zero + recently-set, reinforcing the wrong contract.
Fix
Replace all UpdatedAt: time.Now() calls in defaults.go with
UpdatedAt: time.Time{} (zero value), which clearly signals "never written
by a user". Update TestDefaultSettings_UpdatedAtSet to assert the zero
value instead.
Blast-radius: DefaultSettings is only iterated inside defaults.go
helper functions. No runtime code reads setting.UpdatedAt from these static
entries. The DB updated_at column is populated by NOW() in SQL, not from
this Go field. The zero value is safe.
Note on 04-M1 (getEnvInt/getEnvFloat warn logging)
The companion finding 04-M1 (warn on malformed env int/float values) is
already fully addressed by PR #1040 (fix/server-transport-config):
getEnvInt, getEnvFloat, and getTaskTimeout all log WARNING: on parse
failure in that branch. This issue tracks only the residual 04-N2 item.
Files
internal/config/defaults.go (production fix)
internal/config/defaults_test.go (test update)
Findings
04-N2 (report 04, Nit severity, config defaults)
Problem
internal/config/defaults.gostampsUpdatedAt: time.Now()on every entry ofthe
DefaultSettingsslice. These are static compile-time defaults; thetimestamp reflects the binary start time, not when any setting was actually
updated. This is meaningless and misleading (finding 04-N2 from report 04).
Evidence: 28 entries in
DefaultSettingseach carryUpdatedAt: time.Now()which evaluates once at package init. Any code comparing this value to a
real user-updated timestamp from the DB will get a false-positive "recently
changed" signal. The existing test
TestDefaultSettings_UpdatedAtSetassertsnon-zero + recently-set, reinforcing the wrong contract.
Fix
Replace all
UpdatedAt: time.Now()calls indefaults.gowithUpdatedAt: time.Time{}(zero value), which clearly signals "never writtenby a user". Update
TestDefaultSettings_UpdatedAtSetto assert the zerovalue instead.
Blast-radius:
DefaultSettingsis only iterated insidedefaults.gohelper functions. No runtime code reads
setting.UpdatedAtfrom these staticentries. The DB
updated_atcolumn is populated byNOW()in SQL, not fromthis Go field. The zero value is safe.
Note on 04-M1 (getEnvInt/getEnvFloat warn logging)
The companion finding 04-M1 (warn on malformed env int/float values) is
already fully addressed by PR #1040 (
fix/server-transport-config):getEnvInt,getEnvFloat, andgetTaskTimeoutall logWARNING:on parsefailure in that branch. This issue tracks only the residual 04-N2 item.
Files
internal/config/defaults.go(production fix)internal/config/defaults_test.go(test update)Findings
04-N2 (report 04, Nit severity, config defaults)