Skip to content

Commit 55563e7

Browse files
authored
fix: tinybird datasources (CM-1219) (#4205)
Signed-off-by: Joana Maia <jmaia@contractor.linuxfoundation.org>
1 parent 0a58453 commit 55563e7

4 files changed

Lines changed: 44 additions & 24 deletions

File tree

services/libs/tinybird/datasources/advisories.datasource

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SCHEMA >
2424
`sourceUrl` String `json:$.record.source_url` DEFAULT '',
2525
`aliases` Array(String) `json:$.record.aliases[:]` DEFAULT [],
2626
`severity` String `json:$.record.severity` DEFAULT '',
27-
`cvss` Float32 `json:$.record.cvss` DEFAULT 0,
27+
`cvss` String `json:$.record.cvss` DEFAULT '0',
2828
`cvssSource` String `json:$.record.cvss_source` DEFAULT '',
2929
`isCritical` UInt8 `json:$.record.is_critical` DEFAULT 0,
3030
`summary` String `json:$.record.summary` DEFAULT '',

services/libs/tinybird/datasources/packages.datasource renamed to services/libs/tinybird/datasources/ossPackages.datasource

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DESCRIPTION >
2-
- `packages` contains Tier-2 package metadata for tracked OSS packages across multiple ecosystems.
2+
- `ossPackages` contains Tier-2 package metadata for tracked OSS packages across multiple ecosystems.
33
- Replicated from Postgres packages-db — seeded from deps.dev BigQuery, enriched by registry-specific workers (npm, Maven, etc.).
44
- Used to power package search, vulnerability overlays, criticality scoring, and ecosystem health analytics.
55
- `id` is the internal primary key.
@@ -28,6 +28,9 @@ DESCRIPTION >
2828
- `impact` is the composite criticality impact score from the ranking function (0 if not yet ranked).
2929
- `isCritical` is 1 if this package ranks in the top N by ecosystem in the most recent ranking pass, 0 otherwise.
3030
- `lastRankPassAt` is when the criticality ranking worker last processed this package (NULL if never ranked).
31+
- `downloadsLast30d` is the 30-day npm download count cached for ranking (0 if not yet populated).
32+
- `centralityScore` is the PageRank-based centrality score stored for future ranking formula use ('0' if not yet computed).
33+
- `rankInEcosystem` is the ordinal rank within the ecosystem from the most recent ranking pass (NULL if not yet ranked).
3134
- `ingestionSource` identifies which worker last wrote the row: 'npm-registry', 'deps_dev', etc. (empty string if unknown).
3235
- `lastSyncedAt` is when the row was last written by any worker — serves as the updated_at watermark for sync.
3336
- `createdAt` is the row-insert timestamp — set once on first insert, never updated.
@@ -36,32 +39,35 @@ SCHEMA >
3639
`id` UInt64 `json:$.record.id`,
3740
`purl` String `json:$.record.purl`,
3841
`ecosystem` String `json:$.record.ecosystem`,
39-
`namespace` String `json:$.record.namespace` DEFAULT '',
42+
`namespace` Nullable(String) `json:$.record.namespace`,
4043
`name` String `json:$.record.name`,
41-
`registryUrl` String `json:$.record.registry_url` DEFAULT '',
42-
`status` String `json:$.record.status` DEFAULT '',
43-
`description` String `json:$.record.description` DEFAULT '',
44-
`homepage` String `json:$.record.homepage` DEFAULT '',
45-
`declaredRepositoryUrl` String `json:$.record.declared_repository_url` DEFAULT '',
46-
`repositoryUrl` String `json:$.record.repository_url` DEFAULT '',
44+
`registryUrl` Nullable(String) `json:$.record.registry_url`,
45+
`status` Nullable(String) `json:$.record.status`,
46+
`description` Nullable(String) `json:$.record.description`,
47+
`homepage` Nullable(String) `json:$.record.homepage`,
48+
`declaredRepositoryUrl` Nullable(String) `json:$.record.declared_repository_url`,
49+
`repositoryUrl` Nullable(String) `json:$.record.repository_url`,
4750
`licenses` Array(String) `json:$.record.licenses[:]` DEFAULT [],
48-
`licensesRaw` String `json:$.record.licenses_raw` DEFAULT '',
51+
`licensesRaw` Nullable(String) `json:$.record.licenses_raw`,
4952
`keywords` Array(String) `json:$.record.keywords[:]` DEFAULT [],
50-
`distTagsLatest` String `json:$.record.dist_tags_latest` DEFAULT '',
51-
`distTagsNext` String `json:$.record.dist_tags_next` DEFAULT '',
52-
`distTagsBeta` String `json:$.record.dist_tags_beta` DEFAULT '',
53-
`versionsCount` UInt32 `json:$.record.versions_count` DEFAULT 0,
54-
`latestVersion` String `json:$.record.latest_version` DEFAULT '',
53+
`distTagsLatest` Nullable(String) `json:$.record.dist_tags_latest`,
54+
`distTagsNext` Nullable(String) `json:$.record.dist_tags_next`,
55+
`distTagsBeta` Nullable(String) `json:$.record.dist_tags_beta`,
56+
`versionsCount` Nullable(UInt32) `json:$.record.versions_count`,
57+
`latestVersion` Nullable(String) `json:$.record.latest_version`,
5558
`firstReleaseAt` Nullable(DateTime64(3)) `json:$.record.first_release_at`,
5659
`latestReleaseAt` Nullable(DateTime64(3)) `json:$.record.latest_release_at`,
57-
`dependentCount` UInt32 `json:$.record.dependent_count` DEFAULT 0,
58-
`transitiveDependentCount` UInt64 `json:$.record.transitive_dependent_count` DEFAULT 0,
59-
`dependentReposCount` UInt32 `json:$.record.dependent_repos_count` DEFAULT 0,
60+
`dependentCount` Nullable(UInt32) `json:$.record.dependent_count`,
61+
`transitiveDependentCount` Nullable(UInt64) `json:$.record.transitive_dependent_count`,
62+
`dependentReposCount` Nullable(UInt32) `json:$.record.dependent_repos_count`,
6063
`hasCriticalVulnerability` UInt8 `json:$.record.has_critical_vulnerability` DEFAULT 0,
61-
`impact` Float32 `json:$.record.impact` DEFAULT 0,
64+
`impact` Nullable(String) `json:$.record.impact`,
6265
`isCritical` UInt8 `json:$.record.is_critical` DEFAULT 0,
6366
`lastRankPassAt` Nullable(DateTime64(3)) `json:$.record.last_rank_pass_at`,
64-
`ingestionSource` String `json:$.record.ingestion_source` DEFAULT '',
67+
`downloadsLast30d` Nullable(UInt64) `json:$.record.downloads_last_30d`,
68+
`centralityScore` Nullable(String) `json:$.record.centrality_score`,
69+
`rankInEcosystem` Nullable(UInt32) `json:$.record.rank_in_ecosystem`,
70+
`ingestionSource` Nullable(String) `json:$.record.ingestion_source`,
6571
`lastSyncedAt` DateTime64(3) `json:$.record.last_synced_at`,
6672
`createdAt` DateTime64(3) `json:$.record.created_at`
6773

services/libs/tinybird/datasources/packageRepos.datasource

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ SCHEMA >
1515
`packageId` UInt64 `json:$.record.package_id`,
1616
`repoId` UInt64 `json:$.record.repo_id`,
1717
`source` String `json:$.record.source`,
18-
`confidence` Float32 `json:$.record.confidence`,
18+
`confidence` String `json:$.record.confidence`,
1919
`verifiedAt` DateTime64(3) `json:$.record.verified_at`,
2020
`createdAt` DateTime64(3) `json:$.record.created_at`
2121

services/libs/tinybird/datasources/repos.datasource

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@ DESCRIPTION >
1818
- `archived` is 1 if the repository is archived, 0 if not, NULL until the GitHub enricher runs (deps.dev seed does not expose this).
1919
- `disabled` is 1 if the repository is disabled, 0 if not, NULL until the GitHub enricher runs.
2020
- `isFork` is 1 if this repository is a fork of another, 0 if not, NULL until the GitHub enricher runs.
21-
- `createdAt` is the repository creation date on GitHub/GitLab — a domain timestamp, not a row-insert timestamp.
21+
- `createdAt` is the row-insert timestamp — set once on first insert via DEFAULT NOW(), never updated.
2222
- `homepage` is the project homepage URL (empty string if not provided).
2323
- `rawProjectType` is the deps.dev project type string (e.g. 'GITHUB', 'GITLAB') for identity resolution.
2424
- `rawProjectName` is the deps.dev project name (e.g. 'github.com/owner/repo') for identity resolution.
2525
- `scorecardScore` is the OpenSSF Scorecard aggregate score (0 if not yet scored).
2626
- `scorecardLastRunAt` is when the Scorecard was last evaluated (NULL if never run).
2727
- `skipEnrichment` is 1 if the GitHub enricher should skip this repo (e.g. invalid/transient URLs), 0 otherwise.
2828
- `lastSyncedAt` is the timestamp of the last GitHub enrichment attempt (NULL if never enriched or transient failure).
29+
- `securityPolicyEnabled` is 1 if the repo has a SECURITY.md policy file, 0 if not, NULL until the snapshot enricher runs.
30+
- `securityFileEnabled` is 1 if the repo has a security-related file, 0 if not, NULL until the snapshot enricher runs.
31+
- `snapshotAt` is when the activity snapshot enricher last processed this repo (NULL if never run).
32+
- `branchProtectionEnabled` is 1 if branch protection is enabled on the default branch, 0 if not, NULL until enriched.
33+
- `branchProtectionAllowsForcePush` is 1 if force pushes are allowed despite branch protection, 0 if not, NULL until enriched.
34+
- `branchProtectionRequiredReviews` is the number of required approving reviews before merging (NULL until enriched).
35+
- `branchProtectionRequiresStatusChecks` is 1 if status checks are required before merging, 0 if not, NULL until enriched.
2936
- `updatedAt` is the row-level audit timestamp used as the Tinybird watermark for sync.
3037

3138
SCHEMA >
@@ -45,14 +52,21 @@ SCHEMA >
4552
`archived` Nullable(UInt8) `json:$.record.archived`,
4653
`disabled` Nullable(UInt8) `json:$.record.disabled`,
4754
`isFork` Nullable(UInt8) `json:$.record.is_fork`,
48-
`createdAt` Nullable(DateTime64(3)) `json:$.record.created_at`,
55+
`createdAt` DateTime64(3) `json:$.record.created_at`,
4956
`homepage` String `json:$.record.homepage` DEFAULT '',
5057
`rawProjectType` String `json:$.record.raw_project_type` DEFAULT '',
5158
`rawProjectName` String `json:$.record.raw_project_name` DEFAULT '',
52-
`scorecardScore` Float32 `json:$.record.scorecard_score` DEFAULT 0,
59+
`scorecardScore` String `json:$.record.scorecard_score` DEFAULT '0',
5360
`scorecardLastRunAt` Nullable(DateTime64(3)) `json:$.record.scorecard_last_run_at`,
5461
`skipEnrichment` UInt8 `json:$.record.skip_enrichment` DEFAULT 0,
5562
`lastSyncedAt` Nullable(DateTime64(3)) `json:$.record.last_synced_at`,
63+
`securityPolicyEnabled` Nullable(UInt8) `json:$.record.security_policy_enabled`,
64+
`securityFileEnabled` Nullable(UInt8) `json:$.record.security_file_enabled`,
65+
`snapshotAt` Nullable(DateTime64(3)) `json:$.record.snapshot_at`,
66+
`branchProtectionEnabled` Nullable(UInt8) `json:$.record.branch_protection_enabled`,
67+
`branchProtectionAllowsForcePush` Nullable(UInt8) `json:$.record.branch_protection_allows_force_push`,
68+
`branchProtectionRequiredReviews` Nullable(Int32) `json:$.record.branch_protection_required_reviews`,
69+
`branchProtectionRequiresStatusChecks` Nullable(UInt8) `json:$.record.branch_protection_requires_status_checks`,
5670
`updatedAt` DateTime64(3) `json:$.record.updated_at`
5771

5872
ENGINE ReplacingMergeTree

0 commit comments

Comments
 (0)