feat(codes): mark a code dead once the owner confirms it in game

Game8 still lists Y1INABQB6DEX, 2BJ64QRZ7RT8 and PLDXIB886Y1S as active
Genshin codes after the game refused them. CODE_CHECKS records the
owner's in-game check; build-codes stamps the matching code confirmedDead,
and the Codes tab shows it expired: "Confirmed expired in game, 2026-10-20."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas WintherandClaude Opus 5.5 committed 2026-10-20 03:34:52 +02:00
1 parent 7569aa6395
commit b8e8d44816
12 files changed
+178 -12

No files matched your search

+12 -2
View File
@@ -1,6 +1,7 @@
import { mkdir, rename } from "node:fs/promises";
import { CODE_SOURCES } from "../src/ingest/codes/registry.ts";
import { buildCodesFeed } from "../src/ingest/codes/build.ts";
import { applyCodeChecks, buildCodesFeed } from "../src/ingest/codes/build.ts";
import { CODE_CHECKS } from "../src/shared/codeChecks.ts";
import { CodesFeedSchema, type CodesFeed } from "../src/shared/codes.ts";
import { SnapshotStore, freshnessAt } from "../src/ingest/snapshots.ts";
import type { SourceHealth } from "../src/shared/feed.ts";
@@ -55,7 +56,16 @@ export async function buildCodes() {
: false,
});
}
const feed = CodesFeedSchema.parse({ schemaVersion: 1, codes, sources });
const checked = applyCodeChecks(codes, CODE_CHECKS);
for (const c of checked.unmatched)
console.log(
`build-codes: check ${c.game} ${c.code} (${c.checked}) matches no code; prune it`,
);
const feed = CodesFeedSchema.parse({
schemaVersion: 1,
codes: checked.codes,
sources,
});
await mkdir(`${out}/data`, { recursive: true });
await Bun.write(`${out}/data/codes.v1.json`, JSON.stringify(feed));
await mkdir(root, { recursive: true });