The server half of the admin rework. The pages still run on it unchanged - every change here is additive - until the new UI replaces them. Read-only rows. web/shared/queue-rules.ts holds the queue's rules once, for the Worker and the UI: a row is locked when it is approved (its request is already committed to Git), committed (the game was observed in data/) or rejected, and also when its GAME is already published, since one appid can have several rows. /api/admin/decide refuses locked rows when it reads them and again in every UPDATE's WHERE, and reports each refused id with a reason - not-found, not-decidable, published, open-row-exists, duplicate-in-request, no-op, changed-concurrently. It used to drop them silently, so a mixed selection reported fewer decisions than it was sent. The queue listing carries `published` per row, and status=all searches every tab when there is a query. Bugs fixed on the way: - Requeueing or deferring a failed row while another row for the appid was open broke uq_queue_open_appid inside the batch: a 500 for the whole request. It is now a skip. - When an approval's commit landed and the queue update failed, the job's status was in the same rolled-back batch and stayed 'pending' forever, and the message promised reconcile would promote rows it never reads. The job is recorded first, and the message says what is actually true. - The health endpoint returned 503 without a body the page could render. New: POST /api/admin/reopen returns one rejected row to pending and deletes only its 'rejected' decision, in one transaction whose guards refuse a published game or an appid with another open row - replacing a raw-SQL step in the runbook. Jobs and audit page with totals and filters. Approval reasons are recorded in the audit row and the commit body. Reconcile sweeps pending, deferred and failed rows whose game is already in data/ to committed (a game published after its approval aged out stayed 'failed' forever), holds a cross-isolate D1 lease, and skips the ~6 MB dataset fetch while index.json's generation is unchanged. Migration 0002 adds the two tables; lib/locks.ts treats a missing table as unavailable, so the Worker and the migration can ship in either order. Overrides: the Worker can now delete a SETTLED override file - no active field, every retirement already restored - through createCommitOnBranch deletions, and every override commit writes a commit_jobs row. audit_log and commit_jobs are pruned daily after ADMIN_RETENTION_DAYS (180), which the privacy policy now states. Tests: the real handlers against the real migrations on node:sqlite (worker/testing/sqlite-d1.ts), with GitHub and the dataset faked - 57 new cases across decide, reopen, reconcile, leases, retention, override deletion and the createCommitOnBranch payload. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
31 lines
1.2 KiB
JSON
31 lines
1.2 KiB
JSON
{
|
|
// Separate from tsconfig.json on purpose: the Worker runs on workerd, not in
|
|
// a browser, so it must not see the DOM lib — otherwise browser-only globals
|
|
// typecheck fine here and then fail at runtime.
|
|
//
|
|
// worker-configuration.d.ts is generated by `npx wrangler types` from
|
|
// wrangler.jsonc and supplies Env, ExecutionContext and the runtime globals.
|
|
// Re-run that command after changing bindings or vars.
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"lib": ["ES2022"],
|
|
"module": "ESNext",
|
|
"moduleResolution": "Bundler",
|
|
"types": [],
|
|
"noEmit": true,
|
|
"isolatedModules": true,
|
|
"moduleDetection": "force",
|
|
"strict": true,
|
|
"noUnusedLocals": true,
|
|
"noUnusedParameters": true,
|
|
"noFallthroughCasesInSwitch": true,
|
|
"skipLibCheck": true
|
|
},
|
|
"include": ["worker", "shared", "worker-configuration.d.ts"],
|
|
// Tests run on Node under Vitest, not on workerd. Including them here
|
|
// would either fail (no Node types) or, worse, pass by adding Node types
|
|
// to the Worker's surface - which is exactly the confusion the split
|
|
// above exists to prevent. They are typechecked by tsconfig.test.json.
|
|
"exclude": ["worker/**/*.test.ts", "shared/**/*.test.ts", "worker/testing/**"]
|
|
}
|