Files
SnapOtter/tests/fixtures
SnapOtterandGitHub d10d0f544f 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.
2026-07-27 15:37:30 +08:00
..

Test Fixtures

Shared test fixtures for the SnapOtter test suite. Organized by modality in two tiers.

Two-Tier Structure

Tier 1: Tiny Synthetics (matrices/format coverage) Small, project-generated files for format-compatibility matrices and fast unit tests. Located in */formats/, */edge/, */hostile/, and security/.

Tier 2: Real Heroes (depth/fidelity testing) Larger, content-representative files for integration and fidelity tests. Located in */valid/. Each must be tracked in manifest.json with sha256 + provenance.

Modality-First Layout

tests/fixtures/
  index.ts            # Typed registry (import paths from here, not raw strings)
  manifest.json       # sha256 + bytes + provenance for all valid/ assets
  gen-manifest.mjs    # Script to re-stamp manifest hashes
  gen-synthetic-content.mjs  # Regenerate CC0 synthetics (QR, barcode, OCR, etc.)
  LICENSES.md         # Provenance audit trail
  image/
    valid/            # Base test images, portraits, OCR, barcodes, QR codes
    formats/          # 35 format samples (sample.png, sample.arw, sample.psd, ...)
    edge/             # Edge cases (1x1, blank, extreme aspect, fake transparency)
    hostile/          # Truncated, zero-byte, garbage, bomb, extension-mismatch
  video/
    valid/            # BBB heroes (mov/webm/mkv/avi), TTS speech, metadata MP4
    formats/          # tiny.{mp4,webm,avi,...}, subtitle files (srt/vtt/ass)
    hostile/          # Truncated MP4
  audio/
    valid/            # TTS speech (wav/flac/ogg/m4a/aac/opus), tagged MP3
    formats/          # tiny.{mp3,wav,flac,...}, tone-stereo, tone-gap
    hostile/          # Zero-byte WAV
  document/
    valid/            # PDFs (3-page, 6-page, encrypted, OCR-scanned)
    formats/          # tiny.{docx,xlsx,epub,html,md}
    edge/             # remote-img.html (SSRF test vector)
    hostile/          # Truncated DOCX, garbage PDF
  data/
    valid/            # tiny.{csv,json,xml,yaml,tsv,zip}
  security/           # SVG XXE test vectors (file-read, SSRF)

Using the Registry

Always import paths from tests/fixtures/index.ts rather than hard-coding paths:

import { fixtures, readFixture } from "../../fixtures/index.js";

// Direct path access
const pngPath = fixtures.image.base.png200;

// Read bytes
const buffer = readFixture(fixtures.image.base.png200);

// Format accessor (for matrix iteration)
const arwPath = fixtures.image.formats("arw");
const mp4Path = fixtures.video.tiny("mp4");

Adding a Fixture

  1. Add the file to the appropriate modality directory
  2. Add a key in tests/fixtures/index.ts pointing to it
  3. Run node tests/fixtures/gen-manifest.mjs (for valid/ files)
  4. Fill in sourceUrl and license in manifest.json (required)
  5. Update LICENSES.md with the provenance record
  6. Run the guards: pnpm vitest run tests/unit/fixtures/

Licensing Gate

Every valid/ hero must have a verified license (CC0, CC-BY, CC-BY-SA, or public-domain). Assets with UNVERIFIED-REVIEW need license review before release. The manifest guard test reports the current count.

Guard Tests

Four guard tests protect fixture integrity:

  • fixture-resolve (unit): every registry path exists and is non-empty
  • fixture-budget (unit): per-extension size caps prevent bloat
  • fixture-manifest (unit): sha256/bytes in manifest.json match disk
  • fixture-integrity (integration): real heroes decode through Sharp/ffprobe/qpdf

Generator Scripts

Three generators produce deterministic synthetics. All are idempotent and skip existing files to avoid breaking manifest hashes. See tests/README.md for details.