Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(today): load key numbers one way and remove the progressive flag (#129880)

Shy Alter64aa174e1aac
diff --git a/frontend/src/scenes/project-homepage/today/todayPulseFacts.ts b/frontend/src/scenes/project-homepage/today/todayPulseFacts.ts
index 6913a74aacee..21cc59926d0f 100644
--- a/frontend/src/scenes/project-homepage/today/todayPulseFacts.ts
+++ b/frontend/src/scenes/project-homepage/today/todayPulseFacts.ts
@@ -42,7 +42,6 @@ function openedSubject(metric: HighlightMetricApi): string {
const FIXED_WHY: Partial<Record<NonNullable<HighlightMetricApi['reason']>, string>> = {
key_metric: 'It is a key metric for this project, set in Customer analytics.',
- popular: 'People in this project open this insight often.',
watched: 'You get an alert or a subscription for this insight.',
built: 'You created or edited this insight recently.',
}
diff --git a/products/today/backend/feature_flags.py b/products/today/backend/feature_flags.py
index 5c02ba01e0d7..8c42891718ce 100644
--- a/products/today/backend/feature_flags.py
+++ b/products/today/backend/feature_flags.py
@@ -9,11 +9,6 @@ logger = structlog.get_logger(__name__)
TODAY_RAIL_NAV_FLAG = "today-rail-nav"
TODAY_REPORT_JEV_FLAG = "today-report-jev"
-TODAY_PROGRESSIVE_PULSE_FLAG = "today-progressive-pulse"
-
-
-def progressive_pulse_enabled(user: User, team: Team) -> bool:
- return _flag_on(TODAY_PROGRESSIVE_PULSE_FLAG, user, team)
def is_enabled_for(user: User, team: Team) -> bool:
diff --git a/products/today/backend/logic/highlight_types.py b/products/today/backend/logic/highlight_types.py
index 6daa57233251..0fac75a94f59 100644
--- a/products/today/backend/logic/highlight_types.py
+++ b/products/today/backend/logic/highlight_types.py
@@ -48,6 +48,10 @@ def property_restrictions(team: Team, user: User) -> str:
)[:16]
+def ignore_pulse(_found: HighlightFindings, _slots: list[PulseSlot]) -> None:
+ return None
+
+
class Context:
"""Today's `HighlightContext`. A source sees only the protocol, so these internals stay private."""
@@ -65,7 +69,7 @@ class Context:
self.today = today
self.scopes = scopes
self.pinned = pinned
- self.publish_pulse = publish_pulse
+ self.publish_pulse = publish_pulse or ignore_pulse
self.failures: list[str] = []
self.access = UserAccessControl(user=user, team=team)
diff --git a/products/today/backend/logic/highlights.py b/products/today/backend/logic/highlights.py
index d47fdba32b9f..8171d7e325b5 100644
--- a/products/today/backend/logic/highlights.py
+++ b/products/today/backend/logic/highlights.py
@@ -29,13 +29,11 @@ from ..facade.contracts import HighlightCandidate, HighlightFindings, HighlightS
from ..facade.enums import (
HighlightInterval,
HighlightLabel,
- HighlightMetricReason,
HighlightPinStatus,
HighlightPriority,
HighlightsStatus,
PulseSlotStatus,
)
-from ..feature_flags import progressive_pulse_enabled
from ..models import TodayHighlights
from ..temporal.inputs import (
HIGHLIGHTS_WORKFLOW_NAME,
@@ -51,6 +49,7 @@ from . import pulse_pins
from .highlight_registry import load_sources, source_product
from .highlight_types import CACHE_SECONDS, Context, property_restrictions
from .pinned import PINNED_METRICS
+from .today_highlights.routine import PULSE_CANDIDATES
logger = structlog.get_logger(__name__)
@@ -60,7 +59,6 @@ START_LOCK_SECONDS = 30
MAX_ITEMS = 6
MAX_PER_FAMILY = 2
MIN_SCORE = 0.2
-PULSE_CANDIDATES = 6
URGENT_RISK_SCORE = 0.75
MINOR_OPPORTUNITY_SCORE = 0.4
PINNED_SOURCE = "pinned"
@@ -89,9 +87,6 @@ def get_highlights(
]
key = _key(team, user, scopes)
pins_key = _pins_key(pins)
- progressive = progressive_pulse_enabled(user, team)
- if progressive:
- key = hashlib.sha256(f"{key}:progressive".encode()).hexdigest()[:32]
rows = (
TodayHighlights.objects.for_team(team.id)
.filter(user_id=user.id, key=key, local_day=day)
@@ -99,8 +94,7 @@ def get_highlights(
)
latest = rows.first()
retry_failed = (
- progressive
- and refresh
+ refresh
and latest is not None
and latest.failed_sources
and latest.status != HighlightsStatus.COMPUTING
@@ -116,7 +110,6 @@ def get_highlights(
pins,
pins_key,
after=latest.id if latest else None,
- progressive=progressive,
)
status = HighlightsStatus.COMPUTING
else:
@@ -126,7 +119,7 @@ def get_highlights(
if latest is not None and latest.status == HighlightsStatus.READY
else rows.filter(status=HighlightsStatus.READY).first()
)
- if progressive and latest is not None and latest.content.get("pulse_slots"):
+ if latest is not None and latest.content.get("pulse_slots"):
with suppress(ValidationError):
content = _HIGHLIGHTS.validate_python(latest.content)
if status == HighlightsStatus.COMPUTING and ready is not None and ready.id != latest.id:
@@ -159,7 +152,7 @@ def get_highlights(
refresh_at=_refresh_at(team, day),
pulse=[],
items=[],
- pulse_slots=[] if progressive else None,
+ pulse_slots=[],
)
@@ -192,7 +185,6 @@ def _start(
pins: list[PinnedNumber],
pins_key: str,
after: UUID | None,
- progressive: bool = False,
) -> None:
lock = f"today_highlights:start:{team.id}:{user.id}:{key}:{pins_key}:{day.isoformat()}:{after}"
if not cache.add(lock, True, START_LOCK_SECONDS):
@@ -208,7 +200,6 @@ def _start(
scopes=None if scopes is None else sorted(scopes),
source_names=[source.name for source in load_sources()],
pins=pins,
- progressive=progressive,
)
try:
asyncio.run(
@@ -262,7 +253,6 @@ def _pulse_content(
key=lambda slot: (
slot.key not in pin_order,
pin_order.get(slot.key, 0),
- slot.reason == HighlightMetricReason.POPULAR,
owners.get(slot.key, 0),
)
)
@@ -341,8 +331,7 @@ def run_source(inputs: HighlightSourceInputs) -> HighlightSourceResult:
return HighlightSourceResult(source_name=inputs.source_name, found=None, failed=False)
with tags_context(product=Product.TODAY, feature=Feature.QUERY, team_id=context.team.id):
found = context.guard(source.name, partial(source.find, context), HighlightFindings())
- if context.publish_pulse is not None:
- context.publish_pulse(found, [])
+ context.publish_pulse(found, [])
return HighlightSourceResult(
source_name=source.name, found=_FINDINGS.dump_json(found).decode(), failed=bool(context.failures)
)
@@ -416,10 +405,7 @@ def build_highlights(
offered.setdefault(metric.key, metric)
resolved = {**offered, **(pinned or {})}
chosen = [resolved[key] for key in pins if key in resolved]
- suggested = sorted(
- (metric for key, metric in offered.items() if key not in pins),
- key=lambda metric: metric.reason == HighlightMetricReason.POPULAR,
- )
+ suggested = [metric for key, metric in offered.items() if key not in pins]
pulse = [*chosen, *suggested][:PULSE_CANDIDATES]
ranked = rank([replace(c, source=name) for name, result in found.items() for c in result.items])
return contracts.Highlights(
diff --git a/products/today/backend/logic/today_highlights/key_metrics.py b/products/today/backend/logic/today_highlights/key_metrics.py
index 2f78d57c9793..fe91b183738b 100644
--- a/products/today/backend/logic/today_highlights/key_metrics.py
+++ b/products/today/backend/logic/today_highlights/key_metrics.py
@@ -22,35 +22,24 @@ PULSE_DAYS = 28
def find(context: Context) -> Found:
- slots = (
- [contracts.PulseSlot(key=key, name=name) for key, name in get_key_metric_names(team=context.team).items()]
- if context.publish_pulse
- else []
- )
- if context.publish_pulse is not None:
- context.publish_pulse(Found(), slots)
+ slots = [contracts.PulseSlot(key=key, name=name) for key, name in get_key_metric_names(team=context.team).items()]
+ context.publish_pulse(Found(), slots)
metrics = get_key_metrics(team=context.team, user=context.user)
- if context.publish_pulse is not None:
- deadline = monotonic() + 20
- while metrics is None and monotonic() < deadline:
- sleep(min(1.0, max(0, deadline - monotonic())))
- metrics = get_key_metrics(team=context.team, user=context.user)
- if metrics is None:
- context.publish_pulse(Found(), [replace(slot, status=PulseSlotStatus.ERROR) for slot in slots])
+ deadline = monotonic() + 20
+ while metrics is None and monotonic() < deadline:
+ sleep(min(1.0, max(0, deadline - monotonic())))
+ metrics = get_key_metrics(team=context.team, user=context.user)
if metrics is None:
+ context.publish_pulse(Found(), [replace(slot, status=PulseSlotStatus.ERROR) for slot in slots])
raise DailyValueNotReady("key_metrics")
shown = [metric for metric in metrics if metric.this_week or metric.last_week]
candidates = [candidate for metric in shown if (candidate := _same_weekday(context, metric)) is not None]
found = Found(items=tuple(candidates), pulse=tuple(tile(metric) for metric in shown))
- if context.publish_pulse is not None:
- keys = {metric.key for metric in found.pulse}
- context.publish_pulse(
- found,
- [
- replace(slot, status=PulseSlotStatus.READY if slot.key in keys else PulseSlotStatus.EMPTY)
- for slot in slots
- ],
- )
+ keys = {metric.key for metric in found.pulse}
+ context.publish_pulse(
+ found,
+ [replace(slot, status=PulseSlotStatus.READY if slot.key in keys else PulseSlotStatus.EMPTY) for slot in slots],
+ )
return found
diff --git a/products/today/backend/logic/today_highlights/routine.py b/products/today/backend/logic/today_highlights/routine.py
index 5861a2a7f705..c44fefc853ad 100644
--- a/products/today/backend/logic/today_highlights/routine.py
+++ b/products/today/backend/logic/today_highlights/routine.py
@@ -75,9 +75,7 @@ class PulseChoice:
def find(context: Context) -> Found:
pinned = context.pinned
- if context.publish_pulse is not None:
- return Found(pulse=tuple(_progressive_metrics(context, pinned, PULSE_CANDIDATES - len(pinned))))
- return Found(pulse=tuple(_frecent_metrics(context, pinned, PULSE_CANDIDATES - len(pinned))))
+ return Found(pulse=tuple(_progressive_metrics(context, pinned, PULSE_CANDIDATES - len(pinned))))
def _dashboard_context(candidate: PulseCandidate) -> InsightDashboardContext | None:
@@ -91,7 +89,7 @@ def _dashboard_context(candidate: PulseCandidate) -> InsightDashboardContext | N
def _progressive_metrics(context: Context, excluded: Collection[str], budget: int) -> list[contracts.HighlightMetric]:
- if budget <= 0 or context.publish_pulse is None:
+ if budget <= 0:
return []
deadline = monotonic() + BLOCKING_SECONDS
candidates: list[PulseCandidate] = []
@@ -239,39 +237,6 @@ def frecency(view_days: Collection[date], today: date) -> float:
return sum(0.5 ** (age / FRECENCY_HALF_LIFE_DAYS) for age in ages if 0 <= age <= FRECENCY_LOOKBACK_DAYS)
-def _frecent_metrics(context: Context, excluded: Collection[str], budget: int) -> list[contracts.HighlightMetric]:
- if budget <= 0:
- return []
- deadline = monotonic() + BLOCKING_SECONDS
- candidates: list[tuple[ViewedItem, contracts.HighlightMetric | None]] = []
- available: set[str] = set()
- for item in _own_candidates(context):
- shown = frozenset([*excluded, *available])
- metric = context.guard(
- f"frecent {item.kind} {item.ref}",
- partial(_frecent_metric, context, item, shown, deadline, wait=False),
- None,
- )
- candidates.append((item, metric))
- if metric is not None:
- available.add(metric.key)
- if len(available) >= budget:
- break
-
- metrics: list[contracts.HighlightMetric] = []
- for item, metric in candidates:
- if len(metrics) >= budget:
- break
- shown = frozenset([*excluded, *(metric.key for metric in metrics)])
- if metric is None or metric.key in shown:
- metric = context.guard(
- f"frecent {item.kind} {item.ref}", partial(_frecent_metric, context, item, shown, deadline), None
- )
- if metric is not None:
- metrics.append(metric)
- return metrics
-
-
def _own_candidates(context: Context) -> list[ViewedItem]:
none: list[str] = []
used = [item for item in _frecent_views(context) if _repeated(item.days, context.today)]
@@ -354,48 +319,6 @@ def _frecent_views(context: Context) -> list[ViewedItem]:
return [item for score, _last, item in scored if score > 0]
-def _frecent_metric(
- context: Context, item: ViewedItem, shown: frozenset[str], deadline: float, *, wait: bool = True
-) -> contracts.HighlightMetric | None:
- if item.kind == "insight":
- if f"insight:{item.ref}" in shown:
- return None
- return insight_metric(
- context,
- item.ref,
- viewed=item,
- reason=item.reason,
- blocking=wait and monotonic() < deadline,
- wait_until=deadline,
- )
- if not item.ref.isdigit():
- return None
- dashboard = dashboard_insights(
- team=context.team, user=context.user, dashboard_id=int(item.ref), limit=DASHBOARD_TILES_TRIED
- )
- if dashboard is None:
- return None
- for tile in dashboard.tiles:
- if f"insight:{tile.insight_short_id}" in shown:
- continue
- metric = context.guard(
- f"dashboard {item.ref} tile {tile.insight_short_id}",
- partial(
- _tile_metric,
- context,
- dashboard,
- tile,
- viewed=item,
- blocking=wait and monotonic() < deadline,
- wait_until=deadline,
- ),
- None,
- )
- if metric is not None:
- return metric
- return None
-
-
def dashboard_tile_metric(
context: Context,
dashboard_id: int,
diff --git a/products/today/backend/presentation/serializers.py b/products/today/backend/presentation/serializers.py
index 3dff6c7d0b65..0561389c9ef4 100644
--- a/products/today/backend/presentation/serializers.py
+++ b/products/today/backend/presentation/serializers.py
@@ -463,7 +463,7 @@ class PulseSlotSerializer(DataclassSerializer):
class HighlightsQuerySerializer(serializers.Serializer):
refresh = serializers.BooleanField(
default=False,
- help_text="Retry failed sources when progressive loading is enabled. An active computation is reused.",
+ help_text="Retry failed sources. An active computation is reused.",
)
diff --git a/products/today/backend/temporal/inputs.py b/products/today/backend/temporal/inputs.py
index 2a6dd714c406..30036e026f22 100644
--- a/products/today/backend/temporal/inputs.py
+++ b/products/today/backend/temporal/inputs.py
@@ -20,7 +20,6 @@ class ComputeHighlightsInputs:
scopes: list[str] | None
source_names: list[str]
pins: list[PinnedNumber] = dataclasses.field(default_factory=list)
- progressive: bool = False
@dataclasses.dataclass(frozen=True)
diff --git a/products/today/backend/temporal/workflows.py b/products/today/backend/temporal/workflows.py
index 2930f41413c3..fee67017f568 100644
--- a/products/today/backend/temporal/workflows.py
+++ b/products/today/backend/temporal/workflows.py
@@ -65,7 +65,7 @@ async def _run_source(inputs: ComputeHighlightsInputs, source_name: str) -> High
scopes=inputs.scopes,
source_name=source_name,
pinned=[pin.key for pin in inputs.pins],
- highlights_id=inputs.highlights_id if inputs.progressive else None,
+ highlights_id=inputs.highlights_id,
),
start_to_close_timeout=HIGHLIGHT_SOURCE_TIMEOUT,
schedule_to_close_timeout=HIGHLIGHT_SOURCE_TOTAL_TIMEOUT,
@@ -85,7 +85,7 @@ async def _resolve_pins(inputs: ComputeHighlightsInputs) -> ResolvePinsResult:
local_day=inputs.local_day,
scopes=inputs.scopes,
pins=inputs.pins,
- highlights_id=inputs.highlights_id if inputs.progressive else None,
+ highlights_id=inputs.highlights_id,
),
start_to_close_timeout=HIGHLIGHT_SOURCE_TIMEOUT,
retry_policy=temporalio.common.RetryPolicy(maximum_attempts=1),
diff --git a/products/today/backend/tests/test_highlight_insights.py b/products/today/backend/tests/test_highlight_insights.py
index bc10d4679304..6a5b1d8919a0 100644
--- a/products/today/backend/tests/test_highlight_insights.py
+++ b/products/today/backend/tests/test_highlight_insights.py
@@ -241,6 +241,21 @@ class TestRoutineInsights(BaseTest):
def setUp(self) -> None:
super().setUp()
cache.clear()
+ self.enterContext(
+ patch.object(
+ routine,
+ "viewable_insight_definitions",
+ side_effect=lambda short_ids, **_: {
+ short_id: SavedInsightDefinition(
+ id=i,
+ short_id=short_id,
+ name=short_id,
+ query={"kind": "InsightVizNode", "source": {"kind": "TrendsQuery"}},
+ )
+ for i, short_id in enumerate(short_ids)
+ },
+ )
+ )
@time_machine.travel("2026-10-13T12:00:00Z", tick=False)
def test_an_insight_opened_most_days_shows_its_last_week_in_the_pulse(self) -> None:
@@ -301,8 +316,8 @@ class TestRoutineInsights(BaseTest):
"a session",
None,
[
- ("insight:signups", "/dashboard/7", "Growth", 3, TODAY - timedelta(days=1)),
("insight:old", "/insights/old", None, 1, TODAY - timedelta(days=13)),
+ ("insight:signups", "/dashboard/7", "Growth", 3, TODAY - timedelta(days=1)),
],
),
(
@@ -378,69 +393,6 @@ class TestRoutineInsights(BaseTest):
self.assertEqual([m.key for m in pulse], ["insight:habit"])
- @parameterized.expand(
- [
- ("first_insight", "a", ["b", "c", "d"]),
- ("dashboard_tile", "slow", ["a", "b", "c", "d"]),
- ]
- )
- @time_machine.travel("2026-10-13T12:00:00Z", tick=False)
- def test_suggestions_skip_pins_and_keep_fast_results_when_an_earlier_query_uses_the_deadline(
- self, _name: str, slow_ref: str, expected: list[str]
- ) -> None:
- for age, (kind, ref) in enumerate(
- (("insight", "pinned"), ("insight", "a"), ("dashboard", "7"), ("insight", "c"), ("insight", "d")), start=1
- ):
- FileSystemViewLog.objects.create(
- team=self.team,
- user=self.user,
- type=kind,
- ref=ref,
- view_days=[TODAY - timedelta(days=age + extra) for extra in (0, 1, 2)],
- viewed_at=datetime.combine(TODAY - timedelta(days=age), time(12), tzinfo=UTC),
- )
- growth = DashboardInsights(
- dashboard_id=7,
- name="Growth",
- filters={},
- variables=None,
- tiles=(
- DashboardInsightTile(insight_short_id="slow", filters_overrides=None),
- DashboardInsightTile(insight_short_id="b", filters_overrides=None),
- ),
- )
- points = [(TODAY - timedelta(days=d), 2.0 if d <= 7 else 1.0) for d in range(14, 0, -1)]
- queried: list[tuple[str, bool, float | None, float]] = []
- started: set[str] = set()
- clock = [0.0]
-
- def series(**kwargs: Any) -> InsightSeries | None:
- ref = kwargs["short_id"]
- queried.append((ref, kwargs["blocking"], kwargs["wait_until"], clock[0]))
- if ref not in started:
- started.add(ref)
- return None
- if ref == slow_ref and kwargs["blocking"]:
- clock[0] = routine.BLOCKING_SECONDS + 10
- if ref in ("slow", slow_ref):
- return None
- return insight({"opened": points}, short_id=ref, name=ref)
-
- with (
- patch.object(routine, "dashboard_insights", return_value=growth),
- patch.object(routine, "get_insight_series", side_effect=series),
- patch.object(routine, "monotonic", side_effect=lambda: clock[0]),
- ):
- pulse = routine.find(
- Context(self.team, self.user, TODAY, pinned=frozenset({"insight:pinned", "signup_event"}))
- ).pulse
-
- self.assertEqual([metric.key for metric in pulse], [f"insight:{ref}" for ref in expected])
- self.assertEqual({ref for ref, _, _, _ in queried}, {"a", "slow", "b", "c", "d"})
- self.assertTrue(all(deadline == routine.BLOCKING_SECONDS for _, _, deadline, _ in queried))
- self.assertTrue(any(blocking for _, blocking, _, _ in queried))
- self.assertTrue(all(not blocking for _, blocking, _, at in queried if at > routine.BLOCKING_SECONDS))
-
@time_machine.travel("2026-10-13T12:00:00Z", tick=False)
def test_the_pulse_mixes_repeated_watched_and_built_insights_without_popular_ones(self) -> None:
other = User.objects.create_and_join(self.organization, "[email protected]", None)
diff --git a/products/today/backend/tests/test_highlight_key_metrics.py b/products/today/backend/tests/test_highlight_key_metrics.py
index f73034947a99..cbbbcffc00cc 100644
--- a/products/today/backend/tests/test_highlight_key_metrics.py
+++ b/products/today/backend/tests/test_highlight_key_metrics.py
@@ -1,5 +1,6 @@
import json
from datetime import date, timedelta
+from itertools import count
from types import SimpleNamespace
from typing import Any, cast
from urllib.parse import unquote
@@ -9,6 +10,8 @@ from unittest.mock import patch
from django.test import SimpleTestCase
from products.customer_analytics.backend.facade.contracts import KeyMetric
+from products.today.backend.facade.contracts import PulseSlot
+from products.today.backend.facade.enums import PulseSlotStatus
from products.today.backend.logic.highlight_registry import load_sources
from products.today.backend.logic.highlight_types import Context, DailyValueNotReady
from products.today.backend.logic.today_highlights import key_metrics
@@ -62,12 +65,15 @@ class TestKeyMetrics(SimpleTestCase):
team=SimpleNamespace(id=1),
user=SimpleNamespace(id=2),
today=TODAY,
- publish_pulse=None,
+ publish_pulse=lambda found, slots: None,
),
)
registered = next(s for s in load_sources() if s.name == "key_metrics")
- with patch.object(key_metrics, "get_key_metrics", return_value=metrics):
+ with (
+ patch.object(key_metrics, "get_key_metric_names", return_value={}),
+ patch.object(key_metrics, "get_key_metrics", return_value=metrics),
+ ):
found = registered.find(context)
self.assertEqual(
@@ -90,11 +96,25 @@ class TestKeyMetrics(SimpleTestCase):
)
def test_a_pending_calculation_asks_for_a_quick_retry(self) -> None:
+ published: list[list[PulseSlot]] = []
context = cast(
Context,
- SimpleNamespace(team=SimpleNamespace(id=1), user=SimpleNamespace(id=2), today=TODAY, publish_pulse=None),
+ SimpleNamespace(
+ team=SimpleNamespace(id=1),
+ user=SimpleNamespace(id=2),
+ today=TODAY,
+ publish_pulse=lambda found, slots: published.append(slots),
+ ),
)
registered = next(s for s in load_sources() if s.name == "key_metrics")
- with patch.object(key_metrics, "get_key_metrics", return_value=None), self.assertRaises(DailyValueNotReady):
+ with (
+ patch.object(key_metrics, "get_key_metric_names", return_value={"signup_event": "Sign-ups"}),
+ patch.object(key_metrics, "get_key_metrics", return_value=None),
+ patch.object(key_metrics, "monotonic", side_effect=count(0, 30)),
+ patch.object(key_metrics, "sleep"),
+ self.assertRaises(DailyValueNotReady),
+ ):
registered.find(context)
+
+ self.assertEqual([slot.status for slot in published[-1]], [PulseSlotStatus.ERROR])
diff --git a/products/today/backend/tests/test_highlights.py b/products/today/backend/tests/test_highlights.py
index 6eedd0ecd3d1..ddddb9324898 100644
--- a/products/today/backend/tests/test_highlights.py
+++ b/products/today/backend/tests/test_highlights.py
@@ -147,7 +147,7 @@ class TestHighlightRanking(SimpleTestCase):
class TestBuildHighlights(SimpleTestCase):
- def test_the_pulse_follows_the_source_order_with_popular_tiles_last_and_the_items_follow_priority(self) -> None:
+ def test_the_pulse_follows_the_source_order_and_the_items_follow_priority(self) -> None:
sources = (
HighlightSource(name="key_metrics", find=lambda _c: HighlightFindings(), pulse_order=2),
HighlightSource(name="routine", find=lambda _c: HighlightFindings(), pulse_order=1),
@@ -156,9 +156,7 @@ class TestBuildHighlights(SimpleTestCase):
)
found = {
"key_metrics": HighlightFindings(pulse=(metric("k1"), metric("k2"), metric("k3"))),
- "routine": HighlightFindings(
- pulse=(metric("r1"), replace(metric("p1"), reason=HighlightMetricReason.POPULAR), metric("r2"))
- ),
+ "routine": HighlightFindings(pulse=(metric("r1"), metric("r2"))),
"experiments": HighlightFindings(
items=(replace(candidate("win", "experiments", 0.9), label=HighlightLabel.OPPORTUNITY),)
),
@@ -175,7 +173,7 @@ class TestBuildHighlights(SimpleTestCase):
built.refresh_at,
),
(
- ["r1", "r2", "k1", "k2", "k3", "p1"],
+ ["r1", "r2", "k1", "k2", "k3"],
[("alert", "alerts", HighlightPriority.P2), ("win", "experiments", HighlightPriority.P3)],
DAY,
datetime(2026, 10, 14, tzinfo=ZoneInfo("Europe/Prague")),
@@ -638,10 +636,7 @@ class TestProgressiveHighlights(BaseTest):
pulse_pins.set_pins(team=self.team, user_id=self.user.id, pins=[contracts.PulsePin("insight:p", "P")])
connect = MagicMock()
connect.return_value.start_workflow = AsyncMock()
- with (
- patch.object(highlights, "progressive_pulse_enabled", return_value=True),
- patch.object(highlights, "sync_connect", connect),
- ):
+ with patch.object(highlights, "sync_connect", connect):
highlights.get_highlights(team=self.team, user=self.user, scopes=None)
rows = TodayHighlights.objects.for_team(self.team.id)
first = rows.get()
@@ -677,17 +672,16 @@ class TestProgressiveHighlights(BaseTest):
)
configured = [replace(metric(f"key:{i}"), reason=HighlightMetricReason.KEY_METRIC) for i in range(4)]
routine = [replace(metric(f"insight:{i}"), reason=HighlightMetricReason.ROUTINE) for i in range(routine_count)]
- popular = replace(metric("popular"), reason=HighlightMetricReason.POPULAR)
highlights.publish_pulse(inputs, HighlightFindings(pulse=tuple(configured)), [])
routine_inputs = replace(inputs, source_name="routine")
- slots = [contracts.PulseSlot(key=m.key, name=m.name, reason=m.reason) for m in [*routine, popular]]
+ slots = [contracts.PulseSlot(key=m.key, name=m.name, reason=m.reason) for m in routine]
highlights.publish_pulse(routine_inputs, HighlightFindings(), slots)
row.refresh_from_db()
self.assertEqual(
[slot.key for slot in HIGHLIGHTS.validate_python(row.content).pulse_slots or []][:routine_count],
[m.key for m in routine],
)
- highlights.publish_pulse(routine_inputs, HighlightFindings(pulse=(*routine, popular)), slots)
+ highlights.publish_pulse(routine_inputs, HighlightFindings(pulse=tuple(routine)), slots)
highlights.finalize(
FinalizeHighlightsInputs(
team_id=self.team.id,
@@ -709,10 +703,7 @@ class TestProgressiveHighlights(BaseTest):
cache.clear()
connect = MagicMock()
connect.return_value.start_workflow = AsyncMock()
- with (
- patch.object(highlights, "progressive_pulse_enabled", return_value=True),
- patch.object(highlights, "sync_connect", connect),
- ):
+ with patch.object(highlights, "sync_connect", connect):
highlights.get_highlights(team=self.team, user=self.user, scopes=None)
rows = TodayHighlights.objects.for_team(self.team.id)
first = rows.get()
@@ -752,7 +743,6 @@ class TestProgressiveHighlights(BaseTest):
[s.status for s in pending.pulse_slots or []], [PulseSlotStatus.READY, PulseSlotStatus.PENDING]
)
self.assertEqual(connect.return_value.start_workflow.call_count, 2)
- self.assertTrue(connect.return_value.start_workflow.call_args.args[1].progressive)
retry_at = timezone.now() + timedelta(seconds=highlights.FAILED_CACHE_SECONDS + 1)
with time_machine.travel(timezone.now() + timedelta(seconds=30), tick=False):
highlights.finalize(
diff --git a/products/today/backend/tests/test_workflows.py b/products/today/backend/tests/test_workflows.py
index 0a2bb63b55c9..ce4dcf321de1 100644
--- a/products/today/backend/tests/test_workflows.py
+++ b/products/today/backend/tests/test_workflows.py
@@ -48,7 +48,6 @@ PINS = [PinnedNumber("insight:a"), PinnedNumber("insight:b", dashboard_id=7)]
@pytest.mark.asyncio
[email protected]("progressive", [False, True])
@pytest.mark.parametrize(
"pins,pins_fail,asked,pinned",
[
@@ -59,7 +58,6 @@ PINS = [PinnedNumber("insight:a"), PinnedNumber("insight:b", dashboard_id=7)]
)
async def test_sources_and_pins_are_resolved_once_and_finalized_together(
environment: WorkflowEnvironment,
- progressive: bool,
pins: list[PinnedNumber],
pins_fail: bool,
asked: list[list[str]],
@@ -70,7 +68,7 @@ async def test_sources_and_pins_are_resolved_once_and_finalized_together(
@activity.defn(name="run_highlight_source_activity")
async def run_source(inputs: HighlightSourceInputs) -> HighlightSourceResult:
- assert inputs.highlights_id == ("h-1" if progressive else None)
+ assert inputs.highlights_id == "h-1"
if inputs.source_name == "broken":
raise ApplicationError("The source query failed.")
return HighlightSourceResult(source_name=inputs.source_name, found="{}", failed=False)
@@ -103,7 +101,6 @@ async def test_sources_and_pins_are_resolved_once_and_finalized_together(
scopes=None,
source_names=["alerts", "broken"],
pins=pins,
- progressive=progressive,
),
id=str(uuid.uuid4()),
task_queue=settings.GENERAL_PURPOSE_TASK_QUEUE,
@@ -169,7 +166,6 @@ async def test_real_activity_publishes_before_the_workflow_finishes(
local_day=day.isoformat(),
scopes=None,
source_names=["routine"],
- progressive=True,
),
id=str(uuid.uuid4()),
task_queue=settings.GENERAL_PURPOSE_TASK_QUEUE,
diff --git a/products/today/frontend/generated/api.schemas.ts b/products/today/frontend/generated/api.schemas.ts
index 502b649c3979..51a61fe9f61f 100644
--- a/products/today/frontend/generated/api.schemas.ts
+++ b/products/today/frontend/generated/api.schemas.ts
@@ -663,7 +663,7 @@ export interface ReportPageApi {
export type TodayHighlightsRetrieveParams = {
/**
- * Retry failed sources when progressive loading is enabled. An active computation is reused.
+ * Retry failed sources. An active computation is reused.
*/
refresh?: boolean
}
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index ff92ee286c78..281801d9c601 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -134129,7 +134129,7 @@ export namespace Schemas {
export type TodayHighlightsRetrieveParams = {
/**
- * Retry failed sources when progressive loading is enabled. An active computation is reused.
+ * Retry failed sources. An active computation is reused.
*/
refresh?: boolean;
};