From adeb195744a01d34eeecd839dc3aa229ad003d6c Mon Sep 17 00:00:00 2001 From: ghost <49853598+JSONbored@users.noreply.github.com> Date: Sun, 21 Jun 2026 04:14:08 -0700 Subject: [PATCH] fix(scoring): surface snapshot warnings in previews --- src/scoring/preview.ts | 2 +- test/unit/scoring.test.ts | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/scoring/preview.ts b/src/scoring/preview.ts index e5dd4ebfc3..a901ed53b0 100644 --- a/src/scoring/preview.ts +++ b/src/scoring/preview.ts @@ -206,7 +206,7 @@ export function buildScorePreview(args: { const effectiveEstimatedScore = current.scoreEstimate.estimatedMergedScore; const underlyingPotentialScore = current.scoreEstimate.pendingSaturationScore; const scoreabilityStatus = statusFor(args.repo, blockedBy, effectiveEstimatedScore, scenarioPreviews); - const warnings = warningsFor(args.input, args.repo, current, branchEligibility); + const warnings = [...args.snapshot.warnings, ...warningsFor(args.input, args.repo, current, branchEligibility)]; const actions = [ ...(!current.gates.baseTokenGatePassed ? ["Increase meaningful source change size or scope clarity before relying on this preview."] : []), ...(current.scoreEstimate.openPrMultiplier === 0 ? ["Land or close existing open PRs before opening more concurrent work."] : []), diff --git a/test/unit/scoring.test.ts b/test/unit/scoring.test.ts index 1445bc85c4..040e12b78e 100644 --- a/test/unit/scoring.test.ts +++ b/test/unit/scoring.test.ts @@ -114,6 +114,17 @@ OSS_EMISSION_SHARE = 0.90 expect(served.warnings.some((warning) => /stale/i.test(warning))).toBe(false); }); + it("surfaces snapshot warnings in score previews (#810)", () => { + const warning = "Scoring constants snapshot is stale; preview scores may use old constants."; + const preview = buildScorePreview({ + repo, + input: { repoFullName: repo.fullName, sourceTokenScore: 10 }, + snapshot: { ...snapshot, warnings: [warning] }, + }); + + expect(preview.warnings).toContain(warning); + }); + it("prefers exponential saturation when mixed upstream constants are present", () => { const parsed = parsePythonNumberConstants(` MERGED_PR_BASE_SCORE = 25