refactor(tooling): PR #841 round-3 review — uniform --sample precedence + warnings

- health_score_calculator + pipeline_analyzer: warn on stderr when --sample
  overrides a provided input (now consistent across all six tools)
- pmf_scorer: --sample checked before --input (matches the batch), with the
  same override warning
- pipeline_analyzer: comment the intentionally stale D-3 fixture deal
- contrast_checker: user-facing --sample help text

https://claude.ai/code/session_01CUWsrUNZP9jpxvAwq67UiT
This commit is contained in:
Claude 2026-06-11 16:05:11 +00:00
parent 0cc9ef05e5
commit 552b373bef
No known key found for this signature in database
4 changed files with 13 additions and 4 deletions

View file

@ -444,6 +444,8 @@ def main() -> None:
args = parser.parse_args()
if args.sample:
if args.input_file:
print("Warning: --sample specified; ignoring input_file", file=sys.stderr)
data = SAMPLE_DATA
else:
if not args.input_file:

View file

@ -458,6 +458,8 @@ SAMPLE_DATA = {
"value": 120000, "age_days": 30, "close_date": "2026-07-15"},
{"id": "D-2", "name": "Globex new logo", "stage": "discovery",
"value": 80000, "age_days": 10, "close_date": "2026-08-01"},
# D-3 is intentionally stale (70d old vs 45d average cycle, closing
# imminently) so the fixture exercises the at-risk/aging detection.
{"id": "D-3", "name": "Initech expansion", "stage": "negotiation",
"value": 200000, "age_days": 70, "close_date": "2026-06-30"},
{"id": "D-4", "name": "Umbrella upsell", "stage": "closed_won",
@ -490,6 +492,8 @@ def main() -> None:
args = parser.parse_args()
if args.sample:
if args.input:
print("Warning: --sample specified; ignoring --input", file=sys.stderr)
data = SAMPLE_DATA
else:
if not args.input:

View file

@ -563,7 +563,12 @@ def main():
)
args = parser.parse_args()
if args.input:
if args.sample:
# --sample wins over --input, consistent with the other sample-pattern tools.
if args.input:
print("Warning: --sample specified; ignoring --input", file=sys.stderr)
data = sample_data()
elif args.input:
try:
with open(args.input) as f:
data = json.load(f)
@ -573,8 +578,6 @@ def main():
except json.JSONDecodeError as e:
print(f"Error: invalid JSON: {e}", file=sys.stderr)
sys.exit(1)
elif args.sample:
data = sample_data()
else:
# Notice goes to stderr so `--json` output stays parseable when piped.
print("No input file provided — running with sample data.\n", file=sys.stderr)

View file

@ -356,7 +356,7 @@ def build_parser() -> argparse.ArgumentParser:
parser.add_argument(
"--sample",
action="store_true",
help="Alias for --demo (repo-wide embedded-sample convention)",
help="Run with embedded sample color pairs (alias for --demo)",
)
return parser