docs: plan to route exclusion-match messages through logging (quiet library, unchanged CLI)#592
Closed
kmcquade wants to merge 2 commits into
Closed
docs: plan to route exclusion-match messages through logging (quiet library, unchanged CLI)#592kmcquade wants to merge 2 commits into
kmcquade wants to merge 2 commits into
Conversation
Add docs/plans/exclusion-message-logging.md: make the "Excluded prefix/suffix" lines from is_name_excluded quiet for library consumers (logger.debug) while keeping CLI output byte-for-byte identical via a module-level toggle the CLI group callback flips on. Fact-checked by an Opus review subagent (verdict: yes-with-fixes); the three required fixes are folded in. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v2 of the plan. The Codex adversarial review (verdict: needs-attention) flagged the v1 sticky process-global toggle: an in-process caller that runs the CLI and then uses the library would keep printing exclusion matches, violating the quiet-by-default library contract. Fix: scope set_exclusion_output(True) to the Click invocation and restore the prior value via ctx.call_on_close(); set_exclusion_output now returns the previous value. Add an embedded-CLI regression test (TDD item 5) that runs the CLI in-process then asserts the library is quiet afterward. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Superseded: the plan doc has been folded into the implementation branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
docs/plans/2026-06-14-exclusion-message-logging.md— a reviewed implementation plan (no source changes) for making theExcluded prefix:/Excluded suffix:lines fromis_name_excludedquiet for library consumers while keeping CLI output byte-for-byte identical.Why
cloudsplaining/shared/exclusions.py::is_name_excluded()emits prefix/suffix matches viautils.print_grey(a rawprint()), bypassing logging entirely. These fire during collection construction (RoleDetailList/ManagedPolicyDetails) for every service-linked role / AWS-managed policy — so any library parse ofget-account-authorization-detailsfloods stdout, with no way to silence it via standardlogging. The exact-match branch already useslogger.debug; only prefix/suffix are inconsistent.Proposed approach (in the doc)
exclusions.py: route prefix/suffix through a_report_exclusion()helper —logger.debugby default (library),print_greywhen a module-level toggle is on.bin/cli.py: the Click group callback scopes the toggle on for the CLI invocation and restores the prior value viactx.call_on_close()— so CLI output is unchanged and nothing leaks back into a later in-process library call.Review trail
yes-with-fixes(root cause, trigger paths,downloadclaim, CLI chokepoint, import safety, no test breakage all confirmed; 3 fixes folded in).needs-attention: flagged the v1 sticky-global toggle as a library-mode leak. Resolved in v2 via the scopedctx.call_on_close()restore + regression test.Scope
Plan doc only — no production code changes. Implementation will follow in a separate PR.
🤖 Generated with Claude Code