mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
A release-readiness QA pass over the whole product. The commits split into defects a user would hit and gates that were reporting green while measuring nothing. ## Fixes that change behaviour Rate limiting was bypassable on every install: TRUST_PROXY defaulted to true, so request.ip came from a client-set header and a forged X-Forwarded-For got past the login limiter. The default is now a private-network trust list. A transient Postgres outage stranded in-flight jobs, leaving finished output on disk with no row pointing at it. A reconciler now resolves those rows and adopts the bytes rather than dropping the work. A Redis connection that moved to a new address wedged every read-blocked consumer, so completions stopped signalling while health still answered 200. Socket timeouts plus subscriber pings recover it. Installing more than one AI bundle left the shared venv multi-versioned and silently broke three tools. The installer now reconciles distributions to one version each. Converting an image to JXL at quality 1 through 4 returned a 500, because libjxl 0.7 rejects the distance those values compute. The quality is floored at what the encoder honours. A missing ffmpeg was also reported to the user as a corrupt upload; it now says the engine is unavailable. RAW uploads reached an unpatched LibRaw on arm64, so it is built from source at 0.22.2, and the release scan was split so it can fail on an unfixed critical instead of hiding it behind ignore-unfixed. ## Gates that could not fail Two mutation lanes ran zero mutants because Stryker crawled the gitignored docs build; coverage discarded its whole report on any failing test; the lint gate skipped root tests, scripts, and two workspaces; and several generated matrices counted a host missing ffmpeg as a passing tool. Each now measures what it claims. Full evidence and the outstanding release items are tracked locally and are not part of this branch.
83 lines
3.3 KiB
TypeScript
83 lines
3.3 KiB
TypeScript
// tests/e2e-landing/en-only-links.spec.ts
|
|
import { expect, test } from "@playwright/test";
|
|
import { SUPPORTED_LOCALES } from "@snapotter/shared";
|
|
|
|
// Regression guard (QA sweep): tool-detail pages (/tools/<section>/<tool>/) and the
|
|
// /self-hosted pages are built ONLY in English (no per-locale route). Localized pages
|
|
// must therefore link to their UN-PREFIXED English URLs; a locale-prefixed link 404s in
|
|
// the static build.
|
|
const LOCALES = SUPPORTED_LOCALES.map((l) => l.code).filter((code) => code !== "en");
|
|
// Rendered checks are the expensive ones, so two locales carry them and the rest
|
|
// are swept at the markup level. Two locales used to be the whole guard, which is
|
|
// how a fan-out across all twenty went unnoticed.
|
|
const RENDERED_LOCALES = ["de", "ja"];
|
|
const ENTRY_POINTS = ["/", "/tools/", "/tools/image/"];
|
|
|
|
function badLinks(hrefs: string[], loc: string) {
|
|
// Tool-detail = /<loc>/tools/<section>/<tool>/ (two path segments after /tools/).
|
|
// The /<loc>/tools/ index and /<loc>/tools/<section>/ pages ARE localized and stay prefixed.
|
|
const toolDetailRe = new RegExp(`^/${loc}/tools/[^/]+/[^/]+/?$`);
|
|
return {
|
|
toolDetail: hrefs.filter((h) => toolDetailRe.test(h)),
|
|
selfHosted: hrefs.filter((h) => h.startsWith(`/${loc}/self-hosted`)),
|
|
englishToolDetail: hrefs.filter((h) => /^\/tools\/[^/]+\/[^/]+\/?$/.test(h)),
|
|
};
|
|
}
|
|
|
|
for (const loc of RENDERED_LOCALES) {
|
|
for (const entryPoint of ENTRY_POINTS) {
|
|
test(`${loc}${entryPoint}: rendered English-only links are not locale-prefixed`, async ({
|
|
page,
|
|
}) => {
|
|
const pagePath = `/${loc}${entryPoint}`;
|
|
const res = await page.goto(pagePath);
|
|
expect(res?.status()).toBeLessThan(400);
|
|
|
|
const hrefs = await page.$$eval("a[href]", (nodes) =>
|
|
nodes.map((n) => n.getAttribute("href") ?? ""),
|
|
);
|
|
const bad = badLinks(hrefs, loc);
|
|
|
|
expect(
|
|
bad.toolDetail,
|
|
`localized tool-detail links on ${pagePath} (must be un-prefixed /tools/...): ${bad.toolDetail.slice(0, 3).join(", ")}`,
|
|
).toEqual([]);
|
|
expect(
|
|
bad.selfHosted,
|
|
`localized self-hosted links on ${pagePath}: ${bad.selfHosted.join(", ")}`,
|
|
).toEqual([]);
|
|
// Sanity: the un-prefixed English tool-detail links are actually present (fix didn't drop them).
|
|
expect(bad.englishToolDetail.length).toBeGreaterThan(0);
|
|
});
|
|
}
|
|
}
|
|
|
|
test("every locale's served markup keeps English-only links un-prefixed", async ({ request }) => {
|
|
expect(LOCALES.length).toBe(20);
|
|
const offenders: string[] = [];
|
|
|
|
for (const loc of LOCALES) {
|
|
for (const entryPoint of ENTRY_POINTS) {
|
|
const pagePath = `/${loc}${entryPoint}`;
|
|
const res = await request.get(pagePath);
|
|
expect(res.status(), `${pagePath} did not serve`).toBeLessThan(400);
|
|
const html = await res.text();
|
|
|
|
const hrefs = [...html.matchAll(/\shref=["']([^"']*)["']/gi)].map((m) => m[1]);
|
|
const bad = badLinks(hrefs, loc);
|
|
for (const href of [...bad.toolDetail, ...bad.selfHosted]) {
|
|
offenders.push(`${pagePath} -> ${href}`);
|
|
}
|
|
expect(
|
|
bad.englishToolDetail.length,
|
|
`${pagePath} lost its English detail links`,
|
|
).toBeGreaterThan(0);
|
|
}
|
|
}
|
|
|
|
expect(
|
|
offenders,
|
|
`locale-prefixed links to English-only pages:\n ${offenders.slice(0, 10).join("\n ")}`,
|
|
).toEqual([]);
|
|
});
|