Repository navigation
Description
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:
-
No runtime warning at startup —
apply_config()readsapp_config.simulatorandapp_config.slurmwithout checking whether they are populated, and without comparing against the newapp_config.pluginsshape. Operators using the legacy shape get zero feedback. -
No documentation of the removal timeline —
CLAUDE.mdand the docs mention plugins but do not state when the legacy fields will disappear. Without a target version, the operator cannot plan migration. -
No tooling for the operator — there is no
make check-configorrackscope config doctorcommand that would tell them "yourapp.yamluses 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.Xwith the actual version where the newplugins.<name>shape shipped. CheckCHANGELOG.mdorgit logto find it. - Log level:
WARNINGis the right level. NotERROR(the deployment still works), notINFO(the operator would miss it in normal logs). - One-shot, not per-request: emit once at startup (
apply_configruns 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
simulatorandslurmtop-level fields are deprecated since vX.Y.Z and will be removed in v1.2.0. After removal, onlyplugins.simulatorandplugins.slurmwill 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_configImplementation: 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:AppConfigwithsimulator=SimulatorConfig(...)→ loading viaapply_configlogs a WARNING containing the word "deprecated" and the target version - Same for
slurmfield -
AppConfigwithout 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_configpass unchanged (no behaviour change in what the loader actually does) - Migration guide page renders cleanly via markdownlint
- (If
check-confighelper shipped)make check-configon a config with legacy fields exits non-zero with the warning printed to stderr
Impact and Severity
- Audience affected: every operator with an
app.yamlthat still usessimulator:orslurm: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.yamlstill uses the top-levelsimulator:orslurm:blocks, you will now see a startup warning. Migrate to the newplugins: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-confighelper proposed here is single-purpose. A broader linter for config is a possible v1.2 feature.
Activity