Align PChome rescore audit and matcher safeguards
This commit is contained in:
@@ -61,6 +61,14 @@ def main(argv: list[str] | None = None) -> int:
|
||||
parser.add_argument("--limit", type=int, default=100)
|
||||
parser.add_argument("--sample-limit", type=int, default=20)
|
||||
parser.add_argument("--min-score", type=float, default=MIN_MATCH_SCORE)
|
||||
parser.add_argument(
|
||||
"--include-historical-candidates",
|
||||
action="store_true",
|
||||
help=(
|
||||
"Scan the latest row per SKU/candidate after status filtering. "
|
||||
"Default scans only the latest attempt per SKU, matching the Dashboard review queue."
|
||||
),
|
||||
)
|
||||
parser.add_argument(
|
||||
"--apply-accepted",
|
||||
action="store_true",
|
||||
@@ -90,12 +98,18 @@ def main(argv: list[str] | None = None) -> int:
|
||||
statuses=statuses,
|
||||
reason_filter=args.reason_filter or None,
|
||||
limit=args.limit,
|
||||
latest_sku_only=not args.include_historical_candidates,
|
||||
)
|
||||
summary = summarize_match_attempt_rescore(
|
||||
rows,
|
||||
min_score=args.min_score,
|
||||
sample_limit=args.sample_limit,
|
||||
)
|
||||
summary["selection_mode"] = (
|
||||
"historical_candidate_latest"
|
||||
if args.include_historical_candidates
|
||||
else "latest_sku_only"
|
||||
)
|
||||
summary["materialize"] = materialize_rescore_accept_reviews(
|
||||
conn,
|
||||
rows,
|
||||
@@ -111,6 +125,7 @@ def main(argv: list[str] | None = None) -> int:
|
||||
limit=args.limit,
|
||||
min_score=args.min_score,
|
||||
sample_limit=args.sample_limit,
|
||||
latest_sku_only=not args.include_historical_candidates,
|
||||
)
|
||||
|
||||
print(json.dumps(summary, ensure_ascii=False, indent=2, default=str))
|
||||
|
||||
Reference in New Issue
Block a user