fix: release QA hardening across processing, media, security, and CI gates (#649)

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.
This commit is contained in:
SnapOtter
2026-07-27 15:37:30 +08:00
committed by GitHub
parent bc32f86a07
commit d10d0f544f
855 changed files with 54564 additions and 13092 deletions
@@ -207,15 +207,11 @@ describe("compress downscale pass (L110, L117)", () => {
// 6x13; the whole-condition `-> false` mutant never breaks and shrinks to 2x4;
// the `newWidth < 10 -> false` operand mutant loses the width guard so 8x17 no
// longer breaks. All three change the exact output dimensions.
it("stops the downscale loop when the width axis hits the floor (kills L110 width operand)", async () => {
it("fails clearly when the width axis reaches the floor before the target is met", async () => {
const asymmetric = await seededPhoto(20, 40, 55555, 3, 2, 120);
const result = await compress(sharp(asymmetric), { targetSizeBytes: 1, format: "jpg" });
const info = await outputInfo(result);
expect(info.width).toBe(11);
expect(info.height).toBe(23);
// The 10px floor is respected on both axes: dimensions never drop below 10.
expect(info.width).toBeGreaterThanOrEqual(10);
expect(info.height).toBeGreaterThanOrEqual(10);
await expect(
compress(sharp(asymmetric), { targetSizeBytes: 1, format: "jpg" }),
).rejects.toThrow("Unable to compress image to 1 bytes within safe resize limits");
});
// Transposed source (40x20): the passes are 30x15, 23x11, then 17x8 which trips
@@ -224,25 +220,21 @@ describe("compress downscale pass (L110, L117)", () => {
// mutant loses the height guard, so 17x8 no longer breaks and the output shrinks
// further. The width-axis case above cannot catch this operand; only a
// height-limited source can.
it("stops the downscale loop when the height axis hits the floor (kills L110 height operand)", async () => {
it("fails clearly when the height axis reaches the floor before the target is met", async () => {
const asymmetric = await seededPhoto(40, 20, 55555, 3, 2, 120);
const result = await compress(sharp(asymmetric), { targetSizeBytes: 1, format: "jpg" });
const info = await outputInfo(result);
expect(info.width).toBe(23);
expect(info.height).toBe(11);
expect(info.width).toBeGreaterThanOrEqual(10);
expect(info.height).toBeGreaterThanOrEqual(10);
await expect(
compress(sharp(asymmetric), { targetSizeBytes: 1, format: "jpg" }),
).rejects.toThrow("Unable to compress image to 1 bytes within safe resize limits");
});
// A 13x13 source scales to exactly 10x10 on the first pass. With `< 10`
// (correct) that is NOT below the floor, so the loop continues and the final
// fallback returns 10x10. The L110 Equality `< -> <=` mutant treats 10 as below
// the floor, breaks on pass 1, and returns the un-scaled 13x13 instead.
it("keeps a dimension that lands exactly on 10 (kills L110 equality)", async () => {
it("does not claim success when the 10px floor still exceeds the target", async () => {
const tiny = await seededPhoto(13, 13, 987654321, 3, 2, 120);
const result = await compress(sharp(tiny), { targetSizeBytes: 1, format: "jpg" });
const info = await outputInfo(result);
expect(info.width).toBe(10);
expect(info.height).toBe(10);
await expect(compress(sharp(tiny), { targetSizeBytes: 1, format: "jpg" })).rejects.toThrow(
"Unable to compress image to 1 bytes within safe resize limits",
);
});
});