Skip to content

feat: map octolens mentions from ten platforms per the ingestion spec - #4993

Merged
themarolt merged 19 commits into
mainfrom
feat/issue-748-octolens-source-coverage
Oct 16, 2026
Merged

themarolt merged 19 commits into
mainfrom
feat/issue-748-octolens-source-coverage

Conversation

@themarolt

@themarolt themarolt commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Aligns Octolens mention ingestion with the ingestion spec and extends it to every source with complete data: mentions from GitHub, X/Twitter, LinkedIn, Reddit, dev.to, Hacker News, Bluesky, TikTok, Instagram and YouTube become mention activities, each routed to its keyword's project and nothing else. It also fixes the poll for the live API, where a mention's keywords arrive only in keywords[]; before this, every mention would have been skipped.

Changes

  • Platforms. GitHub, X/Twitter and LinkedIn (the spec), plus Reddit, dev.to (Octolens dev → the existing devto platform), Hacker News, Bluesky, TikTok, Instagram and YouTube: in 2,000 live mentions every one of these carried an id, timestamp, URL and a matching profile link. New platform types bluesky, tiktok and instagram, plus mention activity types and activityTypes rows. Stack Overflow, Medium, Product Hunt and Facebook stay mapped but off behind the mapper's allow-list (Octolens hasn't sent any); podcasts, news, firehose, newsletter and review sites are never emitted because their author is a show or publication. Skipped sources are logged at debug.
  • Identities come from the author's profile link, as in the spec, for every platform: GitHub login, X/Twitter handle, LinkedIn /in/<handle>, Reddit /user/<name>, dev.to /<name>, Hacker News user?id=, Bluesky /profile/<handle>, TikTok /@<handle>, Instagram /<name>, YouTube /channel/<id>. Octolens's author is a display name on LinkedIn and YouTube, so it is not used. The link must point at the mention's own platform; bot links (github.com/apps/…), app routes and malformed handles are skipped (Reddit's [deleted] included). Identities stay verified usernames. Checked against 2,000 live mentions: every person mention on these platforms maps.
  • Activity fields. channel is the Octolens source, sourceId is the Octolens mention id, score is 0, isContribution/isCollaboration stay false. emit keeps a record's own channel when the connector's schema includes one (GitHub connector records are unchanged). Attributes keep the Octolens fields and add octolensSource, postId (the platform's post id), keyword, keywordId and, for GitHub, repoUrl.
  • Routing. A mention is routed by the first keyword in keywords[] that has a mapping. The data sink no longer re-routes GitHub activities from Octolens integrations through public.repositories; their segment always comes from the keyword's project. Every other integration is unchanged.
  • No backfill by default. The first poll starts at the current time, and keywords mapped later are no longer backfilled automatically. The per-keyword backfill queue is still processed when filled; a script to fill it follows separately.
  • Migration V1792094459__add_octolens_mention_activity_types.sql adds the mention rows (false/false, idempotent, the existing twitter row is skipped). Protected path.
  • Tests for the mapper (profile links, allow-list, attributes), the poll (keyword routing, first run, backfill queue) and the data sink opt-out.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Performance improvement
  • Chore / dependency update
  • Documentation

Related issue

Refs linuxfoundation/lfx-cdp-insights-ops#748

Only a leading /r/ names a subreddit, more GitHub site pages (advisories,
security, copilot and others) no longer read as repos, and a mention whose
keywordId is missing from its keywords gets no keyword channel instead of a
different keyword's. The ignored identity platforms log as ignored rather
than unknown.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 08:36
@cursor

cursor Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Touches activity ingestion, segment routing, and DB activity types across many platforms; incorrect identity or routing logic could mis-attribute members or drop mentions, though behavior is heavily tested and Octolens-specific paths are isolated.

Overview
Expands Octolens mention ingestion to ten person-attributed sources (GitHub, X/Twitter, LinkedIn, Reddit, dev.to, Hacker News, Bluesky, TikTok, Instagram, YouTube) with strict profile-link identity parsing, mention activities (score 0, channel = Octolens source, sourceId = mention id), and richer attributes (octolensSource, postId, keyword context, optional repoUrl/subreddit). Unsupported or non-profile sources are skipped; new PlatformType values and an idempotent activityTypes migration back the UI/scoring grids.

Poll and routing: Mentions route via the first mapped keyword in keywords[] (fixes live API shape); first sync starts at now with watermark committed before fetch; automatic unmapped-keyword backfill is removed (manual backfill queue only). The data sink keeps Octolens results on the keyword’s segment by skipping GitHub/GitLab repository segment lookup for PlatformType.OCTOLENS. emit preserves a record’s channel when the connector schema defines it.

Also adds mention display settings for additional platforms, ignores Bluesky/TikTok/Instagram in LFX org-enrichment identities, and broad test coverage for mapper, poll, emit, and sink behavior.

Reviewed by Cursor Bugbot for commit 6feba8e. Bugbot is set up for automated code reviews on this repo. Configure here.

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.

🟡 Changes recommended

Replay deduplication, case-insensitive repository routing, and deleted-author identity handling need correction.

3 open findings
What changed in this PR

Expands Octolens ingestion to additional person-based sources and assigns per-mention channels within CDP.

Changes:

  • Adds platform values, mention activity settings, scores, and database registrations.
  • Maps additional sources, extracts YouTube channel identities, and derives mention channels.
  • Adds mapper and emitter tests while preserving organization-enrichment exclusions.
File Description
services/​libs/​types/​src/​enums/​platforms.ts Adds three platforms.
services/​libs/​integrations/​src/​integrations/​stackoverflow/​types.ts Adds mention type.
services/​libs/​integrations/​src/​integrations/​stackoverflow/​grid.ts Adds mention score.
services/​libs/​integrations/​src/​integrations/​reddit/​types.ts Adds mention type.
services/​libs/​integrations/​src/​integrations/​reddit/​grid.ts Adds mention score.
services/​libs/​integrations/​src/​integrations/​hackernews/​types.ts Adds mention type.
services/​libs/​integrations/​src/​integrations/​hackernews/​grid.ts Adds mention score.
services/​libs/​integrations/​src/​integrations/​devto/​types.ts Adds mention type.
services/​libs/​integrations/​src/​integrations/​devto/​grid.ts Adds mention score.
services/​libs/​integrations/​src/​integrations/​activityTypes.ts Registers mention display settings.
services/​libs/​connectors/​src/​emit.ts Preserves record-level channels.
services/​libs/​connectors/​src/​emit.test.ts Tests channel preservation and fallbacks.
services/​libs/​connectors/​src/​connectors/​octolens/​syncs/​mentionPoll.test.ts Updates unsupported-source fixtures.
services/​libs/​connectors/​src/​connectors/​octolens/​mapper.ts Expands source, identity, and channel mapping.
services/​libs/​connectors/​src/​connectors/​octolens/​mapper.test.ts Tests new mappings and URL handling.
services/​apps/​organizations_enrichment_worker/​src/​sources/​lfx-internal-api/​service.ts Preserves identity-platform exclusions.
backend/​src/​database/​migrations/​V1792094459__add_octolens_mention_activity_types.sql Inserts missing mention activity registrations.

🧠 Review effort: Balanced


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

Comment thread services/libs/connectors/src/connectors/octolens/mapper.ts Outdated
Comment thread services/libs/connectors/src/connectors/octolens/mapper.ts Outdated
Comment thread services/libs/connectors/src/connectors/octolens/mapper.ts
…pository

The data sink resolved every github and gitlab activity's segment through
public.repositories. Activities from an Octolens integration now keep the
segment the connector set from the keyword's project mapping; every other
integration is unchanged.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Only GitHub, X/Twitter and LinkedIn mentions are emitted for now; the other
sources keep their mapping so they can be enabled later. Their identities
come from the author's profile link (LinkedIn's author field is a display
name, and github.com/apps links are bots). The activity's channel is the
Octolens source, its sourceId the Octolens mention id and its score 0;
octolensSource, the post id, the matched keyword, keywordId and a GitHub
repo URL are kept in the attributes.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Live mentions carry their keywords only in keywords[], so the poll skipped
every one waiting for a top-level keywordId. It now routes a mention by its
first mapped keyword. The first run starts at the current time instead of
fetching the whole history, and keywords are no longer queued for backfill
automatically; the backfill queue is left for a manual script.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
A mention is emitted only when its profile link points at the same platform
as its source, X/Twitter non-profile paths and malformed GitHub logins are
not read as usernames, percent-encoded handles are decoded, and a mention
without an Octolens id is skipped instead of sharing one sourceId. A first
run that stops early now keeps its start date, and a backfilled mention is
routed to the keyword being backfilled first.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
@themarolt themarolt changed the title feat: map every person-handle octolens source with a per-mention channel feat: map octolens github, twitter and linkedin mentions per the ingestion spec Oct 16, 2026
Copilot AI balanced review requested due to automatic review settings October 16, 2026 09:45

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.

🟡 Changes recommended

First-run failures can lose mentions, and null provider entries can repeatedly block queued backfills.

2 open findings
3 resolved since last review

🧠 Review effort: Balanced

Comment thread services/libs/connectors/src/connectors/octolens/syncs/mentionPoll.ts Outdated
…l entries

A first run that failed before committing a page left no start date, so the
retry picked a later time and skipped the mentions in between. The cutoff is
now saved before any fetch. Backfill pages now validate each entry's
timestamp too, so a null entry is skipped instead of blocking the page.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 09:52

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.

🔵 Needs a closer look

Unresolved correctness issues and shared ingestion-routing changes warrant code-owner review before deployment.

1 open finding
2 resolved since last review
Previously missed (1)

In code that hasn't changed since last review

Medium severity Reject malformed GitHub logins with trailing or consecutive hyphens

services/​libs/​connectors/​src/​connectors/​octolens/​mapper.ts:207

This regex accepts malformed GitHub logins such as octocat- and octo--cat, although hyphens must be single and between alphanumeric characters. A GitHub author URL containing either value passes profileLinkIdentity and is emitted as a verified username instead of being skipped. Reject trailing and consecutive hyphens while retaining the 39-character limit, and add regression cases for both.

🧠 Review effort: Balanced

Comment thread services/libs/connectors/src/connectors/octolens/syncs/mentionPoll.ts Outdated
A backfill preferred the keyword being backfilled, so a mention mapped
under two keywords could land in a second project when replayed. Both paths
now use the first mapped keyword.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 09:58

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.

🔵 Needs a closer look

Profile validation still accepts malformed GitHub usernames and Twitter application routes as verified identities.

0 open findings

1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Reject GitHub usernames with trailing or consecutive hyphens

services/​libs/​connectors/​src/​connectors/​octolens/​mapper.ts:207

This regex accepts user- and user--name, although GitHub logins cannot end with a hyphen or contain consecutive hyphens. These malformed profile links therefore produce verified username identities instead of being skipped. Require single hyphens between alphanumeric characters, preserve the 39-character limit, and add regression cases for both invalid forms.

Medium severity Exclude X/Twitter application routes from profile identity parsing

services/​libs/​connectors/​src/​connectors/​octolens/​mapper.ts:220

The route filter accepts https://x.com/compose/post, https://twitter.com/login, and https://x.com/signup as verified users named compose, login, and signup. These are application routes, not author profiles, so mentions carrying these links would be attributed to incorrect shared identities. Exclude these routes and add regression cases that expect no identity.

🧠 Review effort: Balanced

…tities

GitHub logins with a trailing or doubled hyphen and X routes such as
/compose, /login and /signup are no longer read as author usernames.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:09
@themarolt

Copy link
Copy Markdown
Contributor Author

Re: Copilot review · findings outside review threads

  • Reject GitHub usernames with trailing or consecutive hyphens · services/libs/connectors/src/connectors/octolens/mapper.ts:207
    Fixed in 4f353d2: logins must be alphanumeric runs joined by single hyphens, up to 39 characters; user- and user--name now yield no identity (regression cases added).
  • Exclude X/Twitter application routes from profile identity parsing · services/libs/connectors/src/connectors/octolens/mapper.ts:220
    Fixed in 4f353d2: compose, login, logout, signup and tos join the excluded routes; x.com/compose/post, twitter.com/login and x.com/signup now yield no identity (regression cases added).

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.

🔵 Needs a closer look

Cross-service identity and routing changes, together with the protected database migration, warrant final code-owner validation.

0 open findings

🧠 Review effort: Balanced

…, instagram and youtube

These sources carry an id, timestamp, URL and a profile link in every live
mention, so they are emitted alongside GitHub, X/Twitter and LinkedIn.
Their identities also come from the profile link (reddit /user, dev.to,
news.ycombinator.com user?id, bsky.app /profile, tiktok @handle, instagram,
youtube /channel), which must belong to the mention's own platform; app
routes and malformed handles are skipped. Octolens's dev source maps to the
existing devto platform. Stack Overflow, Medium, Product Hunt and Facebook
stay mapped but off, since Octolens hasn't sent any.

Refs linuxfoundation/lfx-cdp-insights-ops#748

Signed-off-by: Uroš Marolt <uros@marolt.me>
@themarolt themarolt changed the title feat: map octolens github, twitter and linkedin mentions per the ingestion spec feat: map octolens mentions from ten platforms per the ingestion spec Oct 16, 2026
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:28

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.

🔵 Needs a closer look

The protected migration and shared routing changes need code-owner validation, and identity validation remains unresolved.

1 open finding

🧠 Review effort: Balanced

Comment thread services/libs/connectors/src/connectors/octolens/mapper.ts Outdated
Copilot AI balanced review requested due to automatic review settings October 16, 2026 10:39

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.

🔵 Needs a closer look

Cross-platform verified identities, shared ingestion routing, and the protected migration warrant final code-owner review.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@themarolt
themarolt merged commit 487a237 into main Oct 16, 2026
14 checks passed
@themarolt
themarolt deleted the feat/issue-748-octolens-source-coverage branch October 16, 2026 11:05
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