Skip to content

fix: add defaults to mentions datasource fields and fix licenses json path#4114

Merged
gaspergrom merged 4 commits into
mainfrom
chore/add-datasource-defaults-fix-licenses-path
May 15, 2026
Merged

fix: add defaults to mentions datasource fields and fix licenses json path#4114
gaspergrom merged 4 commits into
mainfrom
chore/add-datasource-defaults-fix-licenses-path

Conversation

@gaspergrom
Copy link
Copy Markdown
Contributor

@gaspergrom gaspergrom commented May 14, 2026

Summary

  • Add explicit DEFAULT values to fields in mentions.datasource that previously had none (bookmarked, keywords, authorFollowerCount, tags) — prevents ingestion errors when these fields are absent in incoming JSON
  • Fix licenses JSON path in repositories.datasource from json:$.record.licenses to json:$.record.licenses[:] so array elements are correctly extracted

Changes

  • services/libs/tinybird/datasources/mentions.datasource — added defaults for 4 trailing schema fields
  • services/libs/tinybird/datasources/repositories.datasource — corrected licenses JSON path to use array accessor

Note

Low Risk
Low risk schema tweaks to Tinybird datasources; main impact is on ingestion behavior when optional fields are missing or when parsing licenses as an array.

Overview
Prevents Tinybird ingestion failures by adding explicit DEFAULT values for optional fields in mentions.datasource (e.g., bookmarked, keywords, tags).

Fixes repositories.datasource parsing of licenses by switching the JSON path to the array accessor (json:$.record.licenses[:]) so elements are extracted correctly.

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

… path

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom self-assigned this May 14, 2026
Copilot AI review requested due to automatic review settings May 14, 2026 10:30
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 14, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Jira Issue Key Missing

Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability.

Example:

  • feat: add user authentication (CM-123)
  • feat: add user authentication (IN-123)

Projects:

  • CM: Community Data Platform
  • IN: Insights

Please add a Jira issue key to your PR title.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 hardens Tinybird ingestion schemas by adding explicit defaults for fields that may be missing in incoming JSON and by correcting the JSON-path used to extract repository license arrays. This reduces ingestion failures caused by absent/empty optional fields and ensures licenses is parsed as an array consistently with other datasources.

Changes:

  • Add DEFAULT values for trailing optional fields in mentions.datasource (bookmarked, keywords, authorFollowerCount, tags).
  • Fix repositories.datasource licenses JSON path to use the array accessor ([:]) and keep a safe empty-array default.

Reviewed changes

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

File Description
services/libs/tinybird/datasources/repositories.datasource Fixes licenses extraction to correctly read array elements via json:$.record.licenses[:] and defaults to [].
services/libs/tinybird/datasources/mentions.datasource Adds explicit defaults for optional fields to prevent ingestion errors when fields are absent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings May 15, 2026 08:04
@gaspergrom gaspergrom merged commit f9d1c5c into main May 15, 2026
10 of 13 checks passed
@gaspergrom gaspergrom deleted the chore/add-datasource-defaults-fix-licenses-path branch May 15, 2026 08:04
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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

Comment on lines +48 to +50
`keywords` Array(String) `json:$.keywords[:]` DEFAULT [],
`authorFollowerCount` Nullable(Int32) `json:$.authorFollowerCount`,
`tags` Array(Nullable(String)) `json:$.tags[:]`
`tags` Array(Nullable(String)) `json:$.tags[:]` DEFAULT []
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 3d90f91. Configure here.

`bookmarked` UInt8 `json:$.bookmarked`,
`keywords` Array(String) `json:$.keywords[:]`,
`bookmarked` UInt8 `json:$.bookmarked` DEFAULT 0,
`keywords` Array(String) `json:$.keywords[:]` DEFAULT [],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing DEFAULT for authorFollowerCount despite stated intent

Low Severity

The PR description explicitly lists authorFollowerCount as one of four fields getting a DEFAULT to prevent ingestion errors, but the field on line 49 remains unchanged — it still has no explicit DEFAULT clause. While Nullable(Int32) implicitly resolves to NULL in ClickHouse, this appears to be an oversight given the developer's stated intent. If the other three fields needed explicit defaults to prevent ingestion errors, authorFollowerCount may need one too (e.g., DEFAULT NULL).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 3d90f91. Configure here.

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