Skip to content

feat(integrations): Add Integration Tasks sub-resource - #2829

Draft
vikramlc-cognite wants to merge 1 commit into
integrations-g2-errorsfrom
integrations-g3-tasks
Draft

feat(integrations): Add Integration Tasks sub-resource#2829
vikramlc-cognite wants to merge 1 commit into
integrations-g2-errorsfrom
integrations-g3-tasks

Conversation

@vikramlc-cognite

Copy link
Copy Markdown

Summary

Adds TaskHistory/TaskHistoryList/SyncResult data classes and IntegrationTasksAPI (list_history, sync), wired into the IntegrationsAPI aggregator as self.tasks. Builds on the Errors sub-resource from #2828.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor (no functional change)
  • Documentation update
  • Chore / tooling / CI

What changed

  • New cognite/client/data_classes/integrations/tasks.py: TaskHistory, TaskHistoryList, SyncResult.
  • New cognite/client/_api/integrations/tasks.py: IntegrationTasksAPI.list_history() and .sync() (single-page incremental polling endpoint — caller inspects more_data/next_cursor to continue).
  • Wired self.tasks = IntegrationTasksAPI(...) into the IntegrationsAPI constructor, plus testing.py/doc-accessor updates.
  • Unit tests in tests/tests_unit/test_api/test_integrations/test_tasks.py and a TestSyncResult data-class test, including explicit-null handling for history/errors.

Why it changed

  • Related issue: EDG-827
  • Related docs / discussion: wire schema from cognitedata/service-contracts PR #3378; field-level details (warningCount/fatalCount, sources/targets lineage) confirmed against the local odin service implementation.

What to focus on during review

  • SyncResult depends on IntegrationErrorList from the Errors sub-resource (the /sync endpoint returns both task history and errors together) — this is why Errors had to land before Tasks in this PR stack, not the other way around.
  • list_history() raises ValueError if task_name is given without external_id; sync() raises if neither include_errors nor include_task_updates is set — both have matching Raises: docstring sections and tests.

Test evidence

  • pytest tests/tests_unit/ -q → 6,609 passed, 8 failed (pre-existing, unrelated), 6 skipped
  • python scripts/sync_client_codegen/main.py verify → sync mirrors up to date
  • ruff check / ruff format --check → clean
  • mypy → no issues (545 source files)

Risks and unknowns

  • sync() is not auto-paginated by design (matches the server's incremental-polling contract) — worth double-checking that's the intended usage pattern rather than an oversight.

Rollout and rollback

  • Same beta FeaturePreviewWarning gating as the rest of the module. No migrations. Revert is a straight revert of this commit.

Checklist

  • Self-reviewed the diff
  • Tests added or updated (or N/A with reason)
  • Docs updated (or N/A) — N/A, no public docs page exists yet for this beta API
  • No secrets, credentials, or PII committed
  • Breaking changes called out above and communicated to affected teams — N/A, no breaking changes

Adds TaskHistory/TaskHistoryList/SyncResult data classes and
IntegrationTasksAPI (list_history, sync), wired into the
IntegrationsAPI aggregator as self.tasks.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants