Stop a not-yet-published Liga squad from reaching the error hub as a warning
ci / typescript (push) Failing after 14m23s
ci / rust (push) Successful in 12m34s

Liga 400s team/squad until it publishes a team's season list (newly promoted
or still pre-season), same shape as the round nominations case fixed in
BIT-31543 (c61d371). importLigaSquads and backfillLigaRegister both caught
that but logged at warn, and the pino->error-hub hook forwards any warn
carrying an `err` — so a routine early read shows up in the hub (ERRCLUSTER
5b8e55fcfd43).

Distinguish a 400 (not published yet, read again next refresh) from a real
failure in both squad catch sites: info instead of warn for the former,
keeping it out of the hub.

Paperclip-Agent: José Alves (urlKey jos-alves; id 11179220-3cec-4f0f-880d-2771ff64fce8)
Paperclip-Issue: BIT-31672
Paperclip-Run: 20687384-5fd1-4218-a13a-77b8c9d4e051
This commit is contained in:
jos-alves committed 2026-10-21 21:06:21 +01:00
1 parent cbe19e0373
commit c864a48ce7
1 file changed
+9 -2
+9 -2
View File
@@ -227,7 +227,11 @@ export class SportsService {
changed += await this.savePlayers(t.id, t.season, await this.liga.squad(t.external_id, t.season), "api");
} catch (err) {
this.squadClaimed.delete(key);
this.deps.log.warn({ err, team: t.id, season: t.season }, "sports: liga squad not read");
// Liga 400s team/squad until it publishes a team's list for that season (newly promoted or still
// pre-season): expected, not an outage, so it is kept out of the error hub and read again later.
if (err instanceof ProviderHttpError && err.status === 400)
this.deps.log.info({ err, team: t.id, season: t.season }, "sports: liga squad not published yet for this team");
else this.deps.log.warn({ err, team: t.id, season: t.season }, "sports: liga squad not read");
}
}
if (changed) this.deps.log.info({ season, changed }, "sports: liga squads imported");
@@ -292,7 +296,10 @@ export class SportsService {
} catch (err) {
complete = false;
this.squadClaimed.delete(claim);
this.deps.log.warn({ err, team: t.name, season }, "sports: liga squad not read");
// Same not-yet-published 400 as importLigaSquads above: expected, kept out of the error hub.
if (err instanceof ProviderHttpError && err.status === 400)
this.deps.log.info({ err, team: t.name, season }, "sports: liga squad not published yet for this team");
else this.deps.log.warn({ err, team: t.name, season }, "sports: liga squad not read");
}
}
if (complete) this.registerDone.add(key);