: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): sync Brex titles, fields and budget programs (#100945)
Tom Owers17b4c361958f
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 31ea561b7d7f..594fb40f4436 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -965,7 +965,7 @@ Note: BreezoMeter is now Google Maps Platform: the connector calls airquality.go## Brex — gaps-Today (13): `budgets`, `card_accounts`, `card_transactions`, `cards`, `cash_accounts`, `cash_transactions`, `departments`, `expenses`, `locations`, `spend_limits`, `transfers`, `users`, `vendors`+Today (17): `budget_programs`, `budgets`, `card_accounts`, `card_transactions`, `cards`, `cash_accounts`, `cash_transactions`, `departments`, `expenses`, `field_values`, `fields`, `locations`, `spend_limits`, `titles`, `transfers`, `users`, `vendors`Diffed against: <https://developer.brex.com/llms.txt>@@ -974,15 +974,27 @@ Diffed against: <https://developer.brex.com/llms.txt>- [x] `GET /v1/transfers (Payments API)` — outbound bill-pay/ACH/wire transactions, entirely absent from card and cash transactions (high)- [x] `GET /v2/spend_limits (Budgets API v2)` — the limit objects budgets and cards are governed by; budgets alone do not show spend controls (high)- [ ] `GET /v3/accounting/records (Accounting API)` — the accounting ledger export — how finance teams reconcile Brex spend to the GL (high)-- [ ] `GET /v1/fields and GET /v1/fields/{field_id}/values (Fields API)` — lookup resolving the custom field ids/values tagged on expenses and transactions (medium)-- [ ] `GET /v2/titles (Team API)` — lookup resolving the title id on users, alongside the departments and locations already synced (medium)-- [ ] `GET /v1/budget_programs (Budgets API)` — lookup grouping the budgets already synced into programs (medium)+- [x] `GET /v1/fields and GET /v1/fields/{field_id}/values (Fields API)` — lookup resolving the custom field ids/values tagged on expenses and transactions (medium)+- [x] `GET /v2/titles (Team API)` — lookup resolving the title id on users, alongside the departments and locations already synced (medium)+- [x] `GET /v1/budget_programs (Budgets API)` — lookup grouping the budgets already synced into programs (medium)- [ ] `GET /v1/trips and GET /v1/trips/{trip_id}/bookings (Travel API)` — travel spend and per-booking line items, not derivable from card transactions (medium)- [ ] `GET /v2/accounts/card/primary/statements and GET /v2/accounts/cash/{id}/statements` — period-end statement balances for reconciliation against transactions (medium)- [ ] `GET /v1/linked_accounts (Payments API)` — lookup resolving the external bank accounts transfers move money to and from (medium)- [ ] `GET /v2/legal_entities (Team API)` — lookup for multi-entity companies, needed to split spend by entity (low)-Note: developer.brex.com serves an SPA (the openapi.json URLs return HTML), but the llms.txt index plus the per-API markdown mirrors (e.g. https://developer.brex.com/openapi/team\_api.md) list every operation with its literal path. Brex ships nine APIs — Accounting, Budgets, Expenses, Fields, Onboarding, Payments, Team, Transactions, Travel — and the connector covers pieces of only four. The connector now also exposes /v2/accounts/cash as its own table, alongside the fan-out it already drove.+Note: developer.brex.com serves an SPA (the openapi.json URLs return HTML), but the llms.txt index plus the per-API markdown mirrors (e.g. https://developer.brex.com/openapi/team\_api.md) list every operation with its literal path. Brex ships ten APIs — Accounting, Budgets, Expenses, Fields, Onboarding, Payments, Team, Transactions, Travel, Webhooks — and the connector covers pieces of six. The connector now also exposes /v2/accounts/cash as its own table, alongside the fan-out it already drove.++`GET /v3/accounting/records` is left unticked on purpose. The whole Accounting API is gated+Alpha: its own overview states "To access the Accounting Alpha API, please email[email protected] to express your interest. Please note that participation is determined+by Brex based on program needs." A table nearly every connected account would get a 403 on, whose+1.0.0-alpha response contract is expected to change, is not shippable yet — its receipt objects+also carry 15-minute presigned S3 download URLs, which would land expiring credentials in the+warehouse. Revisit when Brex promotes the API out of Alpha. The Fields API is Beta by contrast,+but explicitly "available for use. Customers do not need to explicitly opt-in", so /v1/fields is+fine to sync today. /v1/fields/{field_id}/values is a fan-out over /v1/fields, keyed on+(field_id, brex_id) because Brex documents no uniqueness for brex_id across fields. Every+endpoint added here is full refresh: none of the four accepts a server-side timestamp filter.## Browserbase — **thin**diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/brex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/brex.pyindex 9f2da3e8ceb2..eb0befcfc82d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/brex.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/brex.py@@ -5,6 +5,7 @@ from typing import Any, Optionalfrom products.warehouse_sources.backend.temporal.data_imports.sources.brex.settings import (BREX_ENDPOINTS,BrexEndpointConfig,+ BrexFanOutConfig,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_sessionfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (@@ -12,12 +13,16 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.resrest_api_resource,rest_api_resources,)+from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.fanout import (+ rename_parent_fields,+)from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.paginators import (JSONResponseCursorPaginator,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source.typing import (ClientConfig,Endpoint,+ EndpointResource,)from products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.source_helpers import validate_via_probe@@ -35,18 +40,8 @@ BREX_API_VERSION_V2 = "v2"# Expenses caps `limit` at 100; other endpoints don't document a max, so 100 is used uniformly.PAGE_SIZE = 100-CASH_ACCOUNTS_PATH = "/v2/accounts/cash"-# Injected into cash transaction rows so rows from different cash accounts stay distinguishable.-CASH_ACCOUNT_ID_KEY = "account_id"-# Parent resource name in the cash-transactions fan-out config — also the name of the-# standalone cash accounts table, since both page the same endpoint. With include_from_parent=["id"]-# the framework injects the parent account id into child rows as `_cash_accounts_id`; a data_map-# renames it to the `account_id` key the rows carried before the rest_source migration.-_CASH_ACCOUNTS_PARENT = "cash_accounts"-_PARENT_ACCOUNT_ID_KEY = f"_{_CASH_ACCOUNTS_PARENT}_id"-[email protected](frozen=True)class BrexResumeConfig:# Pre-framework fields, kept so previously saved state still parses (dataclass(**saved)).# `next_cursor` of the last fully-yielded page for the endpoint (or current cash account).@@ -55,7 +50,7 @@ class BrexResumeConfig:account_id: Optional[str] = None# Cash accounts already fully synced in this run.completed_account_ids: list[str] = dataclasses.field(default_factory=list)- # Framework fan-out checkpoint for cash_transactions+ # Framework fan-out checkpoint# ({"completed": [child_path, ...], "current": child_path | None, "child_state": {...} | None}).fanout_state: Optional[dict[str, Any]] = None@@ -120,21 +115,22 @@ def _endpoint_config(config: BrexEndpointConfig, path: str, should_use_incrementreturn endpoint-def _inject_account_id(row: dict[str, Any]) -> dict[str, Any]:- row[CASH_ACCOUNT_ID_KEY] = row.pop(_PARENT_ACCOUNT_ID_KEY)- return row---def _fanout_initial_state(config: BrexEndpointConfig, resume: BrexResumeConfig) -> Optional[dict[str, Any]]:+def _fanout_initial_state(+ config: BrexEndpointConfig, fan_out: BrexFanOutConfig, resume: BrexResumeConfig+) -> Optional[dict[str, Any]]:if resume.fanout_state is not None:return resume.fanout_state- # Translate pre-framework resume state (account ids + cursor) into the framework's- # fan-out checkpoint shape (resolved child paths).+ # Translate pre-framework cash-transactions resume state (account ids + cursor) into the+ # framework's fan-out checkpoint shape (resolved child paths).if not (resume.completed_account_ids or resume.account_id):return None- current = config.path.format(account_id=resume.account_id) if resume.account_id else None++ def child_path(parent_id: str) -> str:+ return config.path.format(**{fan_out.resolve_param: parent_id})++ current = child_path(resume.account_id) if resume.account_id else Nonereturn {- "completed": [config.path.format(account_id=account_id) for account_id in resume.completed_account_ids],+ "completed": [child_path(account_id) for account_id in resume.completed_account_ids],"current": current,"child_state": {"cursor": resume.cursor} if resume.cursor is not None and current is not None else None,}@@ -157,42 +153,49 @@ def brex_source(if resumable_source_manager.can_resume():resume = resumable_source_manager.load_state()- if config.fan_out_cash_accounts:- initial_state = _fanout_initial_state(config, resume) if resume is not None else None+ if config.fan_out is not None:+ fan_out = config.fan_out+ parent_config = BREX_ENDPOINTS[fan_out.parent_name]+ initial_state = _fanout_initial_state(config, fan_out, resume) if resume is not None else Nonedef save_fanout_checkpoint(state: Optional[dict[str, Any]]) -> None:if state is not None:resumable_source_manager.save_state(BrexResumeConfig(fanout_state=state))+ child_resource: EndpointResource = {+ "name": endpoint,+ "endpoint": {+ **_endpoint_config(config, path, should_use_incremental_field),+ "params": {+ "limit": PAGE_SIZE,+ fan_out.resolve_param: {+ "type": "resolve",+ "resource": fan_out.parent_name,+ "field": fan_out.parent_field,+ },+ },+ # Set explicitly because a child path that ends in the resolved placeholder+ # would otherwise be treated as a single-entity endpoint (SinglePagePaginator).+ # Every parent's child list is cursor-paged like the top-level endpoints.+ "paginator": _paginator(),+ },+ }+ if fan_out.parent_field_renames:+ # include_from_parent injects each parent field as `_<parent>_<field>`; the data_map+ # renames it to the key the child rows are expected to carry.+ child_resource["include_from_parent"] = list(fan_out.parent_field_renames)+ child_resource["data_map"] = rename_parent_fields(fan_out.parent_name, fan_out.parent_field_renames)+rest_config: RESTAPIConfig = {"client": _client_config(api_key),"resources": [{- "name": _CASH_ACCOUNTS_PARENT,+ "name": fan_out.parent_name,"endpoint": _endpoint_config(- BREX_ENDPOINTS[_CASH_ACCOUNTS_PARENT], CASH_ACCOUNTS_PATH, should_use_incremental_field=False+ parent_config, _resolve_path(parent_config, api_version), should_use_incremental_field=False),},- {- "name": endpoint,- "endpoint": {- **_endpoint_config(config, path, should_use_incremental_field),- "params": {- "limit": PAGE_SIZE,- "account_id": {- "type": "resolve",- "resource": _CASH_ACCOUNTS_PARENT,- "field": "id",- },- },- # The path ends in `{account_id}`, which the framework would otherwise- # treat as a single-entity endpoint (SinglePagePaginator) — each- # account's transaction list is cursor-paged like everything else.- "paginator": _paginator(),- },- "include_from_parent": ["id"],- "data_map": _inject_account_id,- },+ child_resource,],}resources = {diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.pyindex 418682733713..d24884f1df7d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/canonical_descriptions.py@@ -112,6 +112,14 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"description": "Description of the location.",},},+ "titles": {+ "description": "A job title defined in the Brex account. Resolves the title id carried on users.",+ "docs_url": "https://developer.brex.com/openapi/team_api/#tag/Titles/operation/listTitles",+ "columns": {+ "id": "Unique identifier of the title.",+ "name": "Name of the title.",+ },+ },"cards": {"description": "A Brex card issued to a user or vendor, with its spend controls. Resolves the card_id carried on card transactions.","docs_url": "https://developer.brex.com/openapi/team_api/#tag/Cards/operation/listCardsByUserId",@@ -133,6 +141,31 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"created_at": "Time at which the card was created.",},},+ "fields": {+ "description": "A custom field defined in the Brex account, selectable on expenses and transactions to categorize spend. Brex currently supports single-select dropdown fields only.",+ "docs_url": "https://developer.brex.com/openapi/fields_api/#tag/Fields/operation/listFields",+ "columns": {+ "brex_id": "Internal Brex identifier of the field, and the id referenced by field values.",+ "name": "Name of the field.",+ "remote_id": "Identifier of the field in the external ERP or HRIS system it is synced with.",+ "group": "Purpose of the field: ACCOUNTING, USER, ERP, or TRAVEL.",+ "is_disabled": "Whether the field is disabled. A disabled field cannot be applied to new transactions, but records already referencing it are unaffected.",+ "updated_at": "Time at which the field was last updated.",+ },+ },+ "field_values": {+ "description": "A selectable value of a Brex custom field. Resolves the field value ids tagged on expenses and transactions.",+ "docs_url": "https://developer.brex.com/openapi/fields_api/#tag/Field-Values/operation/listFieldValues",+ "columns": {+ "brex_id": "Internal Brex identifier of the field value.",+ "field_id": "Identifier of the parent field this value belongs to.",+ "value": "Display name of the field value.",+ "value_id": "Value code of the field value, usually its unique identifier in the remote system.",+ "remote_id": "Identifier of the field value in the external ERP or HRIS system it is synced with.",+ "is_disabled": "Whether the field value is disabled. A disabled value cannot be chosen on new transactions, but records already using it are unaffected.",+ "updated_at": "Time at which the field value was last updated.",+ },+ },"vendors": {"description": "A vendor (payee) configured in Brex for bill payments.","docs_url": "https://developer.brex.com/openapi/payments_api/#tag/Vendors/operation/listVendors",@@ -178,6 +211,22 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"period_type": "Recurrence period of the budget (e.g. MONTHLY, QUARTERLY, YEARLY, ONE_TIME).",},},+ "budget_programs": {+ "description": "A budget program in Brex: the template that groups budgets and provisions spend limits for the employees matching its filter.",+ "docs_url": "https://developer.brex.com/openapi/budgets_api/#tag/Budget-Programs/operation/listBudgetPrograms",+ "columns": {+ "id": "Unique identifier of the budget program.",+ "name": "Name of the budget program.",+ "description": "Description of the budget program.",+ "budget_blueprints": "Templates the program provisions spend limits from, each with its own limit, period and visibility settings.",+ "existing_budget_ids": "Identifiers of the spend limits already provisioned by this program.",+ "employee_filter": "Employment status and type a user must match to fall under the program.",+ "budget_program_status": "Status of the program (BUDGET_PROGRAM_STATUS_ACTIVE, BUDGET_PROGRAM_STATUS_INACTIVE, or BUDGET_PROGRAM_STATUS_DELETED).",+ "creator_user_id": "Identifier of the user who created the program.",+ "created_at": "Time at which the program was created.",+ "updated_at": "Time at which the program was last updated.",+ },+ },"spend_limits": {"description": "A spend limit in Brex — the control that caps what a budget or card can spend over a period.","docs_url": "https://developer.brex.com/openapi/budgets_api/#tag/Spend-Limits-v2/operation/listSpendLimits",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.pyindex 92a27da23b98..105b5a1c334e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/settings.py@@ -4,6 +4,20 @@ from typing import Optionalfrom products.warehouse_sources.backend.types import IncrementalField, IncrementalFieldType+@dataclass(frozen=True)+class BrexFanOutConfig:+ """Pages a child endpoint once per row of a parent endpoint that is also its own table."""++ # Endpoint name of the parent, whose `path` is paged to drive the fan-out.+ parent_name: str+ # Placeholder in the child's `path`, bound from `parent_field` on each parent row.+ resolve_param: str+ parent_field: str+ # Parent field -> the key it lands under on child rows. Empty when the child response+ # already carries the parent identifier, so nothing needs injecting.+ parent_field_renames: dict[str, str] = field(default_factory=dict)++@dataclass(frozen=True)class BrexEndpointConfig:name: str@@ -15,9 +29,9 @@ class BrexEndpointConfig:# Stable datetime field used for partitioning. Never an updated_at-style field, which# would rewrite partitions on every sync.partition_key: Optional[str] = None- # When True, the endpoint is paged once per cash account listed from /v2/accounts/cash,- # with `{account_id}` in the path resolved per account.- fan_out_cash_accounts: bool = False+ # Set when the endpoint is paged once per row of a parent endpoint, with the parent's+ # identifier resolved into the child `path`.+ fan_out: Optional[BrexFanOutConfig] = None# Response envelope key holding the rows. None when the endpoint returns a bare JSON array.data_selector: Optional[str] = "items"# False for the endpoints Brex documents no `cursor`/`limit` params on — the whole@@ -62,7 +76,12 @@ BREX_ENDPOINTS: dict[str, BrexEndpointConfig] = {primary_keys=["account_id", "id"],incremental_param="posted_at_start",partition_key="posted_at_date",- fan_out_cash_accounts=True,+ fan_out=BrexFanOutConfig(+ parent_name="cash_accounts",+ resolve_param="account_id",+ parent_field="id",+ parent_field_renames={"id": "account_id"},+ ),incremental_fields=[{"label": "posted_at_date",@@ -112,12 +131,36 @@ BREX_ENDPOINTS: dict[str, BrexEndpointConfig] = {name="locations",path="/v2/locations",),+ "titles": BrexEndpointConfig(+ name="titles",+ path="/v2/titles",+ ),"cards": BrexEndpointConfig(name="cards",path="/v2/cards",# `user_id` is an optional filter; omitting it lists every card on the account.partition_key="created_at",),+ "fields": BrexEndpointConfig(+ name="fields",+ path="/v1/fields",+ # The Fields API keys both fields and field values on `brex_id`, not `id`.+ primary_keys=["brex_id"],+ # No partition key: `updated_at` is the only datetime on the field object, and it+ # moves whenever the field is edited.+ ),+ "field_values": BrexEndpointConfig(+ name="field_values",+ path="/v1/fields/{field_id}/values",+ # Brex documents no uniqueness for `brex_id` across fields, so the parent field id is+ # part of the key. Field value rows already carry `field_id`, so nothing is injected.+ primary_keys=["field_id", "brex_id"],+ fan_out=BrexFanOutConfig(+ parent_name="fields",+ resolve_param="field_id",+ parent_field="brex_id",+ ),+ ),"vendors": BrexEndpointConfig(name="vendors",path="/v1/vendors",@@ -132,6 +175,11 @@ BREX_ENDPOINTS: dict[str, BrexEndpointConfig] = {path="/v2/budgets",primary_keys=["budget_id"],),+ "budget_programs": BrexEndpointConfig(+ name="budget_programs",+ path="/v1/budget_programs",+ partition_key="created_at",+ ),"spend_limits": BrexEndpointConfig(name="spend_limits",path="/v2/spend_limits",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.pyindex 7ba0c8ba4b4b..d42478126379 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/source.py@@ -73,7 +73,7 @@ class BrexSource(ResumableSource[BrexSourceConfig, BrexResumeConfig]):label="Brex",caption="""Enter your Brex API user token to pull your Brex data into the PostHog Data warehouse.-You can create a token in your [Brex dashboard](https://dashboard.brex.com/settings/developer) under Settings → Developer. Grant read access to the data you want to sync: Transactions and Accounts (card and cash transactions, card and cash accounts), Expenses, Team (users, departments, locations, cards), Payments (vendors, transfers), and Budgets (budgets, spend limits).+You can create a token in your [Brex dashboard](https://dashboard.brex.com/settings/developer) under Settings → Developer. Grant read access to the data you want to sync: Transactions and Accounts (card and cash transactions, card and cash accounts), Expenses, Team (users, departments, locations, titles, cards), Payments (vendors, transfers), Budgets (budgets, budget programs, spend limits), and Fields (custom fields and their values).Note: Brex tokens expire after 90 days without API activity, so a token that hasn't been used recently may need to be regenerated.""",iconPath="/static/services/brex.png",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.pyindex ae596c7e7f03..81fc134001b8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/brex/tests/test_brex.py@@ -243,7 +243,19 @@ class TestGetRows:@pytest.mark.parametrize("endpoint",- ["users", "departments", "locations", "cards", "vendors", "transfers", "budgets", "spend_limits"],+ [+ "users",+ "departments",+ "locations",+ "titles",+ "cards",+ "fields",+ "vendors",+ "transfers",+ "budgets",+ "budget_programs",+ "spend_limits",+ ],)@mock.patch(CLIENT_SESSION_PATCH)def test_incremental_value_ignored_for_full_refresh_endpoints(self, MockSession, endpoint):@@ -529,6 +541,47 @@ class TestGetRowsCashFanOut:assert snapshots[1]["params"]["posted_at_start"] == "2024-01-02T00:00:00Z"+class TestGetRowsFieldValuesFanOut:+ @mock.patch(CLIENT_SESSION_PATCH)+ def test_fans_out_over_fields_resolving_brex_id(self, MockSession):+ session = MockSession.return_value+ snapshots = _wire(+ session,+ [+ _response(_page([{"brex_id": "ef_1"}, {"brex_id": "ef_2"}], None)),+ _response(_page([{"brex_id": "efo_1", "field_id": "ef_1", "value": "Marketing"}], None)),+ _response(_page([{"brex_id": "efo_2", "field_id": "ef_2", "value": "R&D"}], None)),+ ],+ )++ rows = _rows(_source("field_values", _make_manager()))++ assert [(row["brex_id"], row["field_id"]) for row in rows] == [("efo_1", "ef_1"), ("efo_2", "ef_2")]+ urls = [snapshot["url"] for snapshot in snapshots]+ assert urls == [+ "https://api.brex.com/v1/fields",+ "https://api.brex.com/v1/fields/ef_1/values",+ "https://api.brex.com/v1/fields/ef_2/values",+ ]++ @mock.patch(CLIENT_SESSION_PATCH)+ def test_no_parent_field_is_injected(self, MockSession):+ # Field value rows already carry field_id, so nothing is included from the parent.+ # An include_from_parent here would add a stray `_fields_brex_id` column.+ session = MockSession.return_value+ _wire(+ session,+ [+ _response(_page([{"brex_id": "ef_1"}], None)),+ _response(_page([{"brex_id": "efo_1", "field_id": "ef_1"}], None)),+ ],+ )++ rows = _rows(_source("field_values", _make_manager()))++ assert rows == [{"brex_id": "efo_1", "field_id": "ef_1"}]++@mock.patch(CLIENT_SESSION_PATCH)class TestBrexSourceResponse:@pytest.mark.parametrize("endpoint", list(ENDPOINTS))@@ -574,13 +627,18 @@ class TestPathResolution:"endpoint, expected_path",[("users", "/v2/users"),+ ("titles", "/v2/titles"),("cards", "/v2/cards"),+ ("fields", "/v1/fields"),+ ("field_values", "/v1/fields/{field_id}/values"),("expenses", "/v1/expenses"),("card_accounts", "/v2/accounts/card"),("cash_accounts", "/v2/accounts/cash"),("vendors", "/v1/vendors"),("transfers", "/v1/transfers"),("budgets", "/v2/budgets"),+ # Brex keeps budget programs on v1 while budgets themselves moved to v2.+ ("budget_programs", "/v1/budget_programs"),("spend_limits", "/v2/spend_limits"),],)