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.

fix(warehouse-sources): floor warehouse parent scans to the API row set (#84360)

Daniel RC7781c764bde7
diff --git a/.agents/skills/implementing-warehouse-sources/SKILL.md b/.agents/skills/implementing-warehouse-sources/SKILL.md
index 6af3f95cdbce..a30395c232f2 100644
--- a/.agents/skills/implementing-warehouse-sources/SKILL.md
+++ b/.agents/skills/implementing-warehouse-sources/SKILL.md
@@ -646,6 +646,7 @@ Requirements and behavior:
- **Stale parents 404.** The warehouse snapshot can contain parents deleted upstream since the parent's last sync; the builder adds a `404 → ignore` response action on the child (custom iterators must skip 404s themselves — see Sentry's `_skip_rows_on_stale_issue_404`).
- **Freshness**: children fan out over the parent's last synced snapshot. Parents created after the parent's last sync appear once the parent re-syncs — same staleness class as independent schedules.
- **Column names**: the reader takes API field names (e.g. `lastSeen`), maps them to the snake_case physical Delta columns, and re-keys rows back to API names. Request only the columns the fan-out needs (`resolve_field` + `include_from_parent`).
+- **The warehouse read must reproduce the API path's effective row set, not just its columns.** The vendor's list endpoint usually windows what it returns (server-side defaults, retention), while an incremental parent table accumulates every row ever seen — an unbounded scan therefore fans out over parents the API path never would. This is measured, not hypothetical: unbounded Sentry children produced 2–4x the rows and 2–6x the run time of the API path on aged snapshots, plus a stale-404 rate that grew with snapshot age. Set `parent_row_filter` on the `DependentEndpointConfig` (`ParentRowFilter(field=..., not_older_than=...)`) to floor the scan; the predicate is pushed into the parquet read, keeps NULL rows, adapts to string or timestamp physical columns, and an unfilterable table falls back to the API path via the eager resolve validation. Leave it unset only when the parent API genuinely returns the full collection. Before opting a source in, establish what the API path's effective window actually is — it is usually invisible in our code because the vendor applies it server-side.
- **Windowed parents must stay windowed.** If the source currently bounds its parent walk by the child watermark (e.g. Github's `_fan_out_get_rows`), a full warehouse read would _increase_ child fan-out — filter the warehouse read to the same window instead.
- **Non-REST sources** (e.g. Stripe's SDK loop) can call `iter_parent_pages_from_warehouse` directly; project any fields their skip-checks inspect (e.g. customer `balance`). Resolve the table with `resolve_parent_table_ref(..., required_columns=[...])` eagerly in `source_for_pipeline` (sync context) — it does an ORM read, and the pipeline's iterator executor threads are the wrong place for ad-hoc DB connections. It also pins the parent's Delta version, so a parent that re-syncs mid-fan-out can't shift the rows underneath the child; pass the returned ref to the reader instead of re-deriving a URI.
- **Catch `WarehouseParentTableNotFoundError` around that resolve call and take the API path.** A schema row can claim a completed sync while its table is unreadable (purged, renamed, or missing the fan-out columns), and the reader is a generator, so anything it validated lazily would raise deep inside the pipeline where no fallback is left. That is why `required_columns` is validated eagerly during resolution. When falling back, also turn off any behavior that only makes sense for a warehouse snapshot (the child's stale-parent `404 → ignore`, and resume checkpoints the warehouse scan skips), so the run matches the feature-off path exactly.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/fanout.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/fanout.py
index e56602bf2451..9aecbe723b9c 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/fanout.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/fanout.py
@@ -13,6 +13,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
Endpoint,
EndpointResource,
IncrementalConfig,
+ ParentRowFilter,
ResponseAction,
)
@@ -45,6 +46,11 @@ class DependentEndpointConfig:
# usable, and falls back to "api" for the run when it isn't — see
# `_warehouse_parent_reuse_available` in `import_data_activity_sync`.
parent_source: Literal["api", "warehouse"] = "api"
+ # Floors a parent_source="warehouse" scan to the API path's effective row set. The snapshot
+ # accumulates every parent row ever synced while the vendor's list endpoint usually windows
+ # what it returns, so an unbounded scan fans out over parents the API path never would.
+ # Leave None only when the parent endpoint genuinely returns the full collection.
+ parent_row_filter: ParentRowFilter | None = None
def required_parents_from_endpoint_configs(endpoint_configs: Mapping[str, Any], schema_name: str) -> list[str]:
@@ -151,6 +157,7 @@ def build_dependent_resource(
parent_name=fanout.parent_name,
required_columns=parent_columns,
schema_name=child_endpoint,
+ row_filter=fanout.parent_row_filter,
)
if parent_table is None:
# Drop back to the API parent entirely, including the snapshot-only 404 handling
@@ -163,6 +170,7 @@ def build_dependent_resource(
columns=parent_columns,
page_size=parent_config.page_size,
schema_name=child_endpoint,
+ row_filter=fanout.parent_row_filter,
)
child_path = child_config.path
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_fanout.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_fanout.py
index d25fae75a326..830db1825b18 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_fanout.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_fanout.py
@@ -1,4 +1,5 @@
-from dataclasses import dataclass
+from dataclasses import dataclass, replace
+from datetime import timedelta
from typing import Any
import pytest
@@ -13,7 +14,10 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
required_parents_from_endpoint_configs,
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import BasePaginator
-from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import ResolvedParam
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import (
+ ParentRowFilter,
+ ResolvedParam,
+)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.warehouse_parent import (
ParentTableRef,
)
@@ -464,6 +468,10 @@ _WAREHOUSE_FANOUT = DependentEndpointConfig(
)
+ "row_filter",
+ [None, ParentRowFilter(field="lastSeen", not_older_than=timedelta(days=90))],
+)
@patch("products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout.rest_api_resources")
@patch(
"products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.warehouse_parent.resolve_parent_table_ref",
@@ -473,14 +481,14 @@ _WAREHOUSE_FANOUT = DependentEndpointConfig(
"products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.warehouse_parent.iter_parent_pages_from_warehouse"
)
def test_warehouse_parent_builds_data_iterator_and_404_ignore(
- mock_reader, mock_resolve, mock_rest_api_resources
+ mock_reader, mock_resolve, mock_rest_api_resources, row_filter
) -> None:
mock_rest_api_resources.return_value = [_stub_child_resource()]
mock_reader.return_value = iter([[{"id": "p1"}]])
build_dependent_resource(
endpoint_configs=_build_endpoint_configs(),
child_endpoint="children",
- fanout=_WAREHOUSE_FANOUT,
+ fanout=replace(_WAREHOUSE_FANOUT, parent_row_filter=row_filter),
client_config={"base_url": "https://example.com"},
path_format_values={},
team_id=1,
@@ -490,9 +498,9 @@ def test_warehouse_parent_builds_data_iterator_and_404_ignore(
use_warehouse_parent=True,
)
- # The URI and columns are resolved eagerly at build time (sync context), not lazily on
- # iteration — a lazy check would raise past the fall-back-to-the-API branch.
- mock_resolve.assert_called_once_with(1, "source-1", "parents", required_columns=["id"])
+ # The URI, columns, and row filter are resolved eagerly at build time (sync context), not
+ # lazily on iteration — a lazy check would raise past the fall-back-to-the-API branch.
+ mock_resolve.assert_called_once_with(1, "source-1", "parents", required_columns=["id"], row_filter=row_filter)
config = mock_rest_api_resources.call_args.args[0]
parent_resource = config["resources"][0]
@@ -508,6 +516,9 @@ def test_warehouse_parent_builds_data_iterator_and_404_ignore(
# Without this the reader's rows-streamed log has no schema, so snapshot drift can't
# be attributed to a child.
schema_name="children",
+ # Without this the scan is unbounded and the child fans out over parents the API
+ # path stopped listing.
+ row_filter=row_filter,
)
assert child_resource["endpoint"]["response_actions"] == [{"status_code": 404, "action": "ignore"}]
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py
index 704baf765d7b..3825002df57d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/tests/test_warehouse_parent.py
@@ -13,6 +13,7 @@ from parameterized import parameterized
from products.warehouse_sources.backend.facade.models import ExternalDataJob, ExternalDataSchema, ExternalDataSource
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import warehouse_parent
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import ParentRowFilter
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.warehouse_parent import (
ParentTableRef,
WarehouseParentTableNotFoundError,
@@ -43,7 +44,7 @@ def _patched_reader(uri: str, version: int | None = None, **kwargs):
)
-def _patched_resolve(uri: str, snapshot_timestamp=None):
+def _patched_resolve(uri: str, snapshot_timestamp=None, row_filter=None):
parent_schema = SimpleNamespace(
id="parent-id", normalized_s3_folder_name="issues", folder_path=lambda: "team_1_sentry_x"
)
@@ -53,7 +54,7 @@ def _patched_resolve(uri: str, snapshot_timestamp=None):
patch.object(warehouse_parent, "delta_storage_options", return_value={}),
patch.object(warehouse_parent, "_snapshot_pin_as_of", return_value=snapshot_timestamp),
):
- return resolve_parent_table_ref(1, "00000000-0000-0000-0000-000000000000", "issues")
+ return resolve_parent_table_ref(1, "00000000-0000-0000-0000-000000000000", "issues", row_filter=row_filter)
def test_resolve_parent_table_ref_raises_when_parent_schema_missing() -> None:
@@ -289,3 +290,63 @@ def test_reader_streams_multiple_fragments(tmp_path: Path) -> None:
rows = sorted(row["id"] for page in pages for row in page)
assert rows == ["1", "2", "3"]
+
+
+def _write_parent_table_with_ages(tmp_path: Path, physical: str) -> str:
+ uri = str(tmp_path / "issues_aged")
+ now = datetime.now(UTC)
+ fresh = now - timedelta(days=5)
+ old = now - timedelta(days=200)
+ last_seen: pa.Array
+ if physical == "string":
+ last_seen = pa.array([fresh.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), old.strftime("%Y-%m-%dT%H:%M:%S.%fZ"), None])
+ elif physical == "timestamp_tz":
+ last_seen = pa.array([fresh, old, None], type=pa.timestamp("us", tz="UTC"))
+ else:
+ last_seen = pa.array([fresh.replace(tzinfo=None), old.replace(tzinfo=None), None], type=pa.timestamp("us"))
+ table = pa.table({"id": ["fresh", "old", "no_signal"], "last_seen": last_seen})
+ deltalake.write_deltalake(uri, table)
+ return uri
+
+
+_LAST_SEEN_FLOOR = ParentRowFilter(field="lastSeen", not_older_than=timedelta(days=90))
+
+
[email protected]("physical", ["string", "timestamp_tz", "timestamp_naive"])
+def test_row_filter_drops_old_rows_and_keeps_null_ones(tmp_path: Path, physical: str) -> None:
+ # The floor must adapt to the column's physical type: the Delta writer stores the API's
+ # ISO string either verbatim or parsed, and prod tables carry the parsed form while the
+ # test fixtures carry strings. NULL keeps the row, matching the tag-values cutoff.
+ uri = _write_parent_table_with_ages(tmp_path, physical)
+
+ pages = _patched_reader(uri, columns=["id"], page_size=10, row_filter=_LAST_SEEN_FLOOR)
+
+ assert {row["id"] for page in pages for row in page} == {"fresh", "no_signal"}
+
+
+def test_row_filter_streams_everything_when_absent(tmp_path: Path) -> None:
+ uri = _write_parent_table_with_ages(tmp_path, "string")
+
+ pages = _patched_reader(uri, columns=["id"], page_size=10)
+
+ assert {row["id"] for page in pages for row in page} == {"fresh", "old", "no_signal"}
+
+
+ "bad_filter,match",
+ [
+ (ParentRowFilter(field="doesNotExist", not_older_than=timedelta(days=90)), "missing requested column"),
+ (ParentRowFilter(field="numComments", not_older_than=timedelta(days=90)), "can't be compared"),
+ ],
+)
+def test_resolve_rejects_unfilterable_tables_so_callers_fall_back(
+ tmp_path: Path, bad_filter: ParentRowFilter, match: str
+) -> None:
+ # The reader is a generator: an unvalidated filter would raise mid-pipeline, past the
+ # API fallback. Resolve must reject a missing column and a physical type with no
+ # defined time ordering while the fallback is still possible.
+ uri = str(tmp_path / "issues_unfilterable")
+ deltalake.write_deltalake(uri, pa.table({"id": ["1"], "num_comments": pa.array([3], type=pa.int64())}))
+
+ with pytest.raises(WarehouseParentTableNotFoundError, match=match):
+ _patched_resolve(uri, row_filter=bad_filter)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/typing.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/typing.py
index 191c89c09acf..60cc525d5a11 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/typing.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/typing.py
@@ -1,9 +1,12 @@
from collections.abc import Callable, Iterator
from dataclasses import dataclass, field
+from datetime import timedelta
from typing import Any, Literal, NotRequired, Optional, TypedDict
from requests import Session
+from posthog.dataclasses import frozen
+
from .auth import (
APIKeyAuth,
AuthConfigBase,
@@ -46,6 +49,22 @@ PaginatorType = Literal[
]
+@frozen
+class ParentRowFilter:
+ """Bounds a warehouse parent scan to rows the parent API would still list.
+
+ The API path's row set is shaped by the vendor's server-side list semantics (default
+ windows, retention), which a full snapshot scan does not reproduce: an incremental
+ parent table accumulates every row ever seen, so children fan out over parents the API
+ stopped listing long ago. `field` is the parent's API field name; rows where it is NULL
+ are kept, matching the per-row cutoff the Sentry tag-values iterator established.
+ Omit the filter only for parents whose API genuinely returns the full collection.
+ """
+
+ field: str
+ not_older_than: timedelta
+
+
class PaginatorTypeConfig(TypedDict, total=True):
type: PaginatorType # noqa
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/warehouse_parent.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/warehouse_parent.py
index 21624286cc80..9236977496f2 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/warehouse_parent.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/rest_source/warehouse_parent.py
@@ -4,8 +4,10 @@ from collections.abc import Generator
from dataclasses import dataclass
from typing import Any
+import pyarrow as pa
import deltalake
import structlog
+import pyarrow.compute as pc
from products.warehouse_sources.backend.models.external_data_job import ExternalDataJob
from products.warehouse_sources.backend.models.external_data_schema import get_schema_if_exists
@@ -18,6 +20,7 @@ from products.warehouse_sources.backend.temporal.data_imports.pipelines.core.del
build_delta_table_uri,
delta_storage_options,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import ParentRowFilter
# Upper bound on rows held in memory per page. Source configs drive page_size for API paging
# semantics; a misconfigured or future large value must not turn into a whole-table page.
@@ -72,8 +75,43 @@ def _physical_columns_by_api_name(
return physical_by_api_name
+def _row_filter_expression(
+ delta_table: "deltalake.DeltaTable", parent_name: str, row_filter: ParentRowFilter
+) -> pc.Expression:
+ """Predicate pushed into the parquet scan so filtered-out parents are never read.
+
+ NULLs are kept: a row without the filter field carries no recency signal, and the
+ tag-values iterator's per-row cutoff (the semantics this reproduces) keeps them too.
+ The cutoff adapts to the column's physical type because the Delta writer may store the
+ API's ISO-8601 string either parsed as a timestamp or verbatim; ISO-8601 UTC strings
+ order lexicographically, so a string floor compares correctly. Any other physical type
+ raises the fallback signal rather than guessing.
+ """
+ physical = _physical_columns_by_api_name(delta_table, parent_name, [row_filter.field])[row_filter.field]
+ field_type = pyarrow_schema_from_arrow_exportable(delta_table.schema()).field(physical).type
+ cutoff = dt.datetime.now(dt.UTC) - row_filter.not_older_than
+
+ cutoff_scalar: pa.Scalar
+ if pa.types.is_timestamp(field_type):
+ cutoff_scalar = pa.scalar(cutoff if field_type.tz is not None else cutoff.replace(tzinfo=None), type=field_type)
+ elif pa.types.is_string(field_type) or pa.types.is_large_string(field_type):
+ cutoff_scalar = pa.scalar(cutoff.strftime("%Y-%m-%dT%H:%M:%S"), type=field_type)
+ else:
+ raise WarehouseParentTableNotFoundError(
+ f"Parent table '{parent_name}' stores filter field '{row_filter.field}' as {field_type}, "
+ f"which can't be compared against a time floor"
+ )
+
+ field_ref = pc.field(physical)
+ return field_ref.is_null() | (field_ref >= cutoff_scalar)
+
+
def resolve_parent_table_ref(
- team_id: int, source_id: str, parent_name: str, required_columns: list[str] | None = None
+ team_id: int,
+ source_id: str,
+ parent_name: str,
+ required_columns: list[str] | None = None,
+ row_filter: ParentRowFilter | None = None,
) -> ParentTableRef:
"""Locate the parent schema row, derive its Delta table URI, and pin the current version.
@@ -126,6 +164,10 @@ def resolve_parent_table_ref(
# Validate eagerly: the reader is a generator, so a missing column would otherwise
# surface deep inside the pipeline, past the caller's fall-back-to-the-API branch.
_physical_columns_by_api_name(delta_table, parent_name, required_columns)
+ if row_filter is not None:
+ # Same eagerness for the filter: the reader rebuilds this expression, but a missing
+ # or unfilterable column must surface while the API fallback is still possible.
+ _row_filter_expression(delta_table, parent_name, row_filter)
return ParentTableRef(uri=uri, version=delta_table.version())
except WarehouseParentTableNotFoundError:
raise
@@ -140,6 +182,7 @@ def try_resolve_parent_table(
parent_name: str,
required_columns: list[str],
schema_name: str,
+ row_filter: ParentRowFilter | None = None,
) -> ParentTableRef | None:
"""Resolve the parent table, or None when this run must read the parent from the API.
@@ -149,7 +192,9 @@ def try_resolve_parent_table(
behavior that only makes sense over a warehouse snapshot.
"""
try:
- return resolve_parent_table_ref(team_id, source_id, parent_name, required_columns=required_columns)
+ return resolve_parent_table_ref(
+ team_id, source_id, parent_name, required_columns=required_columns, row_filter=row_filter
+ )
except WarehouseParentTableNotFoundError:
# Same event name as the run-time gate's fallback log, so one stream covers every
# fallback class.
@@ -228,6 +273,7 @@ def iter_parent_pages_from_warehouse(
columns: list[str],
page_size: int,
schema_name: str,
+ row_filter: ParentRowFilter | None = None,
) -> Generator[list[dict[str, Any]]]:
"""Yield fan-out parent rows from the parent schema's already-synced Delta table.
@@ -257,6 +303,7 @@ def iter_parent_pages_from_warehouse(
page_size = max(1, min(page_size, MAX_PARENT_PAGE_SIZE))
delta_table = deltalake.DeltaTable(table.uri, version=table.version, storage_options=delta_storage_options())
physical_by_api_name = _physical_columns_by_api_name(delta_table, parent_name, columns)
+ scan_filter = None if row_filter is None else _row_filter_expression(delta_table, parent_name, row_filter)
projected = list(dict.fromkeys(physical_by_api_name.values()))
dataset = delta_table.to_pyarrow_dataset()
@@ -265,7 +312,7 @@ def iter_parent_pages_from_warehouse(
outcome = "failed"
try:
page: list[dict[str, Any]] = []
- for batch in dataset.to_batches(columns=projected, batch_size=page_size):
+ for batch in dataset.to_batches(columns=projected, batch_size=page_size, filter=scan_filter):
for row in batch.to_pylist():
page.append({api_name: row.get(physical) for api_name, physical in physical_by_api_name.items()})
rows_streamed += 1
@@ -296,4 +343,5 @@ def iter_parent_pages_from_warehouse(
rows=rows_streamed,
version=table.version,
outcome=outcome,
+ filtered=row_filter is not None,
)
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/settings.py
index 3d9447e7c891..ea2cfbb3dead 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/settings.py
@@ -1,9 +1,11 @@
from dataclasses import dataclass, field
+from datetime import timedelta
from typing import Any, Literal
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout import (
DependentEndpointConfig,
)
+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import ParentRowFilter
from products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType
DEFAULT_SENTRY_API_BASE_URL = "https://sentry.io"
@@ -31,6 +33,11 @@ REQUIRED_SENTRY_SCOPES = (
# carry a floor rather than the 1970 sentinel the issue endpoints tolerate.
SENTRY_RETENTION_DAYS = 90
+# The issues API windows its listing while the synced `issues` table accumulates every issue
+# ever seen, so a warehouse fan-out must floor the scan or it fans out over issues the API
+# path never would. Same floor as the tag-values iterator's per-row cutoff.
+ISSUES_PARENT_ROW_FILTER = ParentRowFilter(field="lastSeen", not_older_than=timedelta(days=SENTRY_RETENTION_DAYS))
+
# `dataset` values accepted by /trace-items/attributes/.
TRACE_ITEM_DATASETS = ("logs", "preprod", "processing_errors", "spans", "tracemetrics")
# `itemType` values accepted by /trace-items/stats/.
@@ -259,6 +266,7 @@ SENTRY_ENDPOINTS: dict[str, SentryEndpointConfig] = {
# full=true makes Sentry return complete event bodies (incl. stacktrace entries).
child_params={"full": "true"},
parent_source="warehouse",
+ parent_row_filter=ISSUES_PARENT_ROW_FILTER,
),
),
"issue_hashes": SentryEndpointConfig(
@@ -278,6 +286,7 @@ SENTRY_ENDPOINTS: dict[str, SentryEndpointConfig] = {
# it as "no hashes for this issue" instead of failing the whole schema.
child_response_actions=[{"status_code": 404, "action": "ignore"}],
parent_source="warehouse",
+ parent_row_filter=ISSUES_PARENT_ROW_FILTER,
),
),
"issue_tag_values": SentryEndpointConfig(
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/tests/test_sentry.py b/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/tests/test_sentry.py
index 3d6ccf21c635..a8626bbc8de6 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/tests/test_sentry.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/sentry/tests/test_sentry.py
@@ -2056,3 +2056,18 @@ class TestWarehouseParentReuse:
kwargs = mock_build.call_args.kwargs
assert kwargs["source_id"] == "source-1"
assert kwargs["use_warehouse_parent"] is True
+
+
+def test_every_warehouse_fanout_child_bounds_its_parent_scan():
+ # The issues API windows its listing server-side, so an unbounded snapshot scan fans out
+ # over issues the API path never would. Any endpoint opting into the warehouse parent
+ # must carry the floor.
+ warehouse_children = {
+ name: config.fanout
+ for name, config in SENTRY_ENDPOINTS.items()
+ if config.fanout is not None and config.fanout.parent_source == "warehouse"
+ }
+ assert warehouse_children, "expected Sentry to have warehouse-mode fan-out children"
+ for name, fanout in warehouse_children.items():
+ assert fanout.parent_row_filter is not None, f"{name} reads its parent unbounded"
+ assert fanout.parent_row_filter.field == "lastSeen"