[BUG] install shows a traceback instead of a policy error when the org policy chain has an inheritance error

Open Beginner friendly
#4,925 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
cli

Research direction

The traceback comes from discover_trust_policy, which does not catch the errors listed in POLICY_DISCOVERY_ERRORS (including PolicyInheritanceError) the way the audit path does. Compare the two code paths, then add the same handling so an inheritance error maps to the incomplete_chain outcome. Done when apm install prints a clear [x] message for an extends cycle instead of a traceback.

Written by the indexing model from the issue text.

Description

bug status/accepted type/bug

Summary

If the org policy chain has an inheritance error (an extends cycle, a cross-host extends, or chain depth over the limit), commands that read the trust policy during install (apm install and related trust readers that go through discover_trust_policy) fail with a Python traceback. They should report a named, routed policy error instead.

The behaviour fails closed: nothing is installed. But the user sees a stack trace rather than an [x] line that names the policy problem and how to fix it.

Expected

discover_trust_policy handles the same known discovery errors (POLICY_DISCOVERY_ERRORS, including PolicyInheritanceError) that audit uses. An inheritance error then routes as the always-block incomplete_chain outcome, with a clear [x] message.

Notes

Found while reviewing the audit policy-resolution change in #4920, which routes this case for apm audit.

Dominant language
Python
Stars
4.4k
Forks
430
Avg merge
19h 38m
Merged PRs (30d)
637

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/apm

All issues in microsoft/apm

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.