Skip to content

feat(integrations): Add Integrations API data classes - #2819

Open
vikramlc-cognite wants to merge 1 commit into
masterfrom
integrations-part1-data-classes
Open

feat(integrations): Add Integrations API data classes#2819
vikramlc-cognite wants to merge 1 commit into
masterfrom
integrations-part1-data-classes

Conversation

@vikramlc-cognite

Copy link
Copy Markdown

Summary

Adds the data classes for the new Integrations API (Integration, Task, Extractor, Action, ConfigRevision, IntegrationError, TaskHistory, SyncResult) with load/dump round-trip tests. No API client or SDK wiring yet - the classes are not reachable from CogniteClient until the follow-up PR lands.

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 package cognite/client/data_classes/integrations/ with integrations.py, actions.py, config.py, errors.py, tasks.py, and an __init__.py that re-exports everything with an explicit __all__ (not re-exported from the top-level data_classes/__init__.py, matching the simulators alpha-module precedent).
  • Integration/IntegrationWrite/IntegrationList/IntegrationUpdate (external-id-keyed, standard set/set_null/metadata add-remove update pattern), Extractor, Task.
  • Action/ActionWrite/ActionList for the remote-command sub-resource.
  • ConfigRevision/ConfigRevisionWrite/ConfigRevisionMetadata for versioned config.
  • IntegrationError/IntegrationErrorList and TaskHistory/TaskHistoryList/SyncResult for error reporting and task history.
  • All list classes use ExternalIDTransformerMixin - this API has no internal numeric id, everything is keyed by external ID only.
  • 13 new unit tests in tests/tests_unit/test_data_classes/test_integrations.py covering load/dump round-trips for every class, including explicit-null handling for tasks/history/errors.

Why it changed

  • Related issue: EDG-827

What to focus on during review

  • ActiveConfigRevision: TypeAlias = int | Literal["local"] in integrations.py - shared by tasks.py/errors.py and by checkin.py in the PR that follows this one.
  • Integration.__init__ guarantees self.tasks = tasks or [] (never None), and _load/dump explicitly handle the server sending JSON null for tasks (not just an absent key) - see test_load_with_explicit_null_tasks.

Test evidence

  • pytest tests/tests_unit/test_data_classes/test_integrations.py -q → 13 passed
  • ruff check / ruff format --check → clean
  • mypy (via poetry run dmypy run -- cognite tests) → no issues

Risks and unknowns

  • These classes are not yet wired into any client - they're inert until the next PR. Reviewing this PR in isolation means judging shapes/types without seeing how they're used; the API layer PR follows immediately after.

Rollout and rollback

  • No migrations, no config changes. Purely additive new files; 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 alpha/beta API
  • No secrets, credentials, or PII committed
  • Breaking changes called out above and communicated to affected teams - N/A, no breaking changes

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.84615% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.14%. Comparing base (298b46c) to head (b248f28).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
cognite/client/data_classes/integrations/config.py 79.48% 8 Missing ⚠️
...e/client/data_classes/integrations/integrations.py 92.00% 8 Missing ⚠️
...ognite/client/data_classes/integrations/actions.py 89.74% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2819      +/-   ##
==========================================
- Coverage   93.15%   93.14%   -0.01%     
==========================================
  Files         516      523       +7     
  Lines       53665    54012     +347     
==========================================
+ Hits        49993    50311     +318     
- Misses       3672     3701      +29     
Files with missing lines Coverage Δ
...gnite/client/data_classes/integrations/__init__.py 100.00% <100.00%> (ø)
cognite/client/data_classes/integrations/errors.py 100.00% <100.00%> (ø)
cognite/client/data_classes/integrations/tasks.py 100.00% <100.00%> (ø)
.../tests_unit/test_data_classes/test_integrations.py 100.00% <100.00%> (ø)
...ognite/client/data_classes/integrations/actions.py 89.74% <89.74%> (ø)
cognite/client/data_classes/integrations/config.py 79.48% <79.48%> (ø)
...e/client/data_classes/integrations/integrations.py 92.00% <92.00%> (ø)

... and 5 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces data classes and unit tests for the integrations feature, including actions, configurations, errors, integrations, and tasks. The feedback highlights multiple violations of the style guide where redundant load/dump round-trip tests were written for subclasses of CogniteResource and CogniteUpdate. These tests should be removed or replaced with specific tests such as as_write, as load/dump functionality is already tested automatically.

Comment thread tests/tests_unit/test_data_classes/test_integrations.py
Comment thread tests/tests_unit/test_data_classes/test_integrations.py
Comment thread tests/tests_unit/test_data_classes/test_integrations.py
Comment thread tests/tests_unit/test_data_classes/test_integrations.py
Comment thread tests/tests_unit/test_data_classes/test_integrations.py
Adds the data classes for the new Integrations API (Integration, Task,
Extractor, Action, ConfigRevision, IntegrationError, TaskHistory,
SyncResult) with load/dump round-trip tests. No API client or SDK
wiring yet — that follows in a subsequent PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@vikramlc-cognite
vikramlc-cognite force-pushed the integrations-part1-data-classes branch from b248f28 to efafae0 Compare September 7, 2026 12:50
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