Fix the audit's concurrency, stale state and delivery findings
Some checks failed
Validate and deploy Sokko G / validate (push) Failing after 19m40s
Validate and deploy Sokko G / deploy (push) Has been skipped

Share uploads now reserve their slot, bytes and per-IP count before the
disk check, so simultaneous uploads can no longer exceed the limits.
Writes to a share's metadata run one after another, and a revocation can
no longer be undone by a pending read count.

The TCG page ignores a state reload that started before or during a
mutation, the last mutation wins, and returning to the page triggers a
single reload. The card cache confirms writes only once the IndexedDB
transaction completes and shows only the current player's copy. The
administration panel loads on demand, which shrinks the TCG chunk from
311.6 to 191.8 kB.

A new /api/health route answers 503 when the cards or shares API failed
to start. The deploy script ships the commit's production dependencies
with the build, waits up to 30 s for a healthy server instead of trusting
systemctl is-active, and restores node_modules on rollback. Both Forgejo
workflows check the route on the public site. The updated script applies
once reinstalled on the server.

Unused helpers, the ignored join role and duplicate button selectors are
removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-20 21:38:12 +01:00
parent 0571a935d6
commit 067a4a8fd6
20 changed files with 391 additions and 73 deletions

View file

@ -1779,6 +1779,46 @@ test("a player chains packs of the same collection while openings remain", async
await expect(openAnother).toHaveCount(0);
});
// Une relecture partie au retour sur la page peut répondre après une mutation : l'état plus ancien qu'elle décrit ne doit pas
// remplacer celui de la mutation à l'écran.
test("a late state reload does not undo a favourite already confirmed", async ({ page }) => {
await page.goto("/#/cards/collection");
await page.getByRole("button", { name: "Version développement", exact: true }).click();
await page.locator(".nebula-album-entry:not([data-missing]) button").first().click();
const dialog = page.getByRole("dialog");
const add = dialog.getByRole("button", { name: "Ajouter aux favoris" });
const remove = dialog.getByRole("button", { name: "Retirer des favoris" });
if (await remove.isVisible()) await remove.click();
await expect(add).toBeEnabled();
let reloads = 0;
let releaseReload;
const reloadHeld = new Promise((resolvePromise) => { releaseReload = resolvePromise; });
await page.route("**/api/cards/state", async (route) => {
reloads += 1;
const response = await route.fetch();
await reloadHeld;
await route.fulfill({ response });
});
// Le focus et visibilitychange arrivent ensemble au retour sur l'onglet : une seule lecture part.
await page.evaluate(() => {
globalThis.dispatchEvent(new globalThis.Event("focus"));
globalThis.document.dispatchEvent(new globalThis.Event("visibilitychange"));
});
await expect.poll(() => reloads).toBe(1);
await add.click();
await expect(remove).toHaveAttribute("aria-pressed", "true");
releaseReload();
await page.waitForResponse("**/api/cards/state");
await page.unroute("**/api/cards/state");
await expect(remove).toHaveAttribute("aria-pressed", "true");
expect(reloads).toBe(1);
await remove.click();
await expect(add).toHaveAttribute("aria-pressed", "false");
});
test("the Sokko TCG menu entry shows a count while the opening reserve is full", async ({ page }) => {
const cardsLink = page.getByRole("navigation", { name: "Navigation principale" }).getByRole("link", { name: /^Sokko TCG/ });
const count = cardsLink.locator(".nav-icon-count");