-
Notifications
You must be signed in to change notification settings - Fork 727
fix: resolve advisory_packages join in postgres, skip 1.5TB purl scan (CM-1362) #4433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ab82ccf
fix: resolve advisory_packages join in postgres, skip 1.5TB purl scan…
themarolt 40b01c3
fix: alert on advisory_packages BQ ceiling soft-fail (CM-1362)
themarolt a1b9c26
fix: satisfy eslint import order/format in ingestPackages (CM-1362)
themarolt cc2a3ea
style: fix prettier table padding in deps-dev README (CM-1362)
themarolt bbc9900
Merge remote-tracking branch 'origin/main' into fix/advisory-packages…
themarolt d5bb116
fix: unwrap BQ ceiling breach for advisories export too (CM-1362)
themarolt 38cad75
fix: alert BQ ceiling skip to akrites channel, not critical-alerts (C…
themarolt bbe586e
fix: fall back to default temporal namespace in compose files (CM-1362)
themarolt c0dd769
Merge remote-tracking branch 'origin/main' into fix/advisory-packages…
themarolt aca67db
fix: alert must not claim advisories untouched on advisory_packages c…
themarolt f96972a
Merge remote-tracking branch 'origin/main' into fix/advisory-packages…
themarolt befa6d6
Merge remote-tracking branch 'origin/main' into fix/advisory-packages…
themarolt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { SlackChannel, SlackPersona, sendSlackNotification } from '@crowd/slack' | ||
|
|
||
| export interface NotifyBqCeilingSkipInput { | ||
| jobKind: string | ||
| message: string | ||
| } | ||
|
|
||
| // The advisories ceiling breach is caught one level up in bootstrapOsspckgs instead of inside a | ||
| // guard activity, so it needs its own alert call to keep repeated skips from going unnoticed | ||
| // (CM-1362 review). Uses CDP_AKRITES_ALERTS — the packages_worker team's own channel (matches | ||
| // service.ts / blast-radius-worker.ts), per reviewer request — rather than CDP_CRITICAL_ALERTS. | ||
| export async function notifyBqCeilingSkip(input: NotifyBqCeilingSkipInput): Promise<void> { | ||
| // ingestAdvisories merges `advisories` to Postgres before exporting `advisory_packages` | ||
| // (bootstrapOsspckgs.ts), so a breach on the latter still leaves this run's new advisory rows | ||
| // committed with no package links — "existing data untouched" would misstate that (bugbot | ||
| // review on CM-1362). A breach on `advisories` itself precedes any write this run, so that | ||
| // claim stays accurate there. | ||
| const impact = | ||
| input.jobKind === 'advisory_packages' | ||
| ? "This run's advisories were already merged without package links — they'll link up on the next successful run." | ||
| : 'Ingest skipped for this run so scorecard/ranking still complete. Existing data untouched.' | ||
| sendSlackNotification( | ||
| SlackChannel.CDP_AKRITES_ALERTS, | ||
| SlackPersona.CRITICAL_ALERTER, | ||
| `:warning: ${input.jobKind} BQ byte ceiling exceeded — soft-failed`, | ||
| [ | ||
| { | ||
| title: 'Action', | ||
| text: `${impact} ${input.message}`, | ||
| }, | ||
| ], | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
services/apps/packages_worker/src/deps-dev/queries/pgIdentity.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // The (namespace, name) split ingestPackages.ts writes into `packages` (see MERGE_SQL there). | ||
| // Any consumer that needs to join back onto that identity by name must derive it identically, | ||
| // so both sides share this one definition instead of drifting apart. | ||
| export function packageNameSplitSql( | ||
| alias: string, | ||
| nameCol: string, | ||
| ): { namespace: string; name: string } { | ||
| const ecosystem = `${alias}.ecosystem` | ||
| const rawName = `${alias}.${nameCol}` | ||
| return { | ||
| namespace: `CASE | ||
| WHEN ${ecosystem} = 'maven' THEN SPLIT_PART(${rawName}, ':', 1) | ||
| WHEN ${rawName} LIKE '@%/%' THEN SPLIT_PART(${rawName}, '/', 1) | ||
| ELSE NULL | ||
| END`, | ||
| name: `CASE | ||
| WHEN ${ecosystem} = 'maven' THEN SPLIT_PART(${rawName}, ':', 2) | ||
| WHEN ${rawName} LIKE '@%/%' THEN SPLIT_PART(${rawName}, '/', 2) | ||
| ELSE ${rawName} | ||
| END`, | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.