Skip to content

Differentiate boolean defaults from explicitly set values in server config #113

@bashandbone

Description

@bashandbone

Description

Improve boolean flag handling to differentiate between default values and user-set values.

Current State

  • File: server.py:166
  • Boolean flags can all be boolean
  • Can't distinguish default False from user-set False
  • Ambiguity in configuration merging

Problem

When a boolean is False, we can't tell:

  • Is it the default value?
  • Did the user explicitly set it to False?

This matters for:

  • Configuration inheritance
  • Environment variable override detection
  • Telemetry (what did user configure vs defaults)

Possible Solutions

Option 1: Use Optional[bool]

enable_feature: bool | None = None  # None = not set, True/False = set

Option 2: Use Unset Sentinel

from typing import Literal
enable_feature: bool | Literal[Unset] = Unset

Option 3: Separate Tracking

enable_feature: bool = False
_feature_explicitly_set: bool = False

Recommendation

Use Unset sentinel (related to issue #94) for consistency with the broader configuration system.

Impact

  • Better configuration merging
  • Clearer telemetry
  • More predictable behavior

Source

  • File: server.py:166
  • Branch: 003-our-aim-to

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions