policy#

apply_channel_renames(view: Mapping[str, Any], ctx: AdjustmentContext) Dict[str, Any][source]#

Rename section channels

Parameters:
  • view (ConfigView) – Current config view

  • sm (SampleManagerProtocol) – Sample manager with renamed_channels mapping

Returns

ConfigPatch

Patch with renamed channels applied

ensure_required_static_blocks(view: Mapping[str, Any], ctx: AdjustmentContext) Dict[str, Any][source]#

Missing-only fill of required static blocks from defaults.

Warning

Must not touch instance containers declared by InstanceContainerSpec, because those are owned by reconcile/materialize adjusters and may be REPLACE’d.

reconcile_generic_instance_containers(view: Mapping[str, Any], ctx: AdjustmentContext) Dict[str, Any][source]#
reconcile_instance_container(*, spec: InstanceContainerSpec, view: Mapping[str, Any], sm: SampleManagerProtocol, resolver) Dict[str, Any] | None[source]#
reconcile_stitching_channels(view: Mapping[str, Any], ctx: AdjustmentContext) Dict[str, Any][source]#

Single-writer for stitching.channels.

Responsibilities (in one place):
  • prune to sm.stitchable_channels

  • ensure at least one layout channel (root)

  • repair derived layout_channel references (fallback to root layout)

  • materialize missing channels using defaults stitching.templates.{layout_template,derived_template}

  • apply role templates (layout vs derived) while preserving user overrides

  • strip opposite-role keys and template-leak keys

Emits:

{‘stitching’: {‘channels’: REPLACE(updated)}} when changed, else {}.

reconcile_stitching_channels_step(*, stitching_section: dict[str, Any], sm: SampleManagerProtocol) tuple[dict[str, Any], bool][source]#
sanitize_runtime_template_roots(view, ctx: AdjustmentContext) dict[source]#

A1 sanitizer: delete template reservoirs located at canonical defaults_templates_path derived from InstanceContainerSpec.

Scope:
  • only affects sections that exist in the current view

  • runner will additionally scope by active_sections based on owned_keys sections

scan_config_smells(*, view: Dict[str, Any], sm: SampleManagerProtocol, instance_specs_reg: ContainerSpecRegistry, policy: SmellScanPolicy = SmellScanPolicy(strong_template_smells=True, light_channelish_smells=True, reserved_namespace_keys=('performance',), templateish_exact=('templates', 'channel', 'layout_template', 'derived_template'), templateish_suffix='_template')) List[str][source]#

Returns a list of warning strings (does not emit warnings by itself). Callers may choose to warnings.warn(…) or log.

Focus:
  • template-ish keys outside canonical templates roots (strong)

  • channel-ish keys under reserved namespaces like performance (light)

warn_config_smells(*, view: Dict[str, Any], sm: SampleManagerProtocol, instance_specs_reg: ContainerSpecRegistry, policy: SmellScanPolicy = SmellScanPolicy(strong_template_smells=True, light_channelish_smells=True, reserved_namespace_keys=('performance',), templateish_exact=('templates', 'channel', 'layout_template', 'derived_template'), templateish_suffix='_template')) None[source]#