Skip to content

Conversation

@mohammad-arif662
Copy link
Contributor

@mohammad-arif662 mohammad-arif662 commented Dec 3, 2025

Description

Currently, the simulatorIntegrationExternalId field is required in the response objects for routine, routine revision, and simulation run endpoints. This forces users to bind a routine to a specific connector at creation time.
We want to make simulatorIntegrationExternalId optional in routine/routine revision creation, so users can create routines not tied to a connector. The binding will happen at runtime (simulation run will get the connector assigned at some point).

This PR only makes the field optional in response objects of SimulationRun, SimulatorRoutine, SimulatorRoutineRevision.

Since SimulatorRoutineWrite extends SimulatorRoutineCore (which now accepts str | None), the write class also technically accepts None values. However, the backend API currently still requires this field for write operations, so users should continue to provide it when creating routines. Once the backend supports optional simulatorIntegrationExternalId in writes, we can update the documentation accordingly.

Note: Since simint pysdk is under alpha, we are doing this breaking change.

Changes

  • Changed simulator_integration_external_id: str to simulator_integration_external_id: str | None in SimulationRun, SimulatorRoutineCore, SimulatorRoutineRevision.
  • Changed from resource["simulatorIntegrationExternalId"] to resource.get("simulatorIntegrationExternalId") to safely handle missing or None values.
  • Added unit tests.

Checklist:

  • Tests added/updated.
  • Documentation updated. Documentation is generated from docstrings - these must be updated according to your change.
    If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • The PR title follows the Conventional Commit spec.

@mohammad-arif662 mohammad-arif662 changed the title make simulatorIntegrationExternalId optional on runs, routines and ro… feat(simint): make simulatorIntegrationExternalId optional on runs, routines and routine revisions Dec 3, 2025
@codecov
Copy link

codecov bot commented Dec 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.27%. Comparing base (0aa6dd7) to head (0041543).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2420      +/-   ##
==========================================
- Coverage   91.28%   91.27%   -0.01%     
==========================================
  Files         192      192              
  Lines       26184    26184              
==========================================
- Hits        23901    23900       -1     
- Misses       2283     2284       +1     
Files with missing lines Coverage Δ
...lient/data_classes/simulators/routine_revisions.py 91.41% <ø> (ø)
cognite/client/data_classes/simulators/routines.py 100.00% <ø> (ø)
cognite/client/data_classes/simulators/runs.py 99.02% <ø> (ø)

... and 3 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.

@mohammad-arif662 mohammad-arif662 marked this pull request as ready for review December 4, 2025 06:35
@mohammad-arif662 mohammad-arif662 requested review from a team as code owners December 4, 2025 06:35
@polomani
Copy link
Contributor

polomani commented Dec 4, 2025

you need to put a bit more explanation into the description, as this will be reviewed by pysdk maintainers.
the change is breaking, so you need to explain that we are doing that since the simint pysdk is under alpha

@polomani
Copy link
Contributor

polomani commented Dec 5, 2025

/gemini review

Copy link
Contributor

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

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 modifies the simulator_integration_external_id field across several simulator-related data classes, including SimulatorRoutineRevision, SimulatorRoutine, and SimulationRun. The changes involve updating the type hints for this field from str to str | None in class definitions and __init__ methods, and modifying the _load methods to use resource.get("simulatorIntegrationExternalId") instead of direct dictionary access to gracefully handle cases where the field might be missing. Corresponding unit tests have been added to verify that these classes correctly load instances both with and without the simulator_integration_external_id.

polomani
polomani previously approved these changes Dec 5, 2025
Copy link
Contributor

@polomani polomani left a comment

Choose a reason for hiding this comment

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

The field remains required for write operation (SimulatorRoutineWrite) because the backend logic still requires it. Once the backend supports optional simulatorIntegrationExternalId in write operations, we can update the write classes accordingly.

this sentence is not true, it's stil required on the API but is optional in SDK now

Copy link
Contributor

@haakonvt haakonvt left a comment

Choose a reason for hiding this comment

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

LGTM, just one comment in need of addressing

@doctrino doctrino self-requested a review December 8, 2025 07:20
@haakonvt haakonvt changed the title feat(simint): make simulatorIntegrationExternalId optional on runs, routines and routine revisions feat(simint): make simulator_integration_external_id optional on runs, routines and routine revisions Dec 8, 2025
Copy link
Contributor

@haakonvt haakonvt left a comment

Choose a reason for hiding this comment

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

🦄

@haakonvt haakonvt self-assigned this Dec 8, 2025
@haakonvt haakonvt added waiting-for-risk-review Waiting for a member of the risk review team to take an action risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action and removed waiting-for-risk-review Waiting for a member of the risk review team to take an action labels Dec 8, 2025
@mohammad-arif662 mohammad-arif662 added this pull request to the merge queue Dec 8, 2025
Merged via the queue into master with commit a18702b Dec 8, 2025
41 of 43 checks passed
@mohammad-arif662 mohammad-arif662 deleted the POFSP-1439 branch December 8, 2025 09:10
lpereiracgn added a commit to cognitedata/cognite-sdk-js that referenced this pull request Dec 9, 2025
…es, revisions and runs (#1346)

`simulatorIntegrationExternalId` is a required field at the moment,
which means that it has to be associated with a connector since the
creation of the resource, to make it flexible to decide after creation
which connector can pick it up, we're making that field optional in this
PR.

Ref: cognitedata/cognite-sdk-python#2420
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk-review-ongoing Risk review is in progress waiting-for-team Waiting for the submitter or reviewer of the PR to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants