Skip to content

Harden the configuration system to be easier to use and harder to misuse#298

Merged
luisfabib merged 3 commits intomainfrom
harden-config-api
Mar 19, 2026
Merged

Harden the configuration system to be easier to use and harder to misuse#298
luisfabib merged 3 commits intomainfrom
harden-config-api

Conversation

@luisfabib
Copy link
Owner

Reworks the configuration API to fix a set of correctness, safety, and usability issues identified during a code review of the configuration system. The changes flatten the previously two-level config class hierarchy, rename ambiguous field names, make both config classes immutable, eliminate shared mutable state on the ContextVar default, and replace the **kwargs-based configure() / with_config() API with explicit typed keyword-only parameters.


Changed

  • Renamed several of the configuration parameters for clarity and precision:
    • Renamed disable_warnings to disable_validation_warnings
    • Renamed disable_warning_severity to disable_fhir_warnings
    • Renamed disable_errors to disable_fhir_errors
    • Renamed disabled_constraints to disabled_fhir_constraints
  • Renamed with_config() context manager to override_config() for clarity and consistency
  • Froze FhircraftConfig to raise an error upon direct attribute mutation
  • Updated configuration.md to reflect the flat FhircraftConfig API and remove ValidationConfig references

Fixed

Removed

  • Removed ValidationConfig dataclass — fields merged directly into FhircraftConfig
  • Removed internal _build_validation_config() helper — no longer needed after the API redesign
  • Removed ValidationConfig and FhircraftConfig from fhircraft.__init__ lazy-import exports

@luisfabib luisfabib added the enhancement New feature or request label Mar 19, 2026
@luisfabib luisfabib merged commit a5c5305 into main Mar 19, 2026
3 checks passed
@luisfabib luisfabib deleted the harden-config-api branch March 19, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant