diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 52fe19ff..fefc1d39 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -38,6 +38,18 @@ minimumReleaseAgeExclude: - '@sentry/server-utils@10.73.0' - '@sentry/vue@10.73.0' - import-in-the-middle@3.4.0 + # The published-cli-grammar check runs `pnpm dlx skilld@` on the + # main push, always inside the release-age window. Exempt the CLI and its + # platform binaries or the check can never pass after a CLI publish. + - skilld + - skilld-cli-darwin-arm64 + - skilld-cli-darwin-x64 + - skilld-cli-linux-arm64-gnu + - skilld-cli-linux-arm64-musl + - skilld-cli-linux-x64-gnu + - skilld-cli-linux-x64-musl + - skilld-cli-win32-arm64-msvc + - skilld-cli-win32-x64-msvc shellEmulator: true autoInstallPeers: false diff --git a/scripts/tools/daily-checkin-data.mjs b/scripts/tools/daily-checkin-data.mjs index de82f526..371429c4 100644 --- a/scripts/tools/daily-checkin-data.mjs +++ b/scripts/tools/daily-checkin-data.mjs @@ -216,11 +216,15 @@ const d1 = probe(() => { has('digest_runs') ? `(SELECT COUNT(*) FROM digest_runs WHERE status = 'sent' AND sent_at >= ${sinceSec}) AS digests_sent` : 'NULL AS digests_sent', has('digest_runs') ? `(SELECT COUNT(*) FROM digest_runs WHERE status = 'failed' AND window_end >= ${sinceSec}) AS digests_failed` : 'NULL AS digests_failed', ] + // A count alone gives the 3-repo AMBER gate nothing to repair or prune, so + // the identities behind `newly_broken_repos_impacted` are archived too: one + // row per impacted repo with the reasons it still backs. The filter is shared + // with the count so the number and the rows can never disagree. + const impactedBrokenReposGuarded = has('repos') && has('skills') && has('user_starred_repos') && has('skill_subscriptions') && has('collection_skills_v2') && has('activity') && has('install_events') + const impactedBrokenReposWhere = `r.broken_since >= ${sinceSec} AND (EXISTS (SELECT 1 FROM skills s WHERE s.owner = r.owner AND s.repo = r.repo) OR EXISTS (SELECT 1 FROM user_starred_repos usr WHERE usr.owner = r.owner AND usr.repo = r.repo) OR EXISTS (SELECT 1 FROM skill_subscriptions sub WHERE sub.owner = r.owner AND sub.repo = r.repo) OR EXISTS (SELECT 1 FROM collection_skills_v2 cs WHERE cs.owner = r.owner AND cs.repo = r.repo) OR EXISTS (SELECT 1 FROM activity a JOIN install_events ie ON ie.slug = a.owner || '/' || a.name WHERE a.owner = r.owner AND a.repo = r.repo))` const pipelineParts = [ has('repos') ? `(SELECT COUNT(*) FROM repos WHERE broken_since >= ${sinceSec}) AS newly_broken_repos_total` : 'NULL AS newly_broken_repos_total', - has('repos') && has('skills') && has('user_starred_repos') && has('skill_subscriptions') && has('collection_skills_v2') && has('activity') && has('install_events') - ? `(SELECT COUNT(*) FROM repos r WHERE r.broken_since >= ${sinceSec} AND (EXISTS (SELECT 1 FROM skills s WHERE s.owner = r.owner AND s.repo = r.repo) OR EXISTS (SELECT 1 FROM user_starred_repos usr WHERE usr.owner = r.owner AND usr.repo = r.repo) OR EXISTS (SELECT 1 FROM skill_subscriptions sub WHERE sub.owner = r.owner AND sub.repo = r.repo) OR EXISTS (SELECT 1 FROM collection_skills_v2 cs WHERE cs.owner = r.owner AND cs.repo = r.repo) OR EXISTS (SELECT 1 FROM activity a JOIN install_events ie ON ie.slug = a.owner || '/' || a.name WHERE a.owner = r.owner AND a.repo = r.repo))) AS newly_broken_repos_impacted` - : 'NULL AS newly_broken_repos_impacted', + impactedBrokenReposGuarded ? `(SELECT COUNT(*) FROM repos r WHERE ${impactedBrokenReposWhere}) AS newly_broken_repos_impacted` : 'NULL AS newly_broken_repos_impacted', has('skills') ? `(SELECT COUNT(*) FROM skills WHERE sync_status IS NOT NULL AND sync_status != 'ok' AND last_synced_at >= ${sinceSec}) AS skill_sync_failures` : 'NULL AS skill_sync_failures', has('skill_dirty') ? `(SELECT COUNT(*) FROM skill_dirty WHERE queued_at < ${Math.floor(now.getTime() / 1000) - 3600}) AS stale_dirty_skills` : 'NULL AS stale_dirty_skills', // `ai_batches` covers the Anthropic batch pipeline only, and embeddings never @@ -298,6 +302,9 @@ const d1 = probe(() => { has('discovery_ledger') ? `(SELECT COUNT(*) FROM discovery_ledger WHERE status = 'indexed') AS x_ledger_indexed` : 'NULL AS x_ledger_indexed', ] + const impactedBrokenRepos = impactedBrokenReposGuarded + ? d1Query(`SELECT r.owner, r.repo, rtrim((CASE WHEN EXISTS (SELECT 1 FROM skills s WHERE s.owner = r.owner AND s.repo = r.repo) THEN 'skill ' ELSE '' END) || (CASE WHEN EXISTS (SELECT 1 FROM user_starred_repos usr WHERE usr.owner = r.owner AND usr.repo = r.repo) THEN 'star ' ELSE '' END) || (CASE WHEN EXISTS (SELECT 1 FROM skill_subscriptions sub WHERE sub.owner = r.owner AND sub.repo = r.repo) THEN 'subscription ' ELSE '' END) || (CASE WHEN EXISTS (SELECT 1 FROM collection_skills_v2 cs WHERE cs.owner = r.owner AND cs.repo = r.repo) THEN 'collection ' ELSE '' END) || (CASE WHEN EXISTS (SELECT 1 FROM activity a JOIN install_events ie ON ie.slug = a.owner || '/' || a.name WHERE a.owner = r.owner AND a.repo = r.repo) THEN 'install ' ELSE '' END)) AS reason FROM repos r WHERE ${impactedBrokenReposWhere} ORDER BY r.broken_since DESC`) + : null const syncJobs = has('sync_jobs') ? d1Query(`SELECT name, cron, stale_after_seconds, last_run_at, last_status, last_error FROM sync_jobs WHERE enabled = 1 ORDER BY name`) : null @@ -327,7 +334,10 @@ const d1 = probe(() => { tables: [...tables], inventory: d1Query(`SELECT ${inventoryParts.join(', ')}`)[0], activity: d1Query(`SELECT ${activityParts.join(', ')}`)[0], - pipeline: d1Query(`SELECT ${pipelineParts.join(', ')}`)[0], + pipeline: { + ...d1Query(`SELECT ${pipelineParts.join(', ')}`)[0], + newly_broken_repos_impacted_identities: impactedBrokenRepos, + }, cost: withXSpend(d1Query(`SELECT ${costParts.join(', ')}`)[0]), syncJobs, failedJobFingerprints,