Repository navigation
feat: run octolens discovery on a schedule with an integration per subproject - #4989
Conversation
The mention poll now resolves each keyword's active mapping across every Octolens subproject integration and emits under that integration and its segment, instead of under the poll's own integration. A keyword mapped under more than one integration is treated as unmapped. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
…bproject Keyword-to-project mapping discovery moves out of the connector's sync units into an hourly connectors_worker Temporal schedule (overlap skip). Each run ensures the segment-less anchor integration and its single mention-poll sync unit, created with emitEnabled so mentions become activities, then writes each mapping under its subproject's Octolens integration, deactivates the mappings it no longer sees and soft-deletes subproject integrations left without keywords. An incomplete Octolens snapshot still writes nothing. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
Without CROWD_OCTOLENS_API_TOKEN the hourly run would create the anchor integration and then fail on every run. It now logs and skips before any write. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
A keyword moving between subprojects was briefly active under both, so a poll in that window treated it as unmapped and queued a needless full backfill. The upserts, deactivation and soft-delete now commit together. Also trims comments to the repo's comment rules. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
…rks again Only provider.auth failures dead-letter a sync unit, and nothing brought the anchor's mention poll back after the token was fixed. Discovery now revives it right after its own Octolens calls succeed with that token. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
Discovery and the mention poll now work across all subproject integrations, so the per-integration find, list and deactivate queries have no callers left. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
…ns-discovery-schedule
…n merge Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
Integration changes are logged only after the reconcile transaction commits, an auth failure is no longer retried within a run, the revive clears the stale auth error, and a missing token logs at info level. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>
PR SummaryMedium Risk Overview Each scheduled run no-ops when Supporting changes: Reviewed by Cursor Bugbot for commit b37bdef. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🔵 Needs a closer look
Live ingestion and automatic integration restoration/deletion warrant human validation, particularly of transactional reconciliation.
1 open finding
What changed in this PR
Moves Octolens mapping discovery to an hourly Temporal schedule, enabling mention ingestion through per-subproject integrations and one shared poll.
Changes:
- Registers discovery scheduling, workflow, and activity.
- Reconciles mappings transactionally and revives dead-lettered polling.
- Removes obsolete discovery dependencies and updates tests.
| File | Description |
|---|---|
| services/libs/data-access-layer/src/octolens/index.ts | Removes unused mapping queries. |
| services/libs/data-access-layer/src/octolens/index.test.ts | Adapts mapping tests. |
| services/libs/data-access-layer/src/connectors/syncUnits.ts | Adds dead-letter revival. |
| services/libs/data-access-layer/src/connectors/syncUnits.test.ts | Tests revival scope and watermark preservation. |
| services/libs/connectors/src/credentials.ts | Adds token configuration check. |
| services/libs/connectors/src/connectors/octolens/syncs/mentionPoll.test.ts | Removes obsolete dependency mocks. |
| services/libs/connectors/src/connectors/octolens/mappingDiscovery.ts | Separates discovery from connector syncs. |
| services/libs/connectors/src/connectors/octolens/mappingDiscovery.test.ts | Updates discovery tests. |
| services/libs/connectors/src/connectors/octolens/index.ts | Removes discovery from manifest. |
| services/libs/connectors/src/connectors/octolens/deps.ts | Separates project resolution from polling dependencies. |
| services/libs/connectors/src/connectors/octolens/deps.test.ts | Updates dependency tests. |
| services/apps/connectors_worker/src/workflows/octolensDiscovery.ts | Defines discovery workflow and retries. |
| services/apps/connectors_worker/src/workflows.ts | Exports discovery workflow. |
| services/apps/connectors_worker/src/schedules/octolensDiscovery.ts | Creates hourly, non-overlapping schedule. |
| services/apps/connectors_worker/src/main.ts | Registers discovery schedule. |
| services/apps/connectors_worker/src/activities/octolensDiscoveryActivities.ts | Provisions polling and reconciles integrations. |
| services/apps/connectors_worker/src/activities/octolensDiscoveryActivities.test.ts | Tests discovery orchestration and guards. |
| services/apps/connectors_worker/src/activities.ts | Exports discovery activity. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The reconcile is now reconcileOctolensKeywordMappings and is tested against the real test database: keyword moves, integration restore and soft-delete, and rollback of every write when a mapping fails partway. The discovery activity only orchestrates and logs. Refs linuxfoundation/lfx-cdp-insights-ops#748 Signed-off-by: Uroš Marolt <uros@marolt.me>

Summary
Runs Octolens keyword-to-project mapping discovery on an hourly connectors_worker Temporal schedule instead of as a connector sync unit, and makes it create the integrations Octolens runs under: one per mapped subproject, plus one segment-less integration that owns the single mention-poll sync unit (Octolens's 500 requests/hour budget is shared org-wide). The mention poll already emits under the subproject integrations (#4988). Once this is deployed with
CROWD_OCTOLENS_API_TOKENset, Octolens mentions start arriving as activities.Changes
octolensDiscoveryworkflow,runOctolensDiscoveryactivity andconnectors-octolens-discoveryschedule (hourly, overlap SKIP, registered inmain.tsnext to the dispatcher and shadow-diff schedules). Each run:CROWD_OCTOLENS_API_TOKENis not set, before any write;mentionPollsync unit withemitEnabled: true(insert-only, so mentions become activities rather than shadow records);mappingDiscoveryis removed from the Octolens manifest and becomes a plain function (octolens/mappingDiscovery.ts). Octolens deps keep only the keyword lookup the poll needs.reviveDeadLetteredSyncUnits; the per-integration mapping queries that no longer have callers are removed.emitEnabled, call order inside the transaction, revive only after Octolens answered), the revive query (DB), and the moved discovery logic.Deployment notes:
CROWD_OCTOLENS_API_TOKENon connectors_worker; without it the schedule runs and skips.mappingDiscoveryunit would fail every hour, so check other environments withSELECT id, "integrationId", "syncName", status FROM integration.sync_units WHERE platform = 'octolens'before deploying there.Type of change
Related issue
Refs linuxfoundation/lfx-cdp-insights-ops#748