Add deal-concentration risk metric and --max-concentration CI gate#6
Open
cognis-digital wants to merge 1 commit into
Open
Add deal-concentration risk metric and --max-concentration CI gate#6cognis-digital wants to merge 1 commit into
cognis-digital wants to merge 1 commit into
Conversation
A weighted forecast can look healthy while resting almost entirely on one large, still-open deal; if it slips the number collapses. This adds a 'concentration' field to the Report — the share of the weighted forecast carried by the single largest open deal (0.0 when there is no forecast) — shown in the table and JSON output. The new --max-concentration CLI gate exits non-zero when concentration exceeds a threshold, letting CI flag a fragile, whale-dependent pipeline the same way --min-forecast / --min-win-rate guard the dollar and quality numbers. Backward compatible: concentration is appended to Report with a default, so existing construction is unaffected. Adds demo 18 and 11 tests.
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
A weighted forecast can look healthy while resting almost entirely on a single large, still-open deal. If that one deal slips, the number collapses. This PR surfaces that fragility.
concentrationfield onReport— the share of the weighted forecast carried by the single largest open deal's expected value (0.0when there is no forecast). Included into_dict()/--format jsonand shown in thetableoutput.--max-concentrationCI gate — exits non-zero when concentration exceeds the given fraction, so a fragile, whale-dependent pipeline fails the build the same way--min-forecastand--min-win-rateguard the dollar and quality numbers.Why
RevOps and finance already gate on the total forecast and win rate, but a $1M forecast that is 80% one deal is a very different risk than the same $1M spread across ten. This makes that risk a first-class, gate-able signal.
Compatibility
concentrationis appended toReportwith a default value, so existing positional/keyword construction ofReportis unchanged. No existing public signature changes.Tests / demos
tests/test_concentration.py— 11 tests (metric math, unit-interval bound, backward-compat default, table/JSON surfacing, and the gate passing/failing).demos/18_concentration_risk.py— narrated scenario over the enterprise-ACV sample; wired intorun_all.pyanddocs/DEMOS.md.python -m pytest -q-> 312 passed.