Skip to content

fix(config): resolve boolean inheritance bug for target overrides#40

Merged
pgagnidze merged 1 commit intoOwloops:mainfrom
auriti:fix/boolean-inheritance
Apr 21, 2026
Merged

fix(config): resolve boolean inheritance bug for target overrides#40
pgagnidze merged 1 commit intoOwloops:mainfrom
auriti:fix/boolean-inheritance

Conversation

@auriti
Copy link
Copy Markdown
Contributor

@auriti auriti commented Mar 23, 2026

Problem

Bool fields in Target (SkipSSL, FollowRedirects, AcceptRedirects,
ReceiveAlert) used plain bool. The merge logic in LoadConfig was:

if !target.SkipSSL && config.Global.SkipSSL {
    target.SkipSSL = config.Global.SkipSSL
}

This makes it impossible for a target to explicitly set a field to false
when the global value is true — the zero value of bool is indistinguishable
from an intentional false.

Fix

Changed the 4 fields to *bool. A nil pointer means "not set" and inherits
from global; a non-nil pointer preserves the target's explicit value.

Added BoolVal(p *bool, fallback bool) bool helper for consumers.
Added a regression test that demonstrates the bug before the fix.

The bool fields FollowRedirects, AcceptRedirects, ReceiveAlert, and
SkipSSL could not be overridden to false at target level when the
global value was true (false == zero value == not set).

Convert to *bool with nil handling in the merge: nil inherits from
global, explicit value is preserved. Add test demonstrating the bug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@pgagnidze pgagnidze merged commit dfeb461 into Owloops:main Apr 21, 2026
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.

2 participants