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.

feat(warehouse_sources): add HiBob payroll, employer, and skills tables (#113231)

Tom Owers0ede9df6d675
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.md
index ce50399ebf68..d059fb72fe60 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
@@ -4060,7 +4060,7 @@ Note: learn.hex.tech renders the reference client-side from Docusaurus; the oper
## HiBob — **thin**
-Today (10): `applications`, `candidates`, `employee_employment`, `employee_lifecycle`, `employee_salaries`, `employees`, `named_lists`, `tasks`, `time_off_calendars`, `time_off_request_changes`
+Today (20): `applications`, `candidates`, `employee_deductions`, `employee_dependents`, `employee_employment`, `employee_entitlements`, `employee_equities`, `employee_lifecycle`, `employee_right_to_work`, `employee_salaries`, `employee_variable_pay`, `employees`, `employers`, `named_lists`, `skill_proficiency_levels`, `skills`, `tasks`, `time_off_calendars`, `time_off_request_changes`, `work_locations`
Diffed against: <https://apidocs.hibob.com/reference/get_tasks>
@@ -4077,6 +4077,9 @@ Diffed against: <https://apidocs.hibob.com/reference/get_tasks>
- [ ] `GET /payroll/history` — payroll runs over time, plus POST /people/actual-payments/search (medium)
- [ ] `POST /goals/goals/search` — goals and key results with progress, including /goals/goals/key-results/search (medium)
- [ ] `GET /timeoff/policies and /timeoff/policy-types` — lookup tables resolving the policy ids on time off requests (medium)
+- [x] `GET /bulk/people/deduction`, `/entitlement`, `/variable`, `/dependents`, `/right-to-work` and `/equities` — bulk reads of the payroll and other employee tables, announced in the vendor changelog (medium). Added as `employee_deductions`, `employee_entitlements`, `employee_variable_pay`, `employee_dependents`, `employee_right_to_work` and `employee_equities`, full refresh like the other bulk history tables.
+- [x] `POST /employers/search` and `POST /employers/{employerId}/work-locations/search` — employer legal entities and their work locations from the Employer API (medium). Added as `employers` and `work_locations`; work locations fan out over employer ids, full refresh.
+- [x] `POST /skills/search` and `GET /skills/proficiency-levels` — the Skills API catalog and its proficiency levels lookup (low). Added as `skills` and `skill_proficiency_levels`, full refresh. The search only returns skills created through the Public API.
Note: PostHog exposes only employees (POST /v1/people/search) and tasks (GET /v1/tasks) from a very large HR API — the reference nav on apidocs.hibob.com lists roughly 190 operations across people, time off, attendance, hiring, goals, job catalog, payroll, documents and workforce planning. Endpoints are static in hibob/settings.py with no dynamic table discovery. Note most read endpoints are POST /...\/search rather than GET, which the implementation will need to handle.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/canonical_descriptions.py
index 14f6f2f341a8..b55c6c24c7e0 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/canonical_descriptions.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/canonical_descriptions.py
@@ -116,6 +116,117 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"customColumns": "Values of any custom columns defined on the table.",
},
},
+ "employee_deductions": {
+ "description": "One row per entry in each employee's deduction table: the history of payroll deductions such as childcare vouchers or health insurance. An employee can have several deduction types in effect at once, each with its own timeline.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-deduction",
+ "columns": {
+ "employeeId": "Identifier of the employee the entry belongs to.",
+ "id": "Identifier of the deduction entry, unique within the employee's deduction table.",
+ "deduction": "The deduction type name (e.g. Childcare vouchers).",
+ "amount": "The deduction amount and its currency.",
+ "effectiveDate": "The date this entry becomes effective.",
+ "endEffectiveDate": "The date this entry stopped being effective, when a later entry or the end of the timeline replaced it.",
+ "endDate": "An optional explicit end date for this deduction period.",
+ "isCurrent": "True when this is the entry currently in effect for its deduction type.",
+ "canBeDeleted": "Whether Bob allows this entry to be deleted.",
+ "change": "Details of the last change and the ID of the user who updated this entry.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
+ "employee_entitlements": {
+ "description": "One row per entry in each employee's entitlement table: the history of payroll entitlements. An employee can have several entitlement types in effect at once, each with its own timeline.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-entitlement",
+ "columns": {
+ "employeeId": "Identifier of the employee the entry belongs to.",
+ "id": "Identifier of the entitlement entry, unique within the employee's entitlement table.",
+ "entitlement": "The entitlement type name.",
+ "amount": "The entitlement amount and its currency.",
+ "effectiveDate": "The date this entry becomes effective.",
+ "endEffectiveDate": "The date this entry stopped being effective, when a later entry or the end of the timeline replaced it.",
+ "endDate": "An optional explicit end date for this entitlement period.",
+ "isCurrent": "True when this is the entry currently in effect for its entitlement type.",
+ "canBeDeleted": "Whether Bob allows this entry to be deleted.",
+ "change": "Details of the last change and the ID of the user who updated this entry.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
+ "employee_variable_pay": {
+ "description": "One row per entry in each employee's variable pay table: the history of bonuses and commissions. An employee can have several variable pay types in effect at once.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-variable",
+ "columns": {
+ "employeeId": "Identifier of the employee the entry belongs to.",
+ "id": "Identifier of the variable pay entry, unique within the employee's variable pay table.",
+ "variableType": "The type of variable pay: Bonus, ExecutiveBonus, or Commission.",
+ "paymentPeriod": "The period this entry covers: Annual, Half-Yearly, Quarterly, or Monthly.",
+ "payoutType": "How the variable pay is expressed. Only amount is supported.",
+ "amount": "The variable pay amount and its currency.",
+ "companyPercent": "The employee's company on-target weight, in percent.",
+ "departmentPercent": "The employee's department on-target weight, in percent.",
+ "individualPercent": "The employee's individual on-target weight, in percent.",
+ "effectiveDate": "The date this entry becomes effective.",
+ "endEffectiveDate": "For entries that are no longer active, the date this entry stopped being effective.",
+ "endDate": "The date the variable pay ends.",
+ "isCurrent": "True when this is the entry currently in effect.",
+ "creationDate": "The date this entry was created.",
+ "modificationDate": "The date this entry was last modified.",
+ "change": "Details of the last change and the ID of the user who updated this entry.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
+ "employee_dependents": {
+ "description": "One row per dependent in each employee's dependents table (shown as Children or Dependents in Bob).",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-dependents",
+ "columns": {
+ "employeeId": "Identifier of the employee the dependent belongs to.",
+ "id": "Identifier of the dependent entry, unique within the employee's dependents table.",
+ "firstName": "The dependent's first name.",
+ "surname": "The dependent's surname (last name).",
+ "birthDate": "The dependent's date of birth.",
+ "gender": "The dependent's gender, as stored in Bob.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
+ "employee_right_to_work": {
+ "description": "One row per document in each employee's right to work table, such as a visa or work permit.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-right-to-work",
+ "columns": {
+ "employeeId": "Identifier of the employee the entry belongs to.",
+ "id": "Identifier of the right to work entry, unique within the employee's right to work table.",
+ "type": "The right to work document type, as a list value stored in Bob.",
+ "documentId": "Identifier of the document attached to this entry.",
+ "number": "The document or permit number.",
+ "issuedBy": "The authority that issued the document.",
+ "validFrom": "The date the document becomes valid.",
+ "expirationDate": "The date the document expires.",
+ "applicationDate": "The date the document was applied for.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
+ "employee_equities": {
+ "description": "One row per equity grant in each employee's equity table.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_bulk-people-equities",
+ "columns": {
+ "employeeId": "Identifier of the employee the grant belongs to.",
+ "id": "Identifier of the equity entry, unique within the employee's equity table.",
+ "equityType": "The type of the grant.",
+ "quantity": "The number of equities granted.",
+ "grantDate": "The date the equity was granted.",
+ "grantType": "The grant type: Initial Grant or Merit Grant.",
+ "grantStatus": "The grant status: Granted or Pending Approval.",
+ "grantNumber": "The grant number for the employee.",
+ "grantAmount": "The total grant amount and its currency.",
+ "exercisePrice": "The exercise price for the grant and its currency.",
+ "vestingCommencementDate": "The date vesting starts.",
+ "vestingSchedule": "Identifier of the vesting schedule assigned to the grant.",
+ "vestingTerm": "The terms for exercising the grant.",
+ "optionExpiration": "The date the options expire.",
+ "taxPlan": "The tax plan associated with the grant.",
+ "specialTerms": "Special terms associated with the grant.",
+ "consentNumber": "The consent number.",
+ "change": "Details of the last change to this entry.",
+ "customColumns": "Values of any custom columns defined on the table, keyed by column id.",
+ },
+ },
"candidates": {
"description": "A candidate in Bob Hiring, with their contact details, background, and the job openings they applied to.",
"docs_url": "https://apidocs.hibob.com/reference/post_hiring-candidates-search",
@@ -188,4 +299,80 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {
"parentId": "Identifier of the parent item in a nested list, or null for a top-level item.",
},
},
+ "employers": {
+ "description": "An employer (legal entity) defined in Bob's company settings, with its registration, tax, contact, and address details.",
+ "docs_url": "https://apidocs.hibob.com/reference/post_employers-search",
+ "columns": {
+ "id": "Unique identifier of the employer.",
+ "legalName": "The employer's registered legal name.",
+ "contactName": "Identifier of the employee who is the employer's primary contact.",
+ "employerPhoneNumber": "The employer's contact phone number.",
+ "employerEmailAddress": "The employer's contact email address.",
+ "doingBusinessAs": "The name a US employer trades under, when it differs from its legal name.",
+ "tradingAs": "The name a UK employer trades under, when it differs from its legal name.",
+ "companiesHouseRegistration": "UK Companies House registration number.",
+ "supportsRemoteWorkers": "Whether the employer supports remote workers.",
+ "addressLine1": "First line of the employer's registered address.",
+ "addressLine2": "Second line of the employer's registered address.",
+ "postalCode": "Postal or ZIP code of the employer's registered address.",
+ "city": "City of the employer's registered address.",
+ "stateProvinceRegion": "State, province, or region of the employer's registered address.",
+ "country": "Country of the employer's registered address, as a country display name.",
+ "fein": "US Federal Employer Identification Number.",
+ "payeReference": "UK PAYE reference.",
+ "taxIdentifier": "Local tax identifier, for employers outside the US and UK.",
+ "naics": "US North American Industry Classification System (NAICS) code.",
+ "accountsOfficeReference": "UK Accounts Office reference.",
+ "organizationType": "Organization type, for employers outside the US.",
+ "taxPayerType": "Taxpayer type, for US employers.",
+ "employerStatus": "Lifecycle status of the employer: active or inactive.",
+ "payrollValidationStatus": "Payroll validation status of the employer.",
+ "validationStatusReason": "Reason for the current payroll validation status, when present.",
+ },
+ },
+ "work_locations": {
+ "description": "A work location that belongs to an employer in Bob, either a shared office or a remote location.",
+ "docs_url": "https://apidocs.hibob.com/reference/post_employers-employerid-work-locations-search",
+ "columns": {
+ "id": "Identifier of the work location.",
+ "employerId": "Identifier of the employer the work location belongs to.",
+ "name": "Display name of the work location.",
+ "type": "Work location type: Public (a shared office) or Remote.",
+ "country": "Country of the work location, as a country display name.",
+ "addressLine1": "First line of the work location's address.",
+ "addressLine2": "Second line of the work location's address.",
+ "postalCode": "Postal or ZIP code of the work location's address.",
+ "city": "City of the work location's address.",
+ "stateProvinceRegion": "State, province, or region of the work location's address.",
+ "status": "Lifecycle status of the work location: Active or Inactive.",
+ "verificationStatus": "Verification status of the work location (e.g. Verified, Pending, NotVerified).",
+ "verificationReason": "Reason for the current verification status, when present.",
+ "createdAt": "Timestamp the work location was created.",
+ "createdBy": "Identifier of the employee who created the work location.",
+ },
+ },
+ "skills": {
+ "description": "A skill in Bob's skills catalog that was created through the Public API. Skills created in the Bob UI are not included.",
+ "docs_url": "https://apidocs.hibob.com/reference/post_skills-search",
+ "columns": {
+ "id": "Bob's identifier for the skill.",
+ "name": "Display name of the skill.",
+ "description": "Free-text description of the skill.",
+ "status": "Lifecycle status of the skill: draft, active, or inactive.",
+ "categoryName": "Display name of the skill's category.",
+ "source": "The external source system that owns the skill.",
+ "externalId": "Identifier of the skill in the external source system.",
+ "proficiencyLevels": "Per-level descriptions of the skill, each referencing a proficiency level id.",
+ "createdAt": "Timestamp the skill was created.",
+ },
+ },
+ "skill_proficiency_levels": {
+ "description": "The company's proficiency levels, the lookup table that resolves the proficiency level ids on skills.",
+ "docs_url": "https://apidocs.hibob.com/reference/get_skills-proficiency-levels",
+ "columns": {
+ "id": "Identifier of the proficiency level.",
+ "name": "Display name of the proficiency level.",
+ "order": "Position of the level in the company's proficiency scale.",
+ },
+ },
}
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/hibob.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/hibob.py
index 5355bfc6c125..2077bffb27b8 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/hibob.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/hibob.py
@@ -1,6 +1,7 @@
from collections.abc import Callable, Iterable, Iterator
from datetime import UTC, datetime, timedelta
from typing import Any
+from urllib.parse import quote
from products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_session
from products.warehouse_sources.backend.temporal.data_imports.sources.common.rest_source import (
@@ -15,9 +16,12 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.res
)
from products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse
from products.warehouse_sources.backend.temporal.data_imports.sources.hibob.settings import (
+ BULK_PAGE_LIMIT,
+ EMPLOYERS,
HIBOB_ENDPOINTS,
NAMED_LISTS,
TIME_OFF_CALENDARS,
+ WORK_LOCATIONS,
HiBobEndpointConfig,
)
@@ -185,6 +189,51 @@ def _named_lists_rows(
yield rows
+def _iter_search_pages(session: Any, path: str, body: dict[str, Any]) -> Iterator[list[dict[str, Any]]]:
+ cursor: str | None = None
+ while True:
+ page_body = {**body, "cursor": cursor} if cursor else body
+ response = session.post(f"{HIBOB_BASE_URL}{path}", json=page_body, timeout=REQUEST_TIMEOUT_SECONDS)
+ response.raise_for_status()
+ data = response.json()
+
+ items = data.get("items", [])
+ if items:
+ yield items
+
+ next_cursor = (data.get("response_metadata") or {}).get("next_cursor")
+ if next_cursor and next_cursor == cursor:
+ raise ValueError(f"HiBob returned a repeated cursor for {path}")
+ if not next_cursor:
+ break
+ cursor = next_cursor
+
+
+def _work_locations_rows(
+ service_user_id: str, service_user_token: str, config: HiBobEndpointConfig
+) -> Iterator[list[dict[str, Any]]]:
+ # Work locations are only searchable per employer, so list the employer ids first.
+ session = make_tracked_session(redact_values=(service_user_token,))
+ session.auth = (service_user_id, service_user_token)
+ try:
+ employer_ids = [
+ str(employer["/employer/id"])
+ for page in _iter_search_pages(
+ session,
+ HIBOB_ENDPOINTS[EMPLOYERS].path,
+ {"fields": ["/employer/id"], "filters": [], "limit": BULK_PAGE_LIMIT},
+ )
+ for employer in page
+ if employer.get("/employer/id") is not None
+ ]
+ for employer_id in employer_ids:
+ path = config.path.format(employerId=quote(employer_id, safe=""))
+ for page in _iter_search_pages(session, path, config.body or {}):
+ yield _leaf_keys_page(page)
+ finally:
+ session.close()
+
+
def _since(days_ago: int) -> str:
return (datetime.now(UTC) - timedelta(days=days_ago)).isoformat(timespec="milliseconds").replace("+00:00", "Z")
@@ -218,6 +267,16 @@ def hibob_source(
sort_mode="asc",
)
+ if endpoint == WORK_LOCATIONS:
+ return SourceResponse(
+ name=endpoint,
+ items=lambda: _work_locations_rows(service_user_id, service_user_token, config),
+ primary_keys=list(config.primary_keys),
+ partition_count=1,
+ partition_size=1,
+ sort_mode="asc",
+ )
+
# Basic auth carries the token; supplying it via the framework auth config redacts the
# token from any raised error. Repeated 401/403s trip HiBob's WAF, so auth errors must
# fail loud (raise_for_status) rather than retry — the client only retries 429/5xx.
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/settings.py
index 3dbb9e9ea949..cf095fc22758 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/settings.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/settings.py
@@ -27,7 +27,7 @@ class HiBobEndpointConfig:
# Max page size the cursor-paginated bulk tables and hiring searches accept.
BULK_PAGE_LIMIT = 200
-# History entry ids are only documented as unique within one employee's table.
+# Table entry ids are only documented as unique within one employee's table.
HISTORY_PRIMARY_KEYS = ("employeeId", "id")
CANDIDATE_FIELDS = (
@@ -131,6 +131,64 @@ APPLICATION_FIELDS = (
"/application/modificationDate",
)
+EMPLOYER_FIELDS = (
+ "/employer/id",
+ "/employer/legalName",
+ "/employer/contactName",
+ "/employer/employerPhoneNumber",
+ "/employer/employerEmailAddress",
+ "/employer/doingBusinessAs",
+ "/employer/tradingAs",
+ "/employer/companiesHouseRegistration",
+ "/employer/supportsRemoteWorkers",
+ "/employer/addressLine1",
+ "/employer/addressLine2",
+ "/employer/postalCode",
+ "/employer/city",
+ "/employer/stateProvinceRegion",
+ "/employer/country",
+ "/employer/fein",
+ "/employer/payeReference",
+ "/employer/taxIdentifier",
+ "/employer/naics",
+ "/employer/accountsOfficeReference",
+ "/employer/organizationType",
+ "/employer/taxPayerType",
+ "/employer/employerStatus",
+ "/employer/payrollValidationStatus",
+ "/employer/validationStatusReason",
+)
+
+WORK_LOCATION_FIELDS = (
+ "/workLocation/id",
+ "/workLocation/employerId",
+ "/workLocation/name",
+ "/workLocation/type",
+ "/workLocation/country",
+ "/workLocation/addressLine1",
+ "/workLocation/addressLine2",
+ "/workLocation/postalCode",
+ "/workLocation/city",
+ "/workLocation/stateProvinceRegion",
+ "/workLocation/status",
+ "/workLocation/verificationStatus",
+ "/workLocation/verificationReason",
+ "/workLocation/createdAt",
+ "/workLocation/createdBy",
+)
+
+SKILL_FIELDS = (
+ "/skill/id",
+ "/skill/name",
+ "/skill/description",
+ "/skill/status",
+ "/skill/categoryName",
+ "/skill/source",
+ "/skill/externalId",
+ "/skill/proficiencyLevels",
+ "/skill/createdAt",
+)
+
# The time off changes endpoint rejects a `since` older than six months; 180 days
# always falls inside that.
TIME_OFF_CHANGES_LOOKBACK_DAYS = 180
@@ -145,6 +203,12 @@ TIME_OFF_CALENDARS = "time_off_calendars"
# they are flattened by bespoke transport — routed by name in hibob.py.
NAMED_LISTS = "named_lists"
+EMPLOYERS = "employers"
+
+# Work locations are searched per employer, so the stream fans out over employer
+# ids — routed by name in hibob.py.
+WORK_LOCATIONS = "work_locations"
+
# HiBob has no updated-at filter on employees (Airbyte is full-refresh only and
# Fivetran re-imports most tables every sync), so every stream is an honest
# full refresh. The time off changes endpoint has a `since` param but its rows
@@ -201,6 +265,60 @@ HIBOB_ENDPOINTS: dict[str, HiBobEndpointConfig] = {
cursor_location="query",
row_shape="employee_history",
),
+ "employee_deductions": HiBobEndpointConfig(
+ name="employee_deductions",
+ path="/v1/bulk/people/deduction",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
+ "employee_entitlements": HiBobEndpointConfig(
+ name="employee_entitlements",
+ path="/v1/bulk/people/entitlement",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
+ "employee_variable_pay": HiBobEndpointConfig(
+ name="employee_variable_pay",
+ path="/v1/bulk/people/variable",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
+ "employee_dependents": HiBobEndpointConfig(
+ name="employee_dependents",
+ path="/v1/bulk/people/dependents",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
+ "employee_right_to_work": HiBobEndpointConfig(
+ name="employee_right_to_work",
+ path="/v1/bulk/people/right-to-work",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
+ "employee_equities": HiBobEndpointConfig(
+ name="employee_equities",
+ path="/v1/bulk/people/equities",
+ data_key="results",
+ params={"limit": BULK_PAGE_LIMIT},
+ primary_keys=HISTORY_PRIMARY_KEYS,
+ cursor_location="query",
+ row_shape="employee_history",
+ ),
"candidates": HiBobEndpointConfig(
name="candidates",
path="/v1/hiring/candidates/search",
@@ -239,6 +357,41 @@ HIBOB_ENDPOINTS: dict[str, HiBobEndpointConfig] = {
# Item ids are only documented as internal ids, so scope them to their list.
primary_keys=("listName", "id"),
),
+ EMPLOYERS: HiBobEndpointConfig(
+ name=EMPLOYERS,
+ path="/v1/employers/search",
+ data_key="items",
+ method="POST",
+ body={"fields": list(EMPLOYER_FIELDS), "filters": [], "limit": BULK_PAGE_LIMIT},
+ cursor_location="json",
+ row_shape="pointer_keys",
+ ),
+ WORK_LOCATIONS: HiBobEndpointConfig(
+ name=WORK_LOCATIONS,
+ path="/v1/employers/{employerId}/work-locations/search",
+ data_key="items",
+ method="POST",
+ body={"fields": list(WORK_LOCATION_FIELDS), "filters": [], "limit": BULK_PAGE_LIMIT},
+ # Work locations are read through their employer, so scope the id to it.
+ primary_keys=("employerId", "id"),
+ cursor_location="json",
+ row_shape="pointer_keys",
+ ),
+ "skills": HiBobEndpointConfig(
+ name="skills",
+ path="/v1/skills/search",
+ data_key="items",
+ method="POST",
+ # Without `fields` the search returns only a default subset.
+ body={"fields": list(SKILL_FIELDS), "filters": [], "limit": BULK_PAGE_LIMIT},
+ cursor_location="json",
+ row_shape="pointer_keys",
+ ),
+ "skill_proficiency_levels": HiBobEndpointConfig(
+ name="skill_proficiency_levels",
+ path="/v1/skills/proficiency-levels",
+ data_key="items",
+ ),
}
ENDPOINTS = tuple(HIBOB_ENDPOINTS.keys())
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/tests/test_hibob.py b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/tests/test_hibob.py
index d808bd60fc4a..218a0e7c3b2d 100644
--- a/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/tests/test_hibob.py
+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/hibob/tests/test_hibob.py
@@ -147,6 +147,12 @@ class TestEmployeeHistoryTables:
("employee_lifecycle", "/v1/bulk/people/lifecycle"),
("employee_employment", "/v1/bulk/people/employment"),
("employee_salaries", "/v1/bulk/people/salaries"),
+ ("employee_deductions", "/v1/bulk/people/deduction"),
+ ("employee_entitlements", "/v1/bulk/people/entitlement"),
+ ("employee_variable_pay", "/v1/bulk/people/variable"),
+ ("employee_dependents", "/v1/bulk/people/dependents"),
+ ("employee_right_to_work", "/v1/bulk/people/right-to-work"),
+ ("employee_equities", "/v1/bulk/people/equities"),
],
)
@pytest.mark.parametrize(
@@ -211,16 +217,21 @@ class TestEmployeeHistoryTables:
_rows(hibob_source("service-id", "token", "employee_lifecycle", team_id=1, job_id="j"))
-class TestHiringSearches:
+class TestSearchEndpoints:
@pytest.mark.parametrize(
- "endpoint, path, prefix",
+ "endpoint, path, prefix, requested_field",
[
- ("candidates", "/v1/hiring/candidates/search", "/candidate"),
- ("applications", "/v1/hiring/applications/search", "/application"),
+ ("candidates", "/v1/hiring/candidates/search", "/candidate", "/candidate/modificationDate"),
+ ("applications", "/v1/hiring/applications/search", "/application", "/application/modificationDate"),
+ ("employers", "/v1/employers/search", "/employer", "/employer/legalName"),
+ # The default skill field set leaves proficiency levels out.
+ ("skills", "/v1/skills/search", "/skill", "/skill/proficiencyLevels"),
],
)
@mock.patch(CLIENT_SESSION_PATCH)
- def test_posts_body_cursor_and_normalizes_pointer_keys(self, MockSession, endpoint, path, prefix) -> None:
+ def test_posts_body_cursor_and_normalizes_pointer_keys(
+ self, MockSession, endpoint, path, prefix, requested_field
+ ) -> None:
session = MockSession.return_value
captured = _wire(
session,
@@ -240,7 +251,7 @@ class TestHiringSearches:
assert rows == [{"id": 7, "status": "active"}, {"id": 8}]
assert [(c["method"], c["url"]) for c in captured] == [("POST", f"https://api.hibob.com{path}")] * 2
assert "cursor" not in captured[0]["json"]
- assert f"{prefix}/modificationDate" in captured[0]["json"]["fields"]
+ assert requested_field in captured[0]["json"]["fields"]
# HiBob rejects a search asking for more than 50 fields.
assert len(captured[0]["json"]["fields"]) <= 50
assert captured[1]["json"]["cursor"] == "c2"
@@ -432,6 +443,62 @@ class TestTimeOffCalendars:
_rows(hibob_source("service-id", "token", "time_off_calendars", team_id=1, job_id="j"))
+class TestWorkLocations:
+ @mock.patch(HIBOB_SESSION_PATCH)
+ def test_fans_out_employer_ids_and_follows_cursor(self, mock_make_session):
+ session = mock_make_session.return_value
+ session.post.side_effect = [
+ _response({"items": [{"/employer/id": "11"}], "response_metadata": {"next_cursor": "e2"}}),
+ _response({"items": [{"/employer/id": "12"}], "response_metadata": {"next_cursor": None}}),
+ _response(
+ {
+ "items": [{"/workLocation/id": "1", "/workLocation/employerId": "11", "/workLocation/name": "HQ"}],
+ "response_metadata": {"next_cursor": "w2"},
+ }
+ ),
+ _response(
+ {
+ "items": [
+ {"/workLocation/id": "2", "/workLocation/employerId": "11", "/workLocation/name": "Home"}
+ ],
+ "response_metadata": {"next_cursor": None},
+ }
+ ),
+ _response({"items": [], "response_metadata": {"next_cursor": None}}),
+ ]
+
+ response = hibob_source("service-id", "token", "work_locations", team_id=1, job_id="j")
+ rows = _rows(response)
+
+ assert rows == [
+ {"id": "1", "employerId": "11", "name": "HQ"},
+ {"id": "2", "employerId": "11", "name": "Home"},
+ ]
+ assert response.primary_keys == ["employerId", "id"]
+ calls = session.post.call_args_list
+ assert [call.args[0] for call in calls] == [
+ "https://api.hibob.com/v1/employers/search",
+ "https://api.hibob.com/v1/employers/search",
+ "https://api.hibob.com/v1/employers/11/work-locations/search",
+ "https://api.hibob.com/v1/employers/11/work-locations/search",
+ "https://api.hibob.com/v1/employers/12/work-locations/search",
+ ]
+ assert calls[1].kwargs["json"]["cursor"] == "e2"
+ assert "cursor" not in calls[2].kwargs["json"]
+ assert calls[3].kwargs["json"]["cursor"] == "w2"
+ assert "cursor" not in calls[4].kwargs["json"]
+ assert calls[2].kwargs["json"]["filters"] == []
+
+ @mock.patch(HIBOB_SESSION_PATCH)
+ def test_rejects_repeated_cursor(self, mock_make_session):
+ session = mock_make_session.return_value
+ stalled = {"items": [{"/employer/id": "11"}], "response_metadata": {"next_cursor": "stalled"}}
+ session.post.side_effect = [_response(stalled), _response(stalled)]
+
+ with pytest.raises(ValueError, match="repeated cursor"):
+ _rows(hibob_source("service-id", "token", "work_locations", team_id=1, job_id="j"))
+
+
class TestHiBobSourceResponse:
@pytest.mark.parametrize("endpoint", list(ENDPOINTS))
@mock.patch(CLIENT_SESSION_PATCH)