Skip to content

fix(config): emit startup deprecation warning for legacy simulator/slurm config keys #38

Open

Description

@SckyzO

fix(config): emit startup deprecation warning for legacy simulator / slurm top-level config keys and document removal timeline

Symptom

Two top-level AppConfig fields are explicitly marked as deprecated in their Pydantic descriptions, but the deprecation is purely cosmetic — there is no runtime warning, no documentation of when they will be removed, and no migration path advertised to the operator.

# src/rackscope/model/config.py:325-330
class AppConfig(BaseModel):
    ...
    simulator: Optional[SimulatorConfig] = Field(
        default=None, description="DEPRECATED: Use plugins.simulator instead"
    )
    slurm: Optional[SlurmConfig] = Field(
        default=None, description="DEPRECATED: Use plugins.slurm instead"
    )

These fields were deprecated as part of the Phase 6 plugin refactor. The loader still consumes them silently. An operator who upgraded from an older release months ago has no idea their app.yaml is still using the legacy shape — and no signal will fire until the fields are eventually removed, at which point their deployment breaks without warning.

This is a textbook case of the two-phase deprecation strategy that PROFILE_DEV.md explicitly prescribes:

Phase 1 — Introduire le nouveau mécanisme en parallèle de l'ancien, avec l'ancien comme fallback. Aucun comportement ne change pour les utilisateurs existants.
Phase 2 — Déprécier l'ancien mécanisme sur une ou deux releases, puis le supprimer.

Today, the project is stuck mid-Phase-2: the new mechanism (plugins.simulator, plugins.slurm) ships, the old mechanism still works, but the deprecation window is not actually communicated.

Technical Analysis

Three deficiencies:

  1. No runtime warning at startup — apply_config() reads app_config.simulator and app_config.slurm without checking whether they are populated, and without comparing against the new app_config.plugins shape. Operators using the legacy shape get zero feedback.

  2. No documentation of the removal timeline — CLAUDE.md and the docs mention plugins but do not state when the legacy fields will disappear. Without a target version, the operator cannot plan migration.

  3. No tooling for the operator — there is no make check-config or rackscope config doctor command that would tell them "your app.yaml uses deprecated fields, here is how to migrate".

Proposed Fix

1. Add a startup deprecation warning in apply_config()

# src/rackscope/api/app.py — inside apply_config() or _do_apply_config()
if app_config.simulator is not None:
    logger.warning(
        "Config field 'simulator' is deprecated since v0.X and will be removed in v1.2.0. "
        "Migrate to 'plugins.simulator': see https://github.com/SckyzO/rackscope/blob/main/"
        "MIGRATION.md#legacy-simulator-config (or rackscope_documentation/docs/admin-guide/migration.md)."
    )

if app_config.slurm is not None:
    logger.warning(
        "Config field 'slurm' is deprecated since v0.X and will be removed in v1.2.0. "
        "Migrate to 'plugins.slurm': see the migration guide for details."
    )

Concrete decisions:

  • Target version for removal: v1.2.0. Confirm at implementation time based on the actual release roadmap. The exact version is less important than picking one and committing to it in writing.
  • Source version for deprecation: replace v0.X with the actual version where the new plugins.<name> shape shipped. Check CHANGELOG.md or git log to find it.
  • Log level: WARNING is the right level. Not ERROR (the deployment still works), not INFO (the operator would miss it in normal logs).
  • One-shot, not per-request: emit once at startup (apply_config runs at startup and on config reload — both are fine), never on every API call.

2. Write a migration guide

Create rackscope_documentation/docs/admin-guide/migration.md with a section "Legacy plugin config fields → plugins block" containing:

  • Side-by-side YAML examples (before / after)
  • The exact field-by-field mapping (some legacy fields may have been renamed; verify against the current code)
  • A note that both shapes work simultaneously during the deprecation window, but the legacy shape takes precedence if both are set (or the opposite — verify in the loader code and document the truth)
  • The removal timeline: "Legacy simulator and slurm top-level fields are deprecated since vX.Y.Z and will be removed in v1.2.0. After removal, only plugins.simulator and plugins.slurm will be recognised."

3. Optional: make check-config helper

A new Make target that runs a Pydantic validation pass on config/app.yaml and prints any deprecation warnings without booting the backend:

check-config:
	docker run --rm -v $(PWD)/config:/app/config rackscope-backend python -m rackscope.tools.check_config

Implementation: a small src/rackscope/tools/check_config.py that loads the config, runs the same deprecation checks as apply_config, prints a structured report, exits non-zero if deprecations are present (configurable).

This is optional and additive. If it complicates the PR, defer to a follow-up issue.

4. Plan the actual removal as a separate issue (Phase 2 deletion)

Once this deprecation PR has shipped on at least one release and operators have had time to react, the actual removal is a separate one-line PR:

 class AppConfig(BaseModel):
     ...
-    simulator: Optional[SimulatorConfig] = Field(default=None, description="DEPRECATED: ...")
-    slurm: Optional[SlurmConfig] = Field(default=None, description="DEPRECATED: ...")

Plus the matching cleanup in apply_config and loader.py that read those fields. File as a separate issue tagged for v1.2.0.

Test Checklist

  • tests/unit/test_legacy_config_deprecation.py: AppConfig with simulator=SimulatorConfig(...) → loading via apply_config logs a WARNING containing the word "deprecated" and the target version
  • Same for slurm field
  • AppConfig without legacy fields → no deprecation warning emitted (no regression for users already on the new shape)
  • Both fields populated simultaneously → both warnings emitted independently
  • Existing functional tests on apply_config pass unchanged (no behaviour change in what the loader actually does)
  • Migration guide page renders cleanly via markdownlint
  • (If check-config helper shipped) make check-config on a config with legacy fields exits non-zero with the warning printed to stderr

Impact and Severity

  • Audience affected: every operator with an app.yaml that still uses simulator: or slurm: at the top level. Probably a non-trivial fraction of installations that migrated from pre-Phase-6 releases without rewriting their config.
  • Severity: medium. Not breaking anything today, but the deferred removal will break those deployments unless this warning fires now.
  • Priority: Sprint 3 of the audit roadmap. Should ship at least one release before the actual removal — making this PR a prerequisite for v1.2.0's cleanup.

Breaking Changes

None. Pure communication change:

  • Logs gain a startup WARNING for users on the legacy shape.
  • No behaviour change for any user.
  • The migration guide is additive documentation.

Release notes:

If your app.yaml still uses the top-level simulator: or slurm: blocks, you will now see a startup warning. Migrate to the new plugins: block — see the admin guide migration page. The legacy fields will be removed in v1.2.0.

Related

  • Audit ref: MAIN-03 in AUDIT_ARCHITECTURAL.md
  • Phase 2 (actual removal) tracked as a follow-up issue for v1.2.0 — to be opened when this one ships
  • Aligns with the project's two-phase refactor strategy explicitly documented in PROFILE_DEV.md

Out of Scope

  • Other potentially-deprecated fields not flagged in the audit — out of scope for this PR; if more deprecations exist, file separate issues
  • Auto-migration of app.yaml (rewriting the file in place) — too risky, deliberately not in scope
  • A general "config doctor" framework — the check-config helper proposed here is single-purpose. A broader linter for config is a possible v1.2 feature.

Activity

  1. added
    enhancement
    on May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions