Skip to content

fix: resolve advisory_packages join in postgres, skip 1.5TB purl scan (CM-1362) - #4433

Merged
themarolt merged 12 commits into
mainfrom
fix/advisory-packages-bq-ceiling-CM-1362
Aug 5, 2026
Merged

fix: resolve advisory_packages join in postgres, skip 1.5TB purl scan (CM-1362)#4433
themarolt merged 12 commits into
mainfrom
fix/advisory-packages-bq-ceiling-CM-1362

Conversation

@themarolt

Copy link
Copy Markdown
Contributor

Summary

bootstrapOsspckgs has failed its last 5 weekly runs at ingestAdvisories — a BQ dry-run guard aborts because advisory_packages scans ~1.5 TB. Root cause: a purl_map CTE joins the entire PackageVersionsLatest table just to attach a purl used for one join key, which we already have locally in Postgres. This drops the BQ scan for that step to ~1.4 GB and stops the failure from stranding scorecard/ranking downstream.

Changes

  • Drop the purl_map CTE from buildAdvisoryPackagesSql — no BQ-side purl lookup.
  • Resolve advisory_packages.package_id in Postgres instead, joining on the same (ecosystem, namespace, name) identity packages already carries a unique index on (COALESCE(namespace,'') matches the index expression, so this stays an index lookup, not a scan).
  • New shared helper queries/pgIdentity.ts (packageNameSplitSql) so the namespace/name split logic isn't duplicated between ingestPackages.ts and ingestAdvisories.ts.
  • Drop the purl column from the advisory_packages staging DDL/columns; switch that DDL to DROP TABLE IF EXISTS + CREATE (matches ingestDependentCounts.ts) so a stale purl column doesn't silently survive CREATE ... IF NOT EXISTS.
  • Lower BQ_DATASET_INGEST_ADVISORY_PACKAGES_MAX_BQ_GB 1500 → 50 (measured actual ~1.4 GB; keeps the ceiling a real regression gate).
  • bqExportToGcs now throws a typed ApplicationFailure.nonRetryable(..., 'BQ_CEILING_EXCEEDED') on ceiling breach instead of a plain Error (a dry-run byte count is deterministic, so retrying is pure waste).
  • ingestAdvisories unwraps that from ActivityFailure and rethrows a workflow-level ApplicationFailure of the same type; bootstrapOsspckgs now soft-fails only on that type around the advisories step (mirrors the existing dependent_counts/package_dependencies guards) — a ceiling breach no longer strands scorecard/ranking for the whole run.
  • Bonus fix: resolveMissingPackageIds (osv.ts:316) built '@' || namespace || '/' || name for npm, but namespace already contains the @ — every scoped npm advisory package was silently unresolvable in this catch-up. One-line fix, same identity-reconstruction logic as the rest of this PR.

Type of change

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

JIRA ticket

https://linuxfoundation.atlassian.net/browse/CM-1362

… (CM-1362)

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

cursor Bot commented Aug 4, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes advisory–package linking and bootstrap failure handling for security-related ingest; wrong identity matching could leave package_id null, but join logic is aligned with existing package ingest and indexed identity.

Overview
Fixes weekly bootstrapOsspckgs failures at ingestAdvisories by removing the BigQuery purl_map / PackageVersionsLatest scan (~1.5 TB) and linking advisories to packages in Postgres instead.

Advisory ingest: buildAdvisoryPackagesSql no longer exports purl. package_id is set in merge SQL via shared packageNameSplitSql and a LEFT JOIN on (ecosystem, namespace, name) (same identity as packages). Staging drops purl and uses DROP + CREATE so old columns don’t linger. BQ ceilings/docs move advisory_packages from 1500 GB → 50 GB (and advisories 10 → 20 GB).

Resilience: bqExportToGcs raises non-retryable BQ_CEILING_EXCEEDED on dry-run overage. ingestAdvisories propagates that through the child workflow; bootstrapOsspckgs soft-fails only that case and calls notifyBqCeilingSkip so scorecard/ranking still run. Local docker compose files default CROWD_TEMPORAL_NAMESPACE to default when unset.

Bug fix: resolveMissingPackageIds no longer double-prefixes @ on scoped npm package_name when matching packages.

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

Pull request overview

Reduces advisory-package BigQuery scanning by resolving package identities in PostgreSQL while allowing downstream jobs to continue after ceiling breaches.

Changes:

  • Removes the costly BigQuery purl lookup and adds shared package-name parsing.
  • Resolves package IDs through PostgreSQL’s indexed package identity.
  • Adds typed, non-retryable ceiling failures and lowers the scan limit.

Reviewed changes

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

Show a summary per file
File Description
services/libs/data-access-layer/src/packages/osv.ts Fixes scoped npm identity reconstruction.
services/apps/packages_worker/src/deps-dev/workflows/ingestPackages.ts Uses shared identity parsing.
services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts Resolves package IDs in PostgreSQL and handles ceiling failures.
services/apps/packages_worker/src/deps-dev/workflows/bootstrapOsspckgs.ts Soft-fails advisory ceiling breaches.
services/apps/packages_worker/src/deps-dev/README.md Documents revised scan ceilings.
services/apps/packages_worker/src/deps-dev/queries/pgIdentity.ts Adds shared identity SQL generation.
services/apps/packages_worker/src/deps-dev/queries/advisoriesSql.ts Removes the BigQuery purl scan.
services/apps/packages_worker/src/deps-dev/activities/bqExportToGcs.ts Makes ceiling failures typed and non-retryable.

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

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

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.

Pull request overview

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

Suppressed comments (2)

services/libs/data-access-layer/src/packages/osv.ts:316

  • The scoped-npm catch-up fix has no regression coverage. The existing resolveMissingPackageIds integration case only uses an npm package with namespace: null, so it would pass with the old double-@ expression. Add a scoped fixture (for example namespace @types, name node, package name @types/node) and assert that package_id resolves.
        WHEN p.ecosystem = 'npm' THEN p.namespace || '/' || p.name

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:20

  • This alert runs after the advisory-header step has already merged rows, so “Existing data untouched” is inaccurate; only the advisory-package step was skipped. The message can mislead operators investigating a partially completed run.
        text: `Ingest skipped for this run so scorecard/ranking still complete. Existing data untouched. ${input.message}`,

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

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.

Pull request overview

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

Suppressed comments (1)

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:20

  • The ceiling breach occurs after Step 1 has already merged advisory header rows, so “Existing data untouched” is inaccurate and may mislead operators. State specifically that advisory-package/range data was preserved and that advisory headers may already have been ingested.
        text: `Ingest skipped for this run so scorecard/ranking still complete. Existing data untouched. ${input.message}`,

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI review requested due to automatic review settings August 4, 2026 09:31

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.

Pull request overview

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

Copilot AI review requested due to automatic review settings August 4, 2026 15:17

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.

Pull request overview

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

Suppressed comments (2)

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:13

  • sendSlackNotification is explicitly fire-and-forget, so this Temporal activity can complete before the webhook request finishes. A worker shutdown after activity completion can lose the only alert before the parent swallows the ceiling failure. Await sendSlackNotificationAsync so activity completion follows the send attempt.
export async function notifyBqCeilingSkip(input: NotifyBqCeilingSkipInput): Promise<void> {
  sendSlackNotification(

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:20

  • The alert says existing data was untouched, but advisory headers are exported and merged before the advisory-packages ceiling check. A breach can therefore leave newly inserted advisories rows while preserving the prior package/range data; the current message gives operators an inaccurate recovery state.
        text: `Ingest skipped for this run so scorecard/ranking still complete. Existing data untouched. ${input.message}`,

Comment thread services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts Outdated
Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI review requested due to automatic review settings August 4, 2026 15:25
@themarolt
themarolt requested a review from mbani01 August 4, 2026 15: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.

Pull request overview

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

Suppressed comments (1)

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:20

  • For an advisory_packages ceiling breach, the advisories header export has already been loaded, so “Existing data untouched” is inaccurate and can mislead operators assessing a partial run. State that earlier ingest steps may have completed.
        text: `Ingest skipped for this run so scorecard/ranking still complete. Existing data untouched. ${input.message}`,

@mbani01 mbani01 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.

@themarolt LGTM, just a suggestion to change target slack channel

Comment thread services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts Outdated
…M-1362)

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI review requested due to automatic review settings August 4, 2026 15:51
mbani01
mbani01 previously approved these changes Aug 4, 2026

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.

Pull request overview

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

Suppressed comments (1)

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:13

  • This activity completes before Slack delivery because sendSlackNotification is explicitly fire-and-forget. Temporal therefore records the alert activity as successful while the only operational signal is still pending and can be lost if the worker stops. Await sendSlackNotificationAsync so the activity does not complete until the send attempt finishes.
  sendSlackNotification(

Copilot AI review requested due to automatic review settings August 4, 2026 19:42

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.

Pull request overview

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

Suppressed comments (1)

services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts:40

  • This comment embeds review history and spans seven lines, contrary to the repository rule that comments should capture only non-obvious rationale in at most two lines. Condense it to the durable reason for preserving the failure type and job kind.
// bqExportToGcs throws ApplicationFailure.nonRetryable('BQ_CEILING_EXCEEDED') directly from
// activity code, which the SDK surfaces here as ActivityFailure.cause. Rethrow as a workflow-level
// ApplicationFailure carrying the job kind as a detail so bootstrapOsspckgs's unwrap (err.cause on
// the resulting ChildWorkflowFailure) can match it, soft-fail, and alert on whichever export
// actually breached — mirroring the DEPENDENT_COUNTS_GUARD / EDGE_SNAPSHOT_GUARD pattern there.

Comment thread scripts/services/bq-dataset-ingest.yaml
Copilot AI review requested due to automatic review settings August 5, 2026 09:29

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c0dd769. Configure here.

Comment thread services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts Outdated

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.

Pull request overview

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

Suppressed comments (3)

scripts/services/bq-dataset-ingest.yaml:8

  • This namespace-default change, repeated across eight worker compose files, is unrelated to the advisory-package scan described by CM-1362 and changes local worker routing behavior. The repository requires PRs to contain one focused bug fix (.claude/rules/commit-workflow.md:58-61); please move these compose changes to a separately tracked PR or document why they are required for this fix.
  CROWD_TEMPORAL_NAMESPACE: ${CROWD_PACKAGES_TEMPORAL_NAMESPACE:-default}

services/libs/data-access-layer/src/packages/osv.ts:341

  • The existing catch-up integration test covers only an unscoped npm name (cxp-jquery), so it would not catch a regression of the scoped-name bug fixed here. Add a fixture where namespace = '@scope' and package_name = '@scope/name', then assert this update resolves its package_id.
        WHEN p.ecosystem = 'npm' THEN p.namespace || '/' || p.name

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:13

  • This activity returns before the Slack request completes because sendSlackNotification is explicitly fire-and-forget. Temporal can therefore mark the alert activity successful and continue after swallowing the ceiling failure even if the process stops before delivery; the configured activity retries also cannot observe the send. Await sendSlackNotificationAsync, as the packages-worker activity interceptor does, so the delivery attempt finishes before this activity succeeds.
  sendSlackNotification(

…eiling breach (CM-1362)

Signed-off-by: Uroš Marolt <uros@marolt.me>
Copilot AI review requested due to automatic review settings August 5, 2026 12:05

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.

Pull request overview

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

Suppressed comments (2)

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:22

  • This Temporal activity uses the fire-and-forget Slack API, so it can be recorded successful before the webhook request completes; a worker shutdown can lose the only signal after the parent swallows the ceiling failure. Await sendSlackNotificationAsync instead, as the packages-worker activity interceptor does, so activity completion follows the delivery attempt.
  sendSlackNotification(

services/libs/data-access-layer/src/packages/osv.ts:341

  • The existing catch-up integration test only exercises an unscoped npm package, so it would pass with the old double-@ expression. Add a scoped fixture with namespace @scope and package name @scope/name, then assert that resolveMissingPackageIds populates its package_id.
        WHEN p.ecosystem = 'npm' THEN p.namespace || '/' || p.name

Copilot AI review requested due to automatic review settings August 5, 2026 12:11

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.

Pull request overview

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

Suppressed comments (8)

services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts:97

  • This six-line block documents the change rather than a lasting invariant and exceeds the two-line limit. Retain only the performance constraint that prevents reintroducing the expensive lookup.
// package_id is resolved here by reconstructing the same (ecosystem, namespace, name) identity
// ingestPackages.ts writes into `packages` (packageNameSplitSql, shared by both), rather than by
// a BQ-sourced purl (CM-1362 — the purl_map scan cost ~1.5 TB per run for a join key we already
// had locally). COALESCE(p.namespace,'') mirrors the unique index expression verbatim, so this
// stays an index lookup. Still a LEFT JOIN: package_id stays nullable, resolveMissingPackageIds

services/apps/packages_worker/src/deps-dev/workflows/bootstrapOsspckgs.ts:335

  • This block exceeds the two-line comment limit and includes review-history details. Condense it to the operational reason for the explicit alert.
      // Unlike checkDependentCountsGuard/checkEdgeSnapshotQuality, this failure happens before
      // any ingest-job row is created, so there's no failed-job row for an operator to notice —
      // alert explicitly or repeated skips go unnoticed (review comment on CM-1362).
      // ingestAdvisories carries the failing export's jobKind as the failure detail ('advisories'
      // or 'advisory_packages') so the alert names the export that actually breached.

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:17

  • This five-line comment narrates the branch immediately below and includes review history. The two impact strings are already self-explanatory, so remove the block.
  // 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.

services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts:40

  • This implementation note exceeds the two-line comment limit. Keep only the non-obvious Temporal wrapping invariant; the function already shows the rethrow and detail propagation.

This issue also appears on line 93 of the same file.

// bqExportToGcs throws ApplicationFailure.nonRetryable('BQ_CEILING_EXCEEDED') directly from
// activity code, which the SDK surfaces here as ActivityFailure.cause. Rethrow as a workflow-level
// ApplicationFailure carrying the job kind as a detail so bootstrapOsspckgs's unwrap (err.cause on
// the resulting ChildWorkflowFailure) can match it, soft-fail, and alert on whichever export
// actually breached — mirroring the DEPENDENT_COUNTS_GUARD / EDGE_SNAPSHOT_GUARD pattern there.

services/apps/packages_worker/src/deps-dev/workflows/bootstrapOsspckgs.ts:326

  • This explanation exceeds the two-line comment limit. The only non-obvious constraint is which failure may be swallowed; the surrounding control flow communicates the rest.

This issue also appears on line 331 of the same file.

      // Only soft-fail on the BQ byte-ceiling guard (CM-1362), mirroring the dependent_counts /
      // package_dependencies handling above. advisories is the last data kind — letting a ceiling
      // breach here propagate unhandled used to strand scorecard + ranking below for the whole
      // run. All other errors (BQ timeout, DB failure, etc.) still propagate.

services/apps/packages_worker/src/deps-dev/queries/pgIdentity.ts:3

  • This header restates what the helper and its call sites do. Removing it keeps the new utility self-explanatory and avoids a change-history comment.
// 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.

services/apps/packages_worker/src/deps-dev/queries/advisoriesSql.ts:19

  • This change-history block exceeds the two-line comment limit. Keep only the durable performance constraint that explains why the apparently simpler BigQuery join must not return.
// No purl here — package_id is resolved in Postgres against the already-ingested `packages`
// table (see ADVISORY_PACKAGES_MERGE_SQL in workflows/ingestAdvisories.ts). Pulling purl from
// BigQuery required scanning all of PackageVersionsLatest (~1.5 TB) just for a join key we
// already have locally (CM-1362).

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:11

  • This block exceeds the two-line comment limit and records review history and nearby-file comparisons. The function name and selected channel already make its purpose clear, so remove it.

This issue also appears on line 13 of the same file.

// 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.

Copilot AI review requested due to automatic review settings August 5, 2026 17:23
@themarolt
themarolt merged commit 637c408 into main Aug 5, 2026
6 checks passed
@themarolt
themarolt deleted the fix/advisory-packages-bq-ceiling-CM-1362 branch August 5, 2026 17:23

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.

Pull request overview

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

Suppressed comments (9)

services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts:97

  • This six-line change narrative exceeds the repository's two-line limit for comments (CLAUDE.md:72-84). Keep only the non-obvious index-alignment constraint.
// package_id is resolved here by reconstructing the same (ecosystem, namespace, name) identity
// ingestPackages.ts writes into `packages` (packageNameSplitSql, shared by both), rather than by
// a BQ-sourced purl (CM-1362 — the purl_map scan cost ~1.5 TB per run for a join key we already
// had locally). COALESCE(p.namespace,'') mirrors the unique index expression verbatim, so this
// stays an index lookup. Still a LEFT JOIN: package_id stays nullable, resolveMissingPackageIds

services/apps/packages_worker/src/deps-dev/workflows/bootstrapOsspckgs.ts:335

  • This review-history block exceeds the two-line limit in CLAUDE.md:72-84. Reduce it to the non-obvious failure-detail contract between the child and parent workflows.
      // Unlike checkDependentCountsGuard/checkEdgeSnapshotQuality, this failure happens before
      // any ingest-job row is created, so there's no failed-job row for an operator to notice —
      // alert explicitly or repeated skips go unnoticed (review comment on CM-1362).
      // ingestAdvisories carries the failing export's jobKind as the failure detail ('advisories'
      // or 'advisory_packages') so the alert names the export that actually breached.

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:17

  • This five-line implementation-history note exceeds the two-line limit in CLAUDE.md:72-84. Keep only the ordering invariant needed to understand the different alert text.
  // 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.

services/apps/packages_worker/src/deps-dev/queries/pgIdentity.ts:3

  • This explanatory block exceeds the repository's two-line limit for allowed comments (CLAUDE.md:72-84). Keep only the non-obvious cross-consumer invariant; the helper name and implementation already describe the split.
// 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.

services/apps/packages_worker/src/deps-dev/queries/advisoriesSql.ts:19

  • This is a multi-line note about the current change, which CLAUDE.md:72-84 disallows. Retain only the performance constraint that would otherwise look removable.
// No purl here — package_id is resolved in Postgres against the already-ingested `packages`
// table (see ADVISORY_PACKAGES_MERGE_SQL in workflows/ingestAdvisories.ts). Pulling purl from
// BigQuery required scanning all of PackageVersionsLatest (~1.5 TB) just for a join key we
// already have locally (CM-1362).

services/apps/packages_worker/src/deps-dev/workflows/ingestAdvisories.ts:40

  • This seven-line implementation/review note violates the two-line comment limit in CLAUDE.md:72-84. Condense it to the non-obvious Temporal wrapping contract.

This issue also appears on line 93 of the same file.

// bqExportToGcs throws ApplicationFailure.nonRetryable('BQ_CEILING_EXCEEDED') directly from
// activity code, which the SDK surfaces here as ActivityFailure.cause. Rethrow as a workflow-level
// ApplicationFailure carrying the job kind as a detail so bootstrapOsspckgs's unwrap (err.cause on
// the resulting ChildWorkflowFailure) can match it, soft-fail, and alert on whichever export
// actually breached — mirroring the DEPENDENT_COUNTS_GUARD / EDGE_SNAPSHOT_GUARD pattern there.

services/apps/packages_worker/src/deps-dev/workflows/bootstrapOsspckgs.ts:326

  • This four-line description of the newly added catch exceeds the two-line comment limit in CLAUDE.md:72-84. The shorter form preserves the operational reason without documenting the change history.

This issue also appears on line 331 of the same file.

      // Only soft-fail on the BQ byte-ceiling guard (CM-1362), mirroring the dependent_counts /
      // package_dependencies handling above. advisories is the last data kind — letting a ceiling
      // breach here propagate unhandled used to strand scorecard + ranking below for the whole
      // run. All other errors (BQ timeout, DB failure, etc.) still propagate.

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:22

  • This activity returns while the Slack request is still in flight because sendSlackNotification is explicitly fire-and-forget (services/libs/slack/src/notify.ts:207-225). Temporal can therefore record the notification activity as successful before the alert finishes, so a worker shutdown can lose the only signal for a swallowed ceiling breach. Await sendSlackNotificationAsync, as the existing Temporal alert activity does in services/apps/packages_worker/src/activities/index.ts:6-13.
  sendSlackNotification(

services/apps/packages_worker/src/deps-dev/activities/notifyBqCeilingSkip.ts:11

  • This four-line note records change/reviewer history rather than a non-obvious invariant, contrary to CLAUDE.md:72-84. The function and channel enum already make the behavior clear.

This issue also appears on line 13 of the same file.

// 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.

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