Skip to content

fix(output): one printer per repeated install and pack line - #4412

Merged
Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
bug-sweep/i9-a
Nov 21, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 4 commits into
mainfrom
bug-sweep/i9-a

Conversation

@danielmeppiel

Copy link
Copy Markdown
Collaborator

Description

One printer fix per repeated or noisy output line found by the global output oracle (#4113). Each fix removes the strict known output cell that tracked it.

Issue Printer (owner) Fix
#4288 integration/mcp_integrator._install_for_runtime The MCP failure line names the runtime (Failed to install <srv> for <runtime>).
#4289 install/mcp/ownership.reconcile_legacy_truncated_key One "Left existing MCP server" warning per config file. Claude Code and Copilot CLI share .mcp.json.
#4290 core/auth.AuthResolver._emit_auth_trace An identical auth-chain trace line is sent once per resolver (per command), not once per clone attempt.
#4291 core/plugin_manifest._emit + commands/pack plugin_manifest_notes_once() (a contextvar scope around the pack build) shows each plugin-manifest note once per command.
#4307 utils/diagnostics.DiagnosticCollector.policy A violation reported again by a later phase (same package, message, severity) is recorded once, so the count matches.
#4320 registry/operations._prompt_for_environment_variables The bare CI environment detected / E2E test mode detected prints are removed.

Strict cells flipped

Removed from tests/utils/lifecycle_evidence.KNOWN_OUTPUT_CELLS:

No other cells are touched.

Failing-before evidence (installed CLI)

Each test below was run with the cell removed and the src/ fix reverted (via a patch), then with the fix applied.

Issue Test Before After
#4288 tests/integration/test_mcp_failure_line_runtime_lifecycle.py::test_mcp_failure_line_names_each_runtime (new) I9: stdout repeats a diagnostic: '[x] Failed to install com.example.lifecycle/alpha-srv' pass
#4289 tests/integration/test_mcp_slashed_server_cleanup_lifecycle.py::test_removing_slashed_server_keeps_user_and_declared_short_name_entries I9: repeats a diagnostic: "[!] Left existing MCP server 'server' in .../.mcp.json ..." pass
#4290 tests/integration/test_ado_verbose_auth_trace_lifecycle.py::test_verbose_ado_auth_steps_print_once (new) I9: repeats a diagnostic: '[i] Auth-only attempt for ado host dev.azure.com (no credential)' (and the credential-fill lines) pass
#4291 tests/integration/test_pack_mcp_ownership_lifecycle.py::test_pack_output_is_identical_before_and_after_install I9: repeats a diagnostic: '[!] Secrets withheld from plugin.json ...' pass
#4307 tests/integration/test_policy_install_enforcement_lifecycle.py::test_warn_policy_installs_and_reports_every_violation I9: repeats a line: '+- [contoso/pkg-required] required by org policy but not declared' pass
#4320 tests/integration/test_registry_install_ci_notice_lifecycle.py::test_registry_install_prints_no_bare_environment_notice[CI,APM_E2E_TESTS] (new) + unit test_noninteractive_registry_defaults_print_no_bare_environment_notice CI environment detected / E2E test mode detected in output pass

The new modules carry one behavioral marker (e2e) plus pytest.mark.promise("P-INV-I9"). There are 6 rows in tests/fixtures/lifecycle_bug_ledger.json and 6 Fixed lines in CHANGELOG.md.

Issue and approved scope

Fixes #4288 (scope record: #4288 (comment))
Fixes #4289 (scope record: #4289 (comment))
Fixes #4290 (scope record: #4290 (comment))
Fixes #4291 (scope record: #4291 (comment))
Fixes #4307 (scope record: #4307 (comment))
Fixes #4320 (scope record: #4320 (comment))

Does this PR complete the issue, or what remains? It completes all six.

Type of change

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

Testing

  • Tested locally: the failing-before/after table above (APM_E2E_TESTS=1 APM_BINARY_PATH=.venv/bin/apm pytest <node>); tests/quality/test_lifecycle_bug_ledger.py passed; ruff, scripts/lint-auth-signals.sh and the complexity ratchet are clean on the changed files.
  • All existing tests pass (CI)
  • Added tests for new functionality (if applicable)

Changelog

  • One line per fix in ### Fixed under ## [Unreleased] in CHANGELOG.md.
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

apm-spec-waiver: diagnostic output wording and de-duplication only; no OpenAPM-observable behaviour change

  • N/A -- this PR does not change OpenAPM-observable behaviour.

Co-authored-by: Copilot [email protected]

 #4290 #4291 #4307 #4320)

- MCP failure lines name their runtime (#4288).
- A legacy MCP entry in a shared config file is reported once (#4289).
- AuthResolver sends an identical auth-chain trace line once (#4290).
- apm pack shows each plugin-manifest note once per command (#4291).
- DiagnosticCollector.policy records an identical violation once (#4307).
- Registry defaults in CI or E2E mode print no bare notice (#4320).

Removes the seven strict output cells these issues tracked.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel Daniel Meppiel (danielmeppiel) added this to the 0.37.0 milestone Nov 20, 2026
Copilot AI balanced review requested due to automatic review settings November 20, 2026 16:28
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: copilot-swe-agent[bot] <[email protected]>

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 regression test remains environment-dependent, while diagnostic deduplication still permits duplicate warnings, inflated counts, and quadratic collection overhead.

2 open issues
What changed in this PR

This PR addresses six noisy or repeated CLI output issues identified by the global output oracle, refining diagnostics for install and pack commands.

Changes:

  • Names runtimes in MCP failures and deduplicates shared-config warnings, auth traces, plugin-manifest notes, and policy diagnostics.
  • Removes bare CI/E2E environment notices from registry operations.
  • Adds regression coverage and bug-ledger entries, and removes seven known-output exceptions.
File Description
tests/​utils/​lifecycle_evidence.py Removes seven known-output exceptions.
tests/​unit/​install/​test_mcp_optional_inputs.py Tests silent noninteractive registry defaults.
tests/​integration/​test_registry_install_ci_notice_lifecycle.py Checks registry installs omit bare environment notices.
tests/​integration/​test_mcp_failure_line_runtime_lifecycle.py Checks MCP failures identify each runtime.
tests/​integration/​test_ado_verbose_auth_trace_lifecycle.py Checks verbose ADO auth traces appear once.
tests/​fixtures/​lifecycle_bug_ledger.json Records six fixes and their regression tests.
src/​apm_cli/​utils/​diagnostics.py Adds policy-diagnostic deduplication.
src/​apm_cli/​registry/​operations.py Removes bare environment notices.
src/​apm_cli/​integration/​mcp_integrator.py Adds runtime labels to MCP failure messages.
src/​apm_cli/​install/​mcp/​ownership.py Deduplicates legacy-entry warnings for shared config files.
src/​apm_cli/​core/​plugin_manifest.py Adds scoped plugin-manifest note deduplication.
src/​apm_cli/​core/​auth.py Deduplicates auth traces per resolver.
src/​apm_cli/​commands/​pack.py Applies note deduplication around the pack build.
CHANGELOG.md Documents the six output fixes.

Review effort: Balanced

Comment on lines +223 to +224
if diagnostic not in self._diagnostics:
self._diagnostics.append(diagnostic)
"""Registry defaults in CI or E2E mode print nothing per server (#4320)."""
for name in ("CI", "GITHUB_ACTIONS", "TRAVIS", "JENKINS_URL", "BUILDKITE", "APM_E2E_TESTS"):
monkeypatch.delenv(name, raising=False)
monkeypatch.setenv(env_name, "1")
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…pack line

Co-authored-by: Copilot App <[email protected]>

# Conflicts:
#	tests/fixtures/lifecycle_bug_ledger.json
… prefix

The check-clean recovery recipe printed five bare '[i]' lines, which the
output oracle reports as a repeated diagnostic now that #4291's cell is
gone.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 7a52322 into main Nov 21, 2026
3 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the bug-sweep/i9-a branch November 21, 2026 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants