Skip to content

[0.38] plan/apply P5b: one deprecation catalog (#4019) - #4035

Merged
Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-curly-fishstick
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 3 commits into
mainfrom
danielmeppiel-curly-fishstick

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

TL;DR. src/apm_cli/core/deprecations.py is now the single catalog for every deprecation APM emits. It owns the warning template, the replacement, the deprecated-since version (or unknown) and the removal horizon (an announced version, or not scheduled). All 23 emission sites read their wording through deprecation_message(key), and the text users see is unchanged byte for byte. A new architecture guard rejects catalog text spelled anywhere else, and the CLI reference gains a deprecations table generated from the catalog.

Note

No new warnings, no removals, no stream moves, no changes to removal dates. Domain owners still decide when a warning fires, its dynamic hints, scope and repetition. Output owners still render it.

Problem (WHY)

  • Deprecation wording lived in 18 modules. One message, --target agents, was spelled out in two of them (core/target_detection.py and install/phases/targets.py).
  • No single place recorded what replaces a deprecated surface, when it was deprecated, or whether a removal version was ever announced. The house principle says deprecation, rejection and deferral are different decisions, and that APM must not infer a removal date.
  • Only the singular target: phrase had a guard. Copies of every other deprecation message could drift without anything failing.

Approach (WHAT)

Concern Owner after this PR
Wording, replacement, since, horizon core/deprecations.py (DEPRECATIONS, deprecation_message)
When it fires, dynamic hints, once-per-process / scope Unchanged domain owners (manifest_targets, target_catalog, apm_yml, executables, policy/parser, ...)
Rendering, stream, symbol Unchanged (CommandLogger, _rich_warning, click.echo, warnings.warn)
Deprecations that print no warning Inventoried in WARNING_FREE_DEPRECATIONS; no warnings added
Duplicate text elsewhere Guard registry-delegation-deprecation-catalog

Implementation (HOW)

File Change
core/deprecations.py (new) 21 Deprecation entries plus the warning-free inventory. Since-versions come from explicit CHANGELOG lines (the four 0.37 [Unreleased] deprecations are 0.37.0); everything else is unknown. Horizons are recorded only where the warning text already announces one (v0.15, v0.16, v1.0).
18 emission modules One-line swap from the inline literal to deprecation_message("<key>", **fields). The init flags now emit one click.echo of a two-line message instead of two echoes; the bytes are identical. marketplace/migration.DEPRECATION_MESSAGE keeps its public name.
scripts/architecture_linter/checks/registry_deprecation_catalog.py (new) Statically reads Deprecation(template=...), splits each template at its {field} placeholders, and flags any src/apm_cli string constant (f-string parts included) that contains a fragment of 16 characters or more. An emptied catalog fails closed.
registry_owner_guards.py Registers the rule. The existing target: phrase check now exempts the catalog instead of manifest_targets.py.
.apm/architecture/owners/core-runtime.json user-facing-output-diagnostics gains the catalog selector and the new guard.
scripts/render_deprecations_table.py + reference/index.md Generated table (docs commit).

Trade-offs

  • Fragment match instead of fuzzy match. The guard flags exact template fragments of 16+ characters. Near-copies with a changed word slip through. Fuzzy windows would also flag unrelated help text such as unpack's "will be removed in a future release", so exact match keeps the guard from crying wolf.

  • Help strings stay inline. [Deprecated] Click help text is not warning text, and the scope covers warnings only.

  • Since = 0.37.0 for vscode, target:, compilation.target and auto-integrate: they shipped in the published 0.37.0.

  • Passed horizons stay as-is. The marketplace.outputs list form announces v0.15, which has passed; the table shows it verbatim ([0.38] fix(marketplace): print collected marketplace config warnings (#4046) #4062 changes that entry). apm init --plugin/--marketplace were removed in 0.37 (feat(init)!: remove apm init --plugin and --marketplace (Fixes #4073) #4074), so their entries are gone.

  • Finding, left unchanged per scope: the marketplace.outputs list-form warning is collected into MarketplaceConfig.warnings, but no command prints it. The table labels it "Collected, not printed", and a test pins that it stays unprinted.

  • Rebase onto the 0.37 hardening (decision log). Main added core/remediation.py, the single owner of "run 'apm ...'" advice, guarded by contracts-tooling-remediation-advice. Four warnings now embed a remediation sentence (marketplace.yml, deps update, unpack, the apm update self-updater forward). Default taken: a Deprecation may name a Remediation, and message() fills a {remedy} slot from it. The catalog keeps owning deprecation wording, remediation keeps owning advice, and the printed text is byte-identical to 0.37.0; the re-pinned capture tests pass on unmodified main. The CI banner in update.py shares the sentence 'apm update' refreshes APM dependencies. with the self-updater warning, so the catalog exports it as UPDATE_REFRESHES_DEPENDENCIES instead of exempting it in the guard. The guard now reads f-string templates by their literal parts.

Benefits

  1. One file answers "what is deprecated, what replaces it, since when, and is removal scheduled" for all 21 warnings.
  2. Wording drift is caught at lint time, not by users.
  3. The CLI reference table cannot drift from the code: a unit test regenerates and compares it.
  4. The 11 warning-free deprecations are inventoried, so a later decision to warn about them starts from a list.

Issue and approved scope

Fixes #4019

Human scope-approval comment: #4019 (comment) (eligibility.cjs: record-present, re-checked before this PR).

This PR completes the issue's "Done when" list: installed-CLI text, stream and visibility tests; in-process repetition and scope tests; Python-warning tests with explicit filters; the generated table with not scheduled horizons; the static mutation test; and one CHANGELOG line.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass (targeted suites below)
  • Added tests for new functionality

Scenario evidence

Scenario Test
Each CLI-visible deprecation keeps its exact text, its stream, and prints once (installed binary, 21 cases including bin_deploy JSON, outputs list never printed) tests/integration/test_deprecation_warnings_installed_cli.py, committed before the text moved (8cfaa27)
Repetition and scope: all once per process, vscode flag once per alias across flags, bin_deploy once per validation, marketplace.yml on every load, outputs into sink tests/unit/core/test_deprecation_owner_behavior.py
Python DeprecationWarnings (ARTIFACTORY_* x3, get_server_info, AgentsTargetDeprecationWarning) with simplefilter("always") same file
Horizons match the text the warning announces; every entry is emitted somewhere tests/unit/core/test_deprecations.py
A re-spelled deprecation fails the guard MutationCase(registry-delegation-deprecation-catalog) in tests/integration/test_architecture_owner_rule_mutations.py; tests/unit/scripts/test_registry_deprecation_catalog.py
Docs table equals the catalog tests/unit/test_deprecations_docs_table.py
Commands run locally
APM_BINARY_PATH=.venv/bin/apm uv run --extra dev pytest tests/integration/test_deprecation_warnings_installed_cli.py \
  tests/unit/core/test_deprecation_owner_behavior.py tests/unit/test_config_command.py \
  tests/unit/models/test_manifest_deprecation_warning.py tests/unit/security/test_executables.py tests/unit/marketplace \
  tests/unit/core/test_target_detection.py tests/unit/test_registry_client.py tests/unit/test_artifactory_support.py \
  tests/unit/test_copilot_adapter_phase3.py tests/unit/test_install_command.py tests/integration/test_govern_core_contract.py -n 8
  -> 3054 passed, 3 skipped
uv run --extra dev pytest tests/unit/scripts/test_architecture_runner.py tests/integration/test_architecture_owner_rule_mutations.py -n 8
  -> 935 passed
uv run --extra dev pytest tests/unit/core/test_deprecations.py tests/unit/scripts/test_registry_deprecation_catalog.py tests/unit/test_deprecations_docs_table.py
  -> 77 passed
bash scripts/lint-architecture-boundaries.sh            -> exit 0 (39.5s, same as main)
ruff check / ruff format --check (src tests linter)     -> clean
pylint R0801 (src/apm_cli + linter)                     -> 10.00/10
bash scripts/lint-auth-signals.sh                       -> clean
file length: registry_owner_guards.py 2019 lines (< 2100)

How to test

  1. uv run python scripts/render_deprecations_table.py exits 0. Then edit any template= in core/deprecations.py and the docs test fails.
  2. Paste any catalog sentence into a src/apm_cli module and run bash scripts/lint-architecture-boundaries.sh. It reports registry_delegation.deprecation_catalog.
  3. apm compile -t vscode --dry-run still prints the same [!] --target: replace ... line on stderr.

Docs re-home after #3996

Content Location in this PR After #3996
## Deprecations section + generated table docs/src/content/docs/reference/index.md (CLI reference "Overview") #3996 does not touch this page. If the CLI reference overview moves, move the section and update DOC_PAGE in scripts/render_deprecations_table.py (one constant).

Changelog

  • One line under ### Added in [Unreleased] (closes #4019).
  • N/A

Spec conformance (OpenAPM v0.1)

N/A: no normative behavior changes. Warning text, streams and triggers are unchanged.

Co-authored-by: Copilot [email protected]

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
load_marketplace_config now delivers every MarketplaceConfig.warnings
entry (the list/string outputs deprecation and the outputs.<format>.path
conflict) through its warn_callback, after the legacy marketplace.yml
deprecation. apm pack, marketplace check and outdated already render that
callback. Pack's release-gate reload passes a discard callback so no load
warning prints twice. The marketplace-outputs-list catalog entry is now a
printed warning with no scheduled removal, so the text drops the stale
v0.15 date. Flips #4035's stays-unprinted pin into installed-CLI tests.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
load_marketplace_config now delivers every MarketplaceConfig.warnings
entry (the list/string outputs deprecation and the outputs.<format>.path
conflict) through its warn_callback, after the legacy marketplace.yml
deprecation. apm pack, marketplace check and outdated already render that
callback. Pack's release-gate reload passes a discard callback so no load
warning prints twice. The marketplace-outputs-list catalog entry is now a
printed warning with no scheduled removal, so the text drops the stale
v0.15 date. Flips #4035's stays-unprinted pin into installed-CLI tests.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) force-pushed the danielmeppiel-curly-fishstick branch 2 times, most recently from 2deb875 to 1a0595e Compare November 21, 2026 08:46
…on (#4019)

Captured before the text moves into the deprecation catalog: installed-CLI
scenarios pin each CLI-visible warning's exact wording, stream and single
print; in-process tests pin owner repetition/scope and the Python
DeprecationWarning texts with filtering enabled explicitly.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
core/deprecations.py, under the diagnostics owner, holds each deprecation's
warning template, replacement, deprecated-since version (or unknown) and
removal horizon (an announced version, or not scheduled). Every emitted
deprecation now reads its words through deprecation_message(); domain
owners keep triggering, dynamic hints, scope and repetition, and output
owners keep rendering. Text is byte-identical (pinned by the previous
commit's tests). Warning-free deprecations are inventoried separately.

Guard registry-delegation-deprecation-catalog rejects catalog template text
spelled anywhere else in src/apm_cli; the existing target: phrase check now
exempts the catalog instead of manifest_targets.py.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
…4019)

scripts/render_deprecations_table.py renders the table from the catalog;
a unit test fails when the page drifts. Unscheduled horizons read
'not scheduled'; nothing is inferred.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) marked this pull request as ready for review November 21, 2026 09:45
Copilot AI balanced review requested due to automatic review settings November 21, 2026 09:45
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 90ec874 into main Nov 21, 2026
46 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-curly-fishstick branch November 21, 2026 09:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The guard misses catalog constants referenced by f-strings, allowing the old CI banner text to pass, while whitespace-normalized tests fail to enforce exact warning preservation.

2 open issues
What changed in this PR

Implements #4019 by centralizing APM’s deprecation wording and metadata under the diagnostics owner, while keeping warning triggers and rendering with their existing owners.

Changes:

  • Adds a catalog for 21 deprecations and an inventory of warning-free deprecated surfaces.
  • Routes existing warnings through the catalog, with an architecture guard and preservation tests.
  • Generates CLI reference tables from the catalog and records the addition in the changelog.
File Description
tests/​unit/​test_deprecations_docs_table.py Checks generated documentation parity.
tests/​unit/​scripts/​test_registry_deprecation_catalog.py Tests duplicate-wording detection.
tests/​unit/​scripts/​test_architecture_runner.py Registers the expected guard rule.
tests/​unit/​core/​test_deprecations.py Checks catalog metadata and consumers.
tests/​unit/​core/​test_deprecation_owner_behavior.py Tests warning triggers and repetition.
tests/​integration/​test_deprecation_warnings_installed_cli.py Captures warning text, streams and visibility.
tests/​integration/​test_architecture_owner_rule_mutations.py Adds a duplicate-warning mutation case.
src/​apm_cli/​security/​executables.py Sources the approval-alias warning from the catalog.
src/​apm_cli/​registry/​client.py Sources the deprecated API warning from the catalog.
src/​apm_cli/​policy/​parser.py Sources the bin_deploy warning from the catalog.
src/​apm_cli/​models/​manifest_targets.py Catalogs manifest warnings, preserving dynamic hints.
src/​apm_cli/​marketplace/​yml_schema.py Catalogs the collected outputs-format warning.
src/​apm_cli/​marketplace/​migration.py Preserves the public warning constant through catalog lookup.
src/​apm_cli/​install/​phases/​targets.py Reuses the cataloged agents warning.
src/​apm_cli/​deps/​registry_proxy.py Catalogs deprecated environment-variable warnings.
src/​apm_cli/​core/​target_detection.py Reuses the cataloged Python target warning.
src/​apm_cli/​core/​target_catalog.py Delegates target-alias wording to the catalog.
src/​apm_cli/​core/​deprecations.py Defines deprecation metadata and message rendering.
src/​apm_cli/​core/​apm_yml.py Catalogs the legacy all warning.
src/​apm_cli/​commands/​update.py Reuses cataloged compatibility warnings and shared wording.
src/​apm_cli/​commands/​pack.py Catalogs pack and unpack warnings.
src/​apm_cli/​commands/​deps/​cli.py Catalogs the legacy update-command warning.
src/​apm_cli/​commands/​config.py Catalogs the deprecated configuration-key warning.
src/​apm_cli/​commands/​compile/​cli.py Catalogs the --target all warning.
src/​apm_cli/​adapters/​client/​copilot.py Catalogs the legacy MCP placeholder warning.
scripts/​render_deprecations_table.py Generates and checks reference tables.
scripts/​architecture_linter/​checks/​registry_owner_guards.py Registers the guard and updates catalog exemptions.
scripts/​architecture_linter/​checks/​registry_deprecation_catalog.py Detects copied warning fragments outside the catalog.
docs/​src/​content/​docs/​reference/​index.md Adds generated deprecation reference tables.
CHANGELOG.md Records the new reference inventory.
.apm/​architecture/​owners/​core-runtime.json Assigns catalog ownership and its guard.

Review effort: Balanced

Comment on lines +60 to +76
fragments: dict[str, str] = {}
for node in nodes:
if not (
isinstance(node, ast.Call)
and isinstance(node.func, ast.Name)
and node.func.id == _ENTRY_CALL
):
continue
key = _keyword_text(node, "key")
if key is None:
continue
for template in _template_parts(node):
for literal, _field, _spec, _conversion in string.Formatter().parse(template):
# Spacing around a placeholder is not part of the words.
literal = literal.strip()
if len(literal) >= _MIN_FRAGMENT_LENGTH:
fragments[literal] = key
Comment on lines +252 to +256
expected = _collapse(scenario.text)
evidence = f"stdout={result.stdout!r}\nstderr={result.stderr!r}"

assert _collapse(streams[scenario.stream]).count(expected) == 1, evidence
assert expected not in _collapse(streams[other]), evidence
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 21, 2026
load_marketplace_config now delivers every MarketplaceConfig.warnings
entry (the list/string outputs deprecation and the outputs.<format>.path
conflict) through its warn_callback, after the legacy marketplace.yml
deprecation. apm pack, marketplace check and outdated already render that
callback. Pack's release-gate reload passes a discard callback so no load
warning prints twice. The marketplace-outputs-list catalog entry is now a
printed warning with no scheduled removal, so the text drops the stale
v0.15 date. Flips #4035's stays-unprinted pin into installed-CLI tests.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plan/apply P5b: one deprecation catalog

2 participants