Skip to content

fix(config): drop meaningless DefaultSettings UpdatedAt timestamps #1051

Description

@cristim

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/xsTrivial / one-linerimpact/fewLimited audiencepr-createdA PR has been opened for this issue (dedup guard for the auto-PR loop)pr-mergedThe PR for this issue has been mergedpriority/p2Backlog-worthyseverity/mediumModerate harmtriagedItem has been triagedtype/bugDefecturgency/this-sprintWithin the current sprint

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions