Skip to content

fix: read the git-activity Tinybird token from CROWD_PACKAGES_TB_TOKEN (CM-1824) - #4893

Merged
mbani01 merged 2 commits into
mainfrom
feat/packages-tb-token
Oct 8, 2026
Merged

mbani01 merged 2 commits into
mainfrom
feat/packages-tb-token

Conversation

@mbani01

@mbani01 mbani01 commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4887. The git-activity contributors sync now authenticates to Tinybird with CROWD_PACKAGES_TB_TOKEN, a dedicated token that only has read access to repo_commit_contributors_copy_ds, instead of the shared CROWD_TINYBIRD_ACTIVITIES_TOKEN default of TinybirdClient.

Changes

  • config.ts: getPackagesTinybirdToken() reads CROWD_PACKAGES_TB_TOKEN and throws when it is missing, so a misconfigured deployment fails at the first run instead of making unauthenticated calls.
  • syncGitActivityContributors.ts: passes that token to TinybirdClient.
  • Test asserts the token reaches the client.

Deployment

CROWD_PACKAGES_TB_TOKEN must be set on the security-contacts-worker deployment. CROWD_TINYBIRD_BASE_URL is still read by the client.

…N (CM-1824)

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 08:43
@cursor

cursor Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Requires a new env var at deploy time; misconfiguration will break the sync, but the change reduces credential scope to read-only access for the contributors dataset.

Overview
Git-activity contributor sync now authenticates to Tinybird with a packages-scoped token from CROWD_PACKAGES_TB_TOKEN instead of relying on TinybirdClient's default CROWD_TINYBIRD_ACTIVITIES_TOKEN.

getPackagesTinybirdToken() uses the same required-env pattern as other packages worker config, so a missing variable fails at startup/sync rather than calling Tinybird with the wrong or empty credential. syncGitActivityContributors passes that value into new TinybirdClient(...), and tests mock the config helper and assert the client receives the token.

Deployment: set CROWD_PACKAGES_TB_TOKEN on the worker deployment (e.g. security-contacts-worker).

Reviewed by Cursor Bugbot for commit de645b7. 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.

🟢 Approval recommended

The narrowly scoped changes have no identified blocking issues; deployment must supply CROWD_PACKAGES_TB_TOKEN.

0 open findings

What changed in this PR

Updates the git-activity contributors sync to use a dedicated, read-only Tinybird token instead of the shared activities token.

Changes:

  • Requires CROWD_PACKAGES_TB_TOKEN through a configuration getter.
  • Passes the dedicated token to TinybirdClient.
  • Adds a test assertion verifying token forwarding.
File Description
services/​apps/​packages_worker/​src/​member-contributors/​git-activity/​syncGitActivityContributors.ts Supplies the dedicated token to Tinybird.
services/​apps/​packages_worker/​src/​member-contributors/​__tests__/​syncGitActivityContributors.test.ts Verifies the client receives the token.
services/​apps/​packages_worker/​src/​config.ts Adds the required token getter.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

@mbani01 mbani01 self-assigned this Oct 8, 2026
@mbani01
mbani01 merged commit b8c3bd7 into main Oct 8, 2026
12 checks passed
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mbani01
mbani01 deleted the feat/packages-tb-token branch October 8, 2026 08:48
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.

3 participants