Spaces:
Running
fix(findings): a capped promise is info unless the capped insight still ends weak
Browse filesinsight_promise_capped was a warning in the Slack count on every build where
the tuning loop capped a promise to what a bounded measure's band can
deliver. Two of the five lines on Frontline's second replay (fe431f93cbf8,
2026-10-20) were caps that had worked: the rows were pushed as far as the
band allows and the chart shows that honestly. The only "fix" is a blueprint
knob, not something an SE can act on.
boone, 2026-10-20: info severity, "keeping it a warning only when the capped
insight also ends weak". The record is now built once the loop is over, from
the insight itself (authored vs driven magnitude), so its severity can read
the final validation: info, or warning with "still ended weaker" appended
when the insight is in the final failed set. Slack skips info records, so a
cap that worked leaves the warning count the way the unclassified roll-up did.
Tests: test_a_capped_promise_is_info_unless_the_insight_still_ends_weak
(Spendflo fixture: info; scripted still-weak: warning). Suite 1423 passed,
3 pre-existing failures.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
@@ -288,20 +288,12 @@ def build_demo(
|
|
| 288 |
for note in _boost_weak_insights(blueprint, report):
|
| 289 |
progress(f"insight promise capped: {note}")
|
| 290 |
warnings.append(f"insight promise capped: {note}")
|
| 291 |
-
findings.append(Finding(
|
| 292 |
-
code="insight_promise_capped",
|
| 293 |
-
severity="warning",
|
| 294 |
-
stage="generation",
|
| 295 |
-
message=note,
|
| 296 |
-
suggestion=(
|
| 297 |
-
"if the original lift is the point of the story, widen the measure's declared "
|
| 298 |
-
"band (params.low/high) or plant it on a measure that is not bounded; "
|
| 299 |
-
"otherwise the capped promise is what the chart can honestly show"
|
| 300 |
-
),
|
| 301 |
-
))
|
| 302 |
|
| 303 |
findings.extend(round_findings)
|
| 304 |
warnings.extend(round_warnings)
|
|
|
|
|
|
|
|
|
|
| 305 |
if report is not None and report.failed_insights():
|
| 306 |
warnings.append(
|
| 307 |
"Some planted insights are weaker than promised after tuning (or could not be "
|
|
@@ -427,6 +419,52 @@ def _generate_with_formula_repair(
|
|
| 427 |
)
|
| 428 |
|
| 429 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 430 |
def _tuning_stalled(previous: dict[str, float], current: dict[str, float]) -> bool:
|
| 431 |
"""True when every weak insight both rounds measured realized the same
|
| 432 |
ratio β the last boost changed nothing, so the next one will not either."""
|
|
|
|
| 288 |
for note in _boost_weak_insights(blueprint, report):
|
| 289 |
progress(f"insight promise capped: {note}")
|
| 290 |
warnings.append(f"insight promise capped: {note}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 291 |
|
| 292 |
findings.extend(round_findings)
|
| 293 |
warnings.extend(round_warnings)
|
| 294 |
+
# Capped promises are recorded once the loop is over, because their
|
| 295 |
+
# severity depends on how the capped insight ENDED (see the helper).
|
| 296 |
+
findings.extend(_capped_promise_findings(blueprint, report))
|
| 297 |
if report is not None and report.failed_insights():
|
| 298 |
warnings.append(
|
| 299 |
"Some planted insights are weaker than promised after tuning (or could not be "
|
|
|
|
| 419 |
)
|
| 420 |
|
| 421 |
|
| 422 |
+
def _promise_was_capped(insight) -> bool:
|
| 423 |
+
"""True when tuning LOWERED this insight's magnitude toward 1.0 β a band
|
| 424 |
+
cap. A boost moves it the other way, and the laggard floor keeps it beyond
|
| 425 |
+
the authored figure, so neither reads as a cap."""
|
| 426 |
+
authored = insight.authored_magnitude
|
| 427 |
+
return authored is not None and abs(insight.magnitude - 1.0) < abs(authored - 1.0) - 1e-9
|
| 428 |
+
|
| 429 |
+
|
| 430 |
+
def _capped_promise_findings(blueprint: DemoBlueprint, report: ValidationReport | None) -> list[Finding]:
|
| 431 |
+
"""One record per capped promise, decided once the tuning loop is over.
|
| 432 |
+
|
| 433 |
+
A cap is an action that worked: the rows were pushed as far as the band
|
| 434 |
+
allows and the chart shows that honestly. So the record is `info` β kept
|
| 435 |
+
on the run, out of the Slack count β unless the capped insight is STILL
|
| 436 |
+
weak at the end, when the SE has a decision to make (boone, 2026-10-20:
|
| 437 |
+
"a warning only when the capped insight also ends weak"). Two of the five
|
| 438 |
+
lines on Frontline's second replay (fe431f93cbf8) were caps that had
|
| 439 |
+
worked.
|
| 440 |
+
"""
|
| 441 |
+
weak = {c.insight_id for c in report.failed_insights()} if report is not None else set()
|
| 442 |
+
out: list[Finding] = []
|
| 443 |
+
for insight in blueprint.insights:
|
| 444 |
+
if not _promise_was_capped(insight):
|
| 445 |
+
continue
|
| 446 |
+
still_weak = insight.id in weak
|
| 447 |
+
out.append(Finding(
|
| 448 |
+
code="insight_promise_capped",
|
| 449 |
+
severity="warning" if still_weak else "info",
|
| 450 |
+
stage="generation",
|
| 451 |
+
message=(
|
| 452 |
+
f"insight {insight.id} promised {insight.authored_magnitude:g}x on {insight.measure}, "
|
| 453 |
+
f"whose band can deliver at most {insight.magnitude:.2f}x β promise capped at "
|
| 454 |
+
f"{insight.magnitude:.2f}x and the rows pushed further in the band instead"
|
| 455 |
+
+ ("; the chart still ended weaker than the capped promise" if still_weak else "")
|
| 456 |
+
),
|
| 457 |
+
suggestion=(
|
| 458 |
+
"if the original lift is the point of the story, widen the measure's declared "
|
| 459 |
+
"band (params.low/high) or plant it on a measure that is not bounded; "
|
| 460 |
+
"otherwise the capped promise is what the chart can honestly show"
|
| 461 |
+
),
|
| 462 |
+
extra={"insight_id": insight.id, "promised": insight.authored_magnitude,
|
| 463 |
+
"capped_at": insight.magnitude, "still_weak": still_weak},
|
| 464 |
+
))
|
| 465 |
+
return out
|
| 466 |
+
|
| 467 |
+
|
| 468 |
def _tuning_stalled(previous: dict[str, float], current: dict[str, float]) -> bool:
|
| 469 |
"""True when every weak insight both rounds measured realized the same
|
| 470 |
ratio β the last boost changed nothing, so the next one will not either."""
|
|
@@ -1397,7 +1397,7 @@ def test_tuning_stops_when_a_round_changed_nothing():
|
|
| 1397 |
assert not _tuning_stalled({"i1": 1.12}, {"i3": 1.12}) # nothing in common: not a stall
|
| 1398 |
src = inspect_source(build_demo_module.build_demo)
|
| 1399 |
assert "_tuning_stalled(previous_observed, observed_now)" in src
|
| 1400 |
-
assert
|
| 1401 |
|
| 1402 |
|
| 1403 |
def inspect_source(fn):
|
|
|
|
| 1397 |
assert not _tuning_stalled({"i1": 1.12}, {"i3": 1.12}) # nothing in common: not a stall
|
| 1398 |
src = inspect_source(build_demo_module.build_demo)
|
| 1399 |
assert "_tuning_stalled(previous_observed, observed_now)" in src
|
| 1400 |
+
assert "_capped_promise_findings(blueprint, report)" in src
|
| 1401 |
|
| 1402 |
|
| 1403 |
def inspect_source(fn):
|
|
@@ -186,3 +186,30 @@ def test_distinct_messages_for_one_measure_are_still_distinct_findings():
|
|
| 186 |
low = Finding(message="97/3333 row(s) sit ON the low bound", **common)
|
| 187 |
|
| 188 |
assert _dedupe([high, low, high]) == [high, low]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
low = Finding(message="97/3333 row(s) sit ON the low bound", **common)
|
| 187 |
|
| 188 |
assert _dedupe([high, low, high]) == [high, low]
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
def test_a_capped_promise_is_info_unless_the_insight_still_ends_weak(monkeypatch):
|
| 192 |
+
"""boone, 2026-10-20: a cap is an action that worked, and its only fix is a
|
| 193 |
+
blueprint knob, so it leaves the Slack count β unless the capped insight is
|
| 194 |
+
still weak when tuning ends."""
|
| 195 |
+
build = _build(monkeypatch, [])
|
| 196 |
+
capped = [f for f in build.findings if f.code == "insight_promise_capped"]
|
| 197 |
+
assert [f.extra["insight_id"] for f in capped] == ["i2"] # the bounded rate's 1.5x promise
|
| 198 |
+
assert capped[0].severity == "info" and capped[0].extra["still_weak"] is False
|
| 199 |
+
text = format_build_findings(prospect="Spendflo", se_email="x@thoughtspot.com",
|
| 200 |
+
findings=build.findings, run_id="r")
|
| 201 |
+
assert "insight_promise_capped" not in (text or "")
|
| 202 |
+
|
| 203 |
+
# Scripted: the same cap, but i2 never realizes -> the record is a warning.
|
| 204 |
+
def validate_with_i2_weak(blueprint, bundle):
|
| 205 |
+
report = validate_bundle(blueprint, bundle)
|
| 206 |
+
for c in report.insight_checks:
|
| 207 |
+
if c.insight_id == "i2":
|
| 208 |
+
c.passed = False
|
| 209 |
+
return report
|
| 210 |
+
|
| 211 |
+
monkeypatch.setattr(build_demo_module, "validate_bundle", validate_with_i2_weak)
|
| 212 |
+
build = _build(monkeypatch, [])
|
| 213 |
+
(capped,) = [f for f in build.findings if f.code == "insight_promise_capped"]
|
| 214 |
+
assert capped.severity == "warning" and capped.extra["still_weak"] is True
|
| 215 |
+
assert "still ended weaker" in capped.message
|