Save a setting switched off when nothing was saved before #88

Merged
Patrick merged 1 commit from patrick/settings-save-falsy into main 2026-11-19 22:45:24 -05:00 AGit
Owner

Bug from #84, found on Dallas: turning Tracing off in Platform Settings stored nothing, so Horizon kept restarting with the chart's TRACING_ENABLED=true and crash-looping (the leak #86 fixes).

Cause: a changed value was written only when it differed from the saved one, compared with PHP's loose !=. With no saved row, false != null is false, so switching off any setting the deployment turns on was silently dropped. The page applied it for that one request, so it looked saved.

Fix

  • With no saved row, a value that differs from the deployment's is always written.
  • sameSettingValue() replaces the loose comparisons: unset matches only unset or false (a toggle can't show "unset", so off and unset are the same), and 0 is a real value rather than "nothing".

Checked: new test reproduces Dallas (tracing on by deployment, switched off, survives a worker reboot) and fails on the old code; plus a toggle switched on where the deployment sets nothing. Full suite: 518 passed, 8 skipped. Pint clean.

🤖 Generated with Claude Code

**Bug from #84, found on Dallas:** turning **Tracing off** in Platform Settings stored nothing, so Horizon kept restarting with the chart's `TRACING_ENABLED=true` and crash-looping (the leak #86 fixes). **Cause:** a changed value was written only when it differed from the saved one, compared with PHP's loose `!=`. With no saved row, `false != null` is **false**, so switching off any setting the deployment turns on was silently dropped. The page applied it for that one request, so it looked saved. **Fix** - With no saved row, a value that differs from the deployment's is **always written**. - `sameSettingValue()` replaces the loose comparisons: unset matches only unset or `false` (a toggle can't show "unset", so off and unset are the same), and `0` is a real value rather than "nothing". **Checked:** new test reproduces Dallas (tracing on by deployment, switched off, survives a worker reboot) and fails on the old code; plus a toggle switched on where the deployment sets nothing. Full suite: 518 passed, 8 skipped. Pint clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Save a setting switched off when nothing was saved before
All checks were successful
Application Tests / frontend (pull_request) Successful in 51s
Application Tests / security-audit (pull_request) Successful in 2m38s
Application Tests / php (pull_request) Successful in 3m23s
Application Tests / tag (pull_request) Has been skipped
Application Tests / publish-images (., Dockerfile, laravel) (pull_request) Has been skipped
Application Tests / publish-images (agent-worker, Dockerfile, agent-worker) (pull_request) Has been skipped
Application Tests / publish-images (docker/asterisk, Dockerfile, asterisk) (pull_request) Has been skipped
Application Tests / publish-images (docker/asterisk-config-sync, Dockerfile, asterisk-config-sync) (pull_request) Has been skipped
Application Tests / publish-images (docker/haraka, Dockerfile, haraka) (pull_request) Has been skipped
Application Tests / publish-images (docker/whisper-local, Dockerfile, whisper-local) (pull_request) Has been skipped
Application Tests / scan-images (agent-worker) (pull_request) Has been skipped
Application Tests / scan-images (asterisk) (pull_request) Has been skipped
Application Tests / scan-images (asterisk-config-sync) (pull_request) Has been skipped
Application Tests / scan-images (haraka) (pull_request) Has been skipped
Application Tests / scan-images (laravel) (pull_request) Has been skipped
Application Tests / scan-images (whisper-local) (pull_request) Has been skipped
Application Tests / publish-helm (pull_request) Has been skipped
Application Tests / publish-archives (pull_request) Has been skipped
4ceb36e682
#84 wrote a changed value only when it differed from the saved one,
compared with PHP's loose !=. With no saved row, false != null is
false, so switching off a setting the deployment turns on (Dallas:
Tracing) stored nothing. The page applied it for that request only,
and every restarted worker came back with the chart's value.

- With no saved row, a value that differs from the deployment's is
  always written.
- sameSettingValue() replaces the loose comparisons: unset matches
  only unset or false (a toggle can't show unset), so 0 and "" are
  real values rather than "nothing".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
calltheory/orbital!88
No description provided.