From beb7a5c88338916cc174f29b6de5e826280dee15 Mon Sep 17 00:00:00 2001 From: JSONbored <49853598+JSONbored@users.noreply.github.com> Date: Fri, 17 Jul 2026 02:18:01 -0700 Subject: [PATCH] test(services): fix stale actor/repo-key assertions left by the rebrand notify-pagerduty.test.ts: the test titled "a recent page recorded under the pre-rebrand 'gittensory' actor still suppresses a duplicate" was inserting actor: "loopover" into its fixture -- the wrong value for what it claims to test. src/services/notify-pagerduty.ts's trigger() path deliberately queries BOTH the "loopover" and "gittensory" actors (a dual-actor OR-query specifically so a page recorded under the old actor value just before the rebrand deployed still suppresses a duplicate after it), and no other test anywhere exercises the "gittensory" side of that query. Flips the fixture to actor: "gittensory" so this regression test actually covers the branch it's named for. registry.test.ts / scoring.test.ts: two comments claimed to mirror "JSONbored/gittensory's real master_repositories.json shape" -- verified directly against the live upstream registry (entrius/gittensor) that the real key is now "JSONbored/loopover". Fixed both comments; in registry.test.ts the comment's own fixture block used the same stale key as its literal input/lookup value in that one self-contained test case, so updated that too for consistency (every other "JSONbored/gittensory" fixture elsewhere in that file is an unrelated, arbitrary placeholder repo name with no connection to the real upstream shape, and is left alone). --- test/unit/notify-pagerduty.test.ts | 2 +- test/unit/registry.test.ts | 6 +++--- test/unit/scoring.test.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/unit/notify-pagerduty.test.ts b/test/unit/notify-pagerduty.test.ts index e3c40364ad..0838d284be 100644 --- a/test/unit/notify-pagerduty.test.ts +++ b/test/unit/notify-pagerduty.test.ts @@ -235,7 +235,7 @@ describe("triggerPagerDutyIncident — cooldown gate (alert fatigue control #2)" const tenMinutesAgo = new Date(Date.now() - 10 * 60 * 1000).toISOString(); await recordAuditEvent(env, { eventType: "external_notification.pagerduty", - actor: "loopover", + actor: "gittensory", targetKey: "ops_anomaly:acme/widgets", outcome: "completed", detail: "triggered", diff --git a/test/unit/registry.test.ts b/test/unit/registry.test.ts index f4ddfdc3c4..1a3d16c24d 100644 --- a/test/unit/registry.test.ts +++ b/test/unit/registry.test.ts @@ -72,8 +72,8 @@ describe("registry normalization", () => { it("parses per-repo time-decay overrides from the registry scoring.time_decay block (#703)", () => { const snapshot = normalizeRegistryPayload( { - // JSONbored/gittensory's real master_repositories.json shape: a partial override (no steepness). - "JSONbored/gittensory": { + // JSONbored/loopover's real master_repositories.json shape: a partial override (no steepness). + "JSONbored/loopover": { emission_share: 0.01, scoring: { pr_lookback_days: 45, time_decay: { grace_period_hours: 24, sigmoid_midpoint_days: 10, min_multiplier: 0.05 } }, }, @@ -86,7 +86,7 @@ describe("registry normalization", () => { "2026-05-22T00:00:00.000Z", ); const byName = Object.fromEntries(snapshot.repositories.map((r) => [r.repo, r])); - expect(byName["JSONbored/gittensory"]!.timeDecay).toEqual({ + expect(byName["JSONbored/loopover"]!.timeDecay).toEqual({ gracePeriodHours: 24, sigmoidMidpointDays: 10, sigmoidSteepness: null, // absent → falls back to the global default at resolve time diff --git a/test/unit/scoring.test.ts b/test/unit/scoring.test.ts index 41d667a2d4..460a7f007b 100644 --- a/test/unit/scoring.test.ts +++ b/test/unit/scoring.test.ts @@ -1880,7 +1880,7 @@ NOVELTY_BONUS_SCALAR = 3 const c = DEFAULT_SCORING_CONSTANTS; // No overrides → all snapshot defaults. expect(resolveTimeDecay(c, null)).toEqual({ gracePeriodHours: 12, sigmoidMidpointDays: 10, sigmoidSteepness: 0.4, minMultiplier: 0.05 }); - // Partial override (JSONbored/gittensory's real config: grace 24, midpoint 10, min 0.05, no steepness) + // Partial override (JSONbored/loopover's real config: grace 24, midpoint 10, min 0.05, no steepness) // → overridden fields apply, the absent steepness falls back to the default. expect(resolveTimeDecay(c, { gracePeriodHours: 24, sigmoidMidpointDays: 10, minMultiplier: 0.05 })).toEqual({ gracePeriodHours: 24, @@ -1938,7 +1938,7 @@ NOVELTY_BONUS_SCALAR = 3 it("applies each live repo's resolved curve in the preview (per-repo, not global)", () => { const input: ScorePreviewInput = { repoFullName: repo.fullName, sourceTokenScore: 58, totalTokenScore: 600, sourceLines: 60, openPrCount: 0, credibility: 1, applyTimeDecay: true, prAgeHours: 18 }; - // Repo with a 24h grace override (like JSONbored/gittensory) → an 18h-old PR is still fresh. + // Repo with a 24h grace override (like JSONbored/loopover) → an 18h-old PR is still fresh. const repo24: RepositoryRecord = { ...repo, registryConfig: { ...repo.registryConfig!, timeDecay: { gracePeriodHours: 24 } } }; expect(buildScorePreview({ repo: repo24, snapshot, input }).scoreEstimate.timeDecayMultiplier).toBe(1); // Same PR on a repo using the default 12h grace → past grace, so it decays.