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.
96 lines
3.7 KiB
TypeScript
96 lines
3.7 KiB
TypeScript
import { existsSync, readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
import { countStructures } from "../../../scripts/i18n/lib/mask.mjs";
|
|
import { localeCodes } from "../../../scripts/i18n/lib/shared-i18n.mjs";
|
|
|
|
const root = process.cwd();
|
|
|
|
function source(relativePath: string): string {
|
|
return readFileSync(path.resolve(root, relativePath), "utf8");
|
|
}
|
|
|
|
describe("operator recovery policy", () => {
|
|
it("keeps the quick-start guide on the canonical production Compose file", () => {
|
|
const guide = source("apps/docs/guide/getting-started.md");
|
|
|
|
expect(guide).toContain("docker/docker-compose.yml");
|
|
expect(guide).toContain("POSTGRES_PASSWORD");
|
|
expect(guide).toContain("REDIS_PASSWORD");
|
|
expect(guide).not.toMatch(/## Docker Compose[\s\S]*?```yaml/);
|
|
});
|
|
|
|
it("documents every runtime volume and the actual persistent file paths", () => {
|
|
const guide = source("apps/docs/guide/security.md");
|
|
|
|
for (const value of [
|
|
"SnapOtter-data",
|
|
"SnapOtter-workspace",
|
|
"SnapOtter-pgdata",
|
|
"SnapOtter-redisdata",
|
|
"/data/files",
|
|
"/data/ai/venv",
|
|
]) {
|
|
expect(guide, `security guide must document ${value}`).toContain(value);
|
|
}
|
|
});
|
|
|
|
it("pins the disposable backup helper image by multi-platform digest in every locale", () => {
|
|
const alpine =
|
|
"alpine:3.22@sha256:14358309a308569c32bdc37e2e0e9694be33a9d99e68afb0f5ff33cc1f695dce";
|
|
|
|
for (const locale of localeCodes()) {
|
|
const prefix = locale === "en" ? "" : `${locale}/`;
|
|
const guide = source(`apps/docs/${prefix}guide/security.md`);
|
|
expect(guide, `${locale}/guide/security.md`).toContain(alpine);
|
|
expect(guide, `${locale}/guide/security.md`).not.toMatch(/alpine:3\.22(?!@sha256:)/);
|
|
}
|
|
});
|
|
|
|
it("uses fail-fast logical database backup and restore commands", () => {
|
|
for (const guidePath of ["apps/docs/guide/security.md", "apps/docs/guide/database.md"]) {
|
|
const guide = source(guidePath);
|
|
expect(guide, guidePath).toContain("pg_dump --format=custom");
|
|
expect(guide, guidePath).toContain("pg_restore --exit-on-error");
|
|
expect(guide, guidePath).not.toContain("cat backup.sql");
|
|
}
|
|
});
|
|
|
|
it("does not promise zero egress while opt-out telemetry is enabled", () => {
|
|
const guide = source("apps/docs/guide/security.md");
|
|
|
|
expect(guide).not.toContain("zero outbound network connections");
|
|
expect(guide).toContain("SNAPOTTER_TELEMETRY=0");
|
|
expect(guide).toContain("Sentry");
|
|
expect(guide).toContain("PostHog");
|
|
});
|
|
|
|
it("ships an executable, isolated backup and restore drill", () => {
|
|
const drillPath = path.resolve(root, "tests/qa/backup-restore-drill.sh");
|
|
expect(existsSync(drillPath)).toBe(true);
|
|
|
|
const drill = source("tests/qa/backup-restore-drill.sh");
|
|
expect(drill).toContain("set -eu");
|
|
expect(drill).toContain("QA_IMAGE");
|
|
expect(drill).toContain("pg_dump --format=custom");
|
|
expect(drill).toContain("pg_restore --exit-on-error");
|
|
expect(drill).toContain("sha256sum");
|
|
expect(drill).toContain("docker compose");
|
|
});
|
|
|
|
it("preserves executable Markdown structures in every localized operator guide", () => {
|
|
const guides = ["database", "developer", "getting-started", "security"];
|
|
const locales = localeCodes().filter((locale) => locale !== "en");
|
|
|
|
for (const guide of guides) {
|
|
const expected = countStructures(source(`apps/docs/guide/${guide}.md`));
|
|
for (const locale of locales) {
|
|
const translated = countStructures(source(`apps/docs/${locale}/guide/${guide}.md`));
|
|
expect(translated, `${locale}/${guide}.md changed protected Markdown structures`).toEqual(
|
|
expected,
|
|
);
|
|
}
|
|
}
|
|
});
|
|
});
|