Skip to content

fix(lifecycle): print the org deny_all lifecycle-scripts notice once per command - #4373

Merged
Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
danielmeppiel-t1-deny-all-notice-once
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 5 commits into
mainfrom
danielmeppiel-t1-deny-all-notice-once

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Fixes #4333
Fixes #4399

What

Under an org policy with executables.deny_all, apm update --yes (and an install that builds more than one lifecycle runner) printed [!] Lifecycle scripts suppressed by org policy (executables.deny_all). more than once.

build_runner_from_context (core/lifecycle_scripts.py) is the only place that prints this notice. After printing, it now marks the command logger, and later runners built for the same command skip the notice. Scripts are still suppressed exactly as before; only the repeated line is gone. The #4333 strict output cell in tests/utils/lifecycle_evidence.py is removed in this PR.

Validation

  • New unit test test_deny_all_notice_prints_once_per_command_logger: builds two runners with one logger and expects the notice once.
  • pytest tests/unit/core/test_lifecycle_scripts.py tests/unit/install/test_lifecycle_trust_gate.py: 42 passed.
  • The failing-before e2e tests/integration/test_lifecycle_deny_all_chain_lifecycle.py was not run locally: this worktree's venv points at another checkout, so it is left to CI.
  • ruff check and format: clean.

Steward pre-approval (A-C)

  • Node-set diff vs main: no deletions or renames; adds tests/unit/core/test_lifecycle_scripts.py::TestBuildRunnerFromContext::test_deny_all_notice_prints_once_per_command_logger.
  • Oracle and obligations: removes 1 strict known cell, update-deny-all-lifecycle-notice-repeats (apm update repeats the org deny_all lifecycle-scripts notice #4333), because the product fix in this PR makes the one-notice-per-command behavior required (tightens). 0 cells added; 0 obligation changes.

#4399 (uninstall sibling): uninstall builds its pre/post runners with ONE command logger, so the same single-printer covers it with no extra change. Failing-before on main: test_lifecycle_deny_all_chain_lifecycle.py::test_deny_all_suppresses_every_lifecycle_tier_across_chain (I9 at the uninstall step). Passing-after on f2a9a6a: 1 passed (local, guard). No cell added.

…per command (#4333)

update builds a lifecycle runner and its install pipeline builds another, so
'Lifecycle scripts suppressed by org policy (executables.deny_all).' printed
twice. build_runner_from_context now marks the command logger once the notice is
printed and skips it for later runners of the same command. The #4333 strict
output cell is retired.

Fixes #4333

Co-authored-by: Copilot App <[email protected]>
# Conflicts:
#	tests/utils/lifecycle_evidence.py

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.

🟢 Approval recommended

No active review issues remain for the change to deduplicate lifecycle-script suppression notices.

No open issues 🎉

What changed in this PR

Addresses #4333 by preventing repeated lifecycle-script suppression notices when an APM command builds multiple runners with the same logger. Script suppression behavior remains unchanged.

Changes:

  • Tracks the last reported suppression reason on the command logger.
  • Adds a regression test for two runners sharing one logger.
  • Removes the known-output exception for the duplicate notice.
File Description
tests/​utils/​lifecycle_evidence.py Removes the #4333 exception so duplicate notices fail the output check.
tests/​unit/​core/​test_lifecycle_scripts.py Verifies that runners sharing a logger emit the deny-all notice once.
src/​apm_cli/​core/​lifecycle_scripts.py Deduplicates suppression notices using logger-scoped state.

Review effort: Balanced

Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
…cripts notice once per command

Co-authored-by: Copilot App <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 91bb236 into main Nov 20, 2026
42 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the danielmeppiel-t1-deny-all-notice-once branch November 20, 2026 17:46
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
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.

apm uninstall repeats the org deny_all lifecycle-scripts notice apm update repeats the org deny_all lifecycle-scripts notice

2 participants