Skip to content

[v1.0] Stop plain consumer config keys from changing framework lifecycle #264

Description

@codeforester

Goal

Keep consumer-owned plain mappings from silently enabling framework lifecycle behavior.

Background

ConfigLoader may return either a plain mapping or a validated ConfigSnapshot. The documented separation says lifecycle keys belong in ConfigSnapshot.framework while consumer keys remain opaque. However, the plain-mapping path still reads environment, log_level, and keep_temp directly:

if isinstance(loaded_config, ConfigSnapshot):
config = loaded_config.config
framework_config = loaded_config.framework
config_provenance = loaded_config.provenance
else:
config = loaded_config
framework_config = None
config_provenance = {}
environment = (
standard.get("environment")
or (framework_config.environment if framework_config is not None else None)
or config.get("environment")
or "dev"
)
log_level = (
framework_config.log_level if framework_config is not None else str(config.get("log_level", "")).lower()
)
debug = bool(standard.get("debug") or log_level == "debug")
quiet = bool(standard.get("quiet"))
keep_temp = bool(
standard.get("keep_temp")
or (framework_config.keep_temp if framework_config is not None else None)
or config.get("keep_temp")
)
.

That means an application field such as {"keep_temp": "false"} is truthy and preserves diagnostic temp data, while {"log_level": "debug"} enables traceback diagnostics. Those values bypass FrameworkConfig type validation and make generic profiles convention-bearing.

Scope

  • Interpret framework lifecycle config only through the validated framework boundary.
  • Provide a documented compatibility path if existing consumers intentionally rely on reserved keys in plain mappings.
  • Make malformed lifecycle values fail safely and actionably.

Acceptance Criteria

  • Plain mapping keys named environment, log_level, or keep_temp remain consumer data and do not mutate lifecycle state.
  • A ConfigSnapshot continues to control validated lifecycle settings.
  • Strings such as "false" cannot enable temp retention.
  • Debug tracebacks cannot be enabled through an unvalidated consumer field.
  • Tests cover generic, custom, batteries-included, CLI-override, and migration behavior.
  • The changelog and consumer-profile documentation describe any compatibility boundary.

Validation

Run lifecycle, metadata, configuration, security-boundary, and full-suite tests.

Non-Goals

Do not impose a schema on the rest of the consumer mapping.

Project Fields

  • Status: Backlog
  • Priority: P1
  • Area: Python
  • Initiative: v1.0 Readiness
  • Size: M

Ownership

Metadata

Metadata

Assignees

Labels

bugSomething is not workingsecuritySecurity hardening or vulnerability work

Type

No type

Projects

Status
Backlog

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions