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.
109 lines
4.3 KiB
TypeScript
109 lines
4.3 KiB
TypeScript
// @vitest-environment node
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
import { SECTIONS, TOOLS, toolSection } from "@snapotter/shared";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
/**
|
|
* README and DOCKERHUB carry the only exact numbers CLAUDE.md allows on a public
|
|
* surface: per-section tool counts derived from toolSection(). Both had Image at
|
|
* 105 against a live 107, DOCKERHUB had PDF at 28 against 29, both claimed 14
|
|
* output formats against a convert enum of 17, and DOCKERHUB advertised
|
|
* pipelines with unlimited steps against a Zod .max() of 20.
|
|
*
|
|
* The counts move on every tool added, so they get derived here rather than
|
|
* restated. The headline claim stays "200+ tools" on both files.
|
|
*/
|
|
|
|
const ROOT = path.resolve(__dirname, "../../..");
|
|
const read = (rel: string) => readFileSync(path.join(ROOT, rel), "utf8");
|
|
|
|
const SURFACES = ["README.md", "DOCKERHUB.md"] as const;
|
|
|
|
/** README writes "Image (107)", DOCKERHUB writes "Documents / PDF (29)". */
|
|
const SECTION_LABELS: Record<string, RegExp> = {
|
|
image: /\*\*Image \((\d+)\)/,
|
|
video: /\*\*Video \((\d+)\)/,
|
|
audio: /\*\*Audio \((\d+)\)/,
|
|
pdf: /\*\*(?:Documents \/ )?PDF \((\d+)\)/,
|
|
files: /\*\*Files \((\d+)\)/,
|
|
};
|
|
|
|
function liveSectionCount(sectionId: string): number {
|
|
return TOOLS.filter((t) => toolSection(t) === sectionId).length;
|
|
}
|
|
|
|
/** The convert tool's output enum is the real answer to "how many output formats". */
|
|
function outputFormatCount(): number {
|
|
const src = read("apps/api/src/routes/tools/convert.ts");
|
|
const block = src.match(/format:\s*z\.enum\(\[([\s\S]*?)\]\)/);
|
|
if (!block) throw new Error("could not read the convert output-format enum");
|
|
return [...block[1].matchAll(/"([a-z0-9]+)"/g)].length;
|
|
}
|
|
|
|
/** MAX_PIPELINE_STEPS default, which routes/pipeline.ts feeds to a Zod .max(). */
|
|
function pipelineStepDefault(): number {
|
|
const src = read("apps/api/src/lib/env.ts");
|
|
const match = src.match(/MAX_PIPELINE_STEPS:\s*z\.coerce\.number\(\)\.default\((\d+)\)/);
|
|
if (!match) throw new Error("could not read MAX_PIPELINE_STEPS from env.ts");
|
|
return Number(match[1]);
|
|
}
|
|
|
|
describe("public per-section tool counts", () => {
|
|
it("derived a plausible catalog", () => {
|
|
const total = SECTIONS.reduce((n, s) => n + liveSectionCount(s.id), 0);
|
|
expect(total).toBe(TOOLS.length);
|
|
expect(SECTIONS.length).toBe(5);
|
|
});
|
|
|
|
it.each(SURFACES.flatMap((file) => SECTIONS.map((s) => [file, s.id] as const)))(
|
|
"%s states the live %s count",
|
|
(file, sectionId) => {
|
|
const match = read(file).match(SECTION_LABELS[sectionId]);
|
|
expect(match, `no ${sectionId} bullet in ${file}`).not.toBeNull();
|
|
expect(Number(match?.[1])).toBe(liveSectionCount(sectionId));
|
|
},
|
|
);
|
|
|
|
it.each(SURFACES)("%s keeps the 200+ headline and no exact total", (file) => {
|
|
const text = read(file);
|
|
expect(text).toContain("200+ tools");
|
|
expect(text.replaceAll("200+ tools", "")).not.toMatch(/\b\d+\+? tools\b/);
|
|
});
|
|
});
|
|
|
|
describe("public capability claims", () => {
|
|
it.each(SURFACES)("%s states the live output-format count", (file) => {
|
|
const match = read(file).match(/(\d+) output formats/);
|
|
expect(match).not.toBeNull();
|
|
expect(Number(match?.[1])).toBe(outputFormatCount());
|
|
});
|
|
|
|
it.each(SURFACES)("%s does not promise unlimited pipeline steps", (file) => {
|
|
const text = read(file);
|
|
const bullet = text.split("\n").find((l) => l.includes("**Pipelines:**"));
|
|
expect(bullet).toBeDefined();
|
|
expect(bullet?.toLowerCase()).not.toMatch(/unlimited steps/);
|
|
expect(bullet).toContain(`${pipelineStepDefault()} steps`);
|
|
});
|
|
|
|
it("DOCKERHUB pins the tag examples to the released major", () => {
|
|
const version = JSON.parse(read("package.json")).version as string;
|
|
const [major, minor] = version.split(".");
|
|
const text = read("DOCKERHUB.md");
|
|
for (const tag of [version, `${major}.${minor}`, major]) {
|
|
expect(text, `missing \`${tag}\` tag row`).toContain(`| \`${tag}\` |`);
|
|
}
|
|
});
|
|
|
|
it("DOCKERHUB names the released version in its banner", () => {
|
|
const version = JSON.parse(read("package.json")).version as string;
|
|
const banner = read("DOCKERHUB.md")
|
|
.split("\n")
|
|
.find((l) => l.startsWith("> **SnapOtter"));
|
|
expect(banner).toBeDefined();
|
|
expect(banner).toContain(`\`${version}\``);
|
|
expect(banner).toContain(`/tag/v${version}`);
|
|
});
|
|
});
|