Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions layers/identity/server/utils/daily-health-check.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,15 @@ describe('buildDailyHealthCheck', () => {
'organization', 'missing-repo', 'eligible', 'Reviewed purpose', 'test',
${nowSec - 901}
);
-- An upstream-deleted repository keeps its repos row with broken_since
-- set and no skills, so its review looks invisible forever. The
-- breakage is already known, so the review must not re-alarm nightly.
INSERT INTO owners VALUES ('gone-owner', 'user');
INSERT INTO repos VALUES ('gone-owner', 'gone-repo', ${nowSec - 900});
INSERT INTO skill_repo_eligibility VALUES (
'gone-owner', 'gone-repo', 'eligible', 'Reviewed purpose', 'test',
${nowSec - 901}
);
`)
const uncertain = await buildDailyHealthCheck(db, { now, fetcher, workerVersion: 'version-1' })
expect(uncertain.activity.digestsFailed24h).toBe(1)
Expand Down
11 changes: 11 additions & 0 deletions layers/identity/server/utils/daily-health-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,10 @@ async function loadWeeklyRun(db: D1Database): Promise<DailyHealthCheckSummary['a
* still says eligible, the owner is a user (the leaderboard scope), and no
* healthy skill row exists for the repository.
*
* A repository whose repos row is broken (deleted upstream) is excluded: the
* breakage is a known state reported by the broken-repo metrics, so its
* review would otherwise re-alarm every night forever.
*
* Shared by the count and the named-rows query so the number and the names in
* the report cannot drift apart. `param` is the placeholder index for the
* visibility deadline, which each statement binds at its own position.
Expand All @@ -944,6 +948,13 @@ function leaderboardStuckSql(param: number): string {
WHERE r.owner = review.owner
AND r.repo = review.repo
AND r.broken_since IS NULL
)
AND NOT EXISTS (
SELECT 1
FROM repos AS broken
WHERE broken.owner = review.owner
AND broken.repo = review.repo
AND broken.broken_since IS NOT NULL
)`
}

Expand Down
Loading