Skip to content

feat(connectors-sdk): expose live stream recovery params in BaseStreamConnectorConfig (#7590) - #7694

Merged
Thibaut Rouxel (throuxel) merged 1 commit into
masterfrom
feat/7590/connectors-sdk-stream-recovery-params
Sep 17, 2026
Merged

Thibaut Rouxel (throuxel) merged 1 commit into
masterfrom
feat/7590/connectors-sdk-stream-recovery-params

Conversation

@throuxel

@throuxel Thibaut Rouxel (throuxel) commented Sep 15, 2026

Copy link
Copy Markdown
Member

Proposed changes

  • Expose the stream "recovery mode" in BaseStreamConnectorConfig so it is generated in every SDK-based stream connector's config schema (previously only settable via raw env vars, invisible in the UI / XTM Composer). New fields:
    • live_stream_start_timestamp (int) — stream position to start from, as epoch milliseconds; a field_validator enforces 13 digits so a seconds value raises a ValidationError instead of silently replaying the whole stream from the beginning.
    • live_stream_recover (bool, default true) — whether to replay historical events (recover/backfill) on first start. Enabled by default (current behaviour: full backfill up to now). Set to false to only process new events.
    • live_stream_recover_iso_date (date-time) — optional cutoff date up to which history is replayed when recover is enabled.
  • Keep the generated schema UI-friendly: three single-typed properties (integer / boolean / string+date-time), no anyOf.
  • Bridge to pycti via a scoped serializer: when serializing for the helper, live_stream_recover=false maps live_stream_recover_iso_date to the none keyword pycti expects (disables ?recover=); otherwise the date (or nothing) is passed through. Non-pycti dumps keep the raw values (fidelity / round-trip safe).
  • Add unit tests (defaults, seconds-timestamp rejection, recover-off -> none, date serialization, schema exposure).

Related issues

Checklist

  • I consider the submitted work as finished
  • I have signed my commits using GPG key.
  • I tested the code for its functionality using different use cases
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality

Further comments

These variables are read directly by pycti (opencti_connector_helper.py) but were not declared in the SDK, so they were absent from the auto-generated connector_config_schema.json. They are only applied on a connector's first run (empty state); afterwards start_from / recover_until are persisted in the connector state.

The config schemas of SDK-based stream connectors are intentionally not regenerated here — the CI regenerates them.

Copilot AI 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.

Pull request overview

This PR exposes live-stream recovery settings in the SDK base configuration with validation and pycti-specific serialization.

Changes:

  • Adds recovery timestamp and ISO date fields.
  • Validates millisecond timestamps.
  • Adds serialization, default, rejection, and schema tests.

Review findings:

  • Critical (3 votes): Preserve existing no and none recovery sentinels.
  • Nit (2 votes): Add coverage for True serialization returning None.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Summary
connectors-sdk/tests/test_settings/test_base_settings.py Tests recovery defaults, validation, serialization, and schema exposure.
connectors-sdk/connectors_sdk/settings/base_settings.py Defines and validates recovery configuration fields and serialization.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread connectors-sdk/connectors_sdk/settings/base_settings.py Outdated
Comment thread connectors-sdk/connectors_sdk/settings/base_settings.py Outdated
@throuxel
Thibaut Rouxel (throuxel) force-pushed the feat/7590/connectors-sdk-stream-recovery-params branch from 94dcb50 to 0d7bc27 Compare September 15, 2026 13:06
@throuxel
Thibaut Rouxel (throuxel) force-pushed the feat/7590/connectors-sdk-stream-recovery-params branch from 0d7bc27 to 2c824f0 Compare September 15, 2026 13:11
@throuxel Thibaut Rouxel (throuxel) added filigran team Item from the Filigran team. connectors-sdk Linked to connectors-sdk. labels Sep 15, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thibaut Rouxel (@throuxel) All good to me, thanks !

@throuxel
Thibaut Rouxel (throuxel) added this pull request to the merge queue Sep 17, 2026
Merged via the queue into master with commit 7ff4a63 Sep 17, 2026
211 checks passed
@throuxel
Thibaut Rouxel (throuxel) deleted the feat/7590/connectors-sdk-stream-recovery-params branch September 17, 2026 07:53
Helene Nguyen (helene-nguyen) pushed a commit to helene-nguyen/opencti-connectors that referenced this pull request Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connectors-sdk Linked to connectors-sdk. filigran team Item from the Filigran team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(connectors-sdk): expose live stream recovery params in BaseStreamConnectorConfig

4 participants