Skip to content

fix(config): compare env-backed config regardless of JSONB key order - #575

Merged
Bccorb merged 1 commit into
mainfrom
fix/system-config-key-order
Nov 6, 2026
Merged

Bccorb merged 1 commit into
mainfrom
fix/system-config-key-order

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Problem

bootstrapSystemConfig compared the stored value and the env value with JSON.stringify. JSONB does not keep key order, so object values looked changed on every boot. In RoxTarget production lockout_policy, authenticator_policy and flow_rate_limits log "Overwriting system_config" on each of the boots in the 30 days of logs, which tells an operator an admin change may be being reverted when nothing changed. The row is also rewritten each time.

Change

Compare with isDeepStrictEqual, which ignores key order. A real difference still overwrites and warns.

Testing

New unit test with reordered keys. Config unit tests, typecheck, ESLint and Prettier pass. The root cause in production is inferred from JSONB's documented ordering and from which keys warn. It was not checked against the stored rows.

JSONB does not keep key order, so JSON.stringify called object values changed
on every boot: the row was rewritten and a warning said an admin change was
being reverted.
@Bccorb
Bccorb merged commit 5b1707a into main Nov 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant