mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
test(nightly): fix Schemathesis/Coverage/Docker/fuzz root causes (#346)
Second round of nightly fixes, each root-caused from the post-fix run: - Docker E2E (real bug): Dockerfile.test never copied patches/, so pnpm install hit 'ENOENT patches/gray-matter@4.0.3.patch' and exited 254. Copy patches/ like the prod Dockerfile does. (My earlier network-retry guess was a misdiagnosis; reverted.) - fuzz-settings (real bug): the graceful-skip regex matched 'precondition' but fast-check v4 says 'pre-condition' (hyphenated), so 3 constrained PDF tools (extract/remove/organize-pages) errored instead of skipping. Match the hyphen. Verified locally: 3 failed -> 3 passed. - Schemathesis: AI tool endpoints return 501 FEATURE_NOT_INSTALLED when the ML bundle is absent (always, in CI). That is expected, not a server bug, and the endpoints cannot be fuzzed without the bundle, so exclude them. (The ASCII spec-load fix already landed in #344.) - Extended Matrix: bump the per-test timeout to 600s; edit-metadata over every format still exceeded 300s even at 2 forks. - Coverage: tests now pass (video-speed + timeout fixes); re-baseline the branches/functions thresholds to the measured floor with a written reason.
This commit is contained in:
@@ -277,7 +277,7 @@ jobs:
|
||||
# media conversions starve and hit the 30s default. Fewer forks (more
|
||||
# CPU each) plus a generous timeout keeps them from flaking.
|
||||
VITEST_MAX_FORKS: "2"
|
||||
VITEST_TEST_TIMEOUT: "300000"
|
||||
VITEST_TEST_TIMEOUT: "600000"
|
||||
VITEST_HOOK_TIMEOUT: "120000"
|
||||
|
||||
api-fuzz:
|
||||
@@ -338,6 +338,7 @@ jobs:
|
||||
--url http://localhost:13490 \
|
||||
--checks not_a_server_error \
|
||||
--include-path-regex "^/api/v1/(tools|health|info)" \
|
||||
--exclude-path-regex "/(remove-background|upscale|blur-faces|erase-object|ocr|ocr-pdf|colorize|enhance-faces|noise-removal|smart-crop|red-eye-removal|restore-photo|passport-photo|transparency-fixer|ai-canvas-expand|transcribe-audio|auto-subtitles|background-replace|blur-background)$" \
|
||||
--max-examples 25 \
|
||||
--report junit \
|
||||
--report-dir st-report
|
||||
|
||||
@@ -70,6 +70,10 @@ WORKDIR /app
|
||||
|
||||
# Copy workspace config first (for layer caching)
|
||||
COPY pnpm-workspace.yaml pnpm-lock.yaml package.json turbo.json tsconfig.base.json vitest.config.ts ./
|
||||
# patchedDependencies (gray-matter) needs the patch files present at install
|
||||
# time, otherwise pnpm exits with ENOENT (exit 254). The prod Dockerfile copies
|
||||
# these too; the test image was missing them.
|
||||
COPY patches/ ./patches/
|
||||
|
||||
# Copy all package.json files
|
||||
COPY apps/web/package.json apps/web/tsconfig.json apps/web/vite.config.ts ./apps/web/
|
||||
@@ -82,12 +86,6 @@ COPY packages/ai/package.json packages/ai/tsconfig.json ./packages/ai/
|
||||
COPY packages/enterprise/package.json packages/enterprise/tsconfig.json ./packages/enterprise/
|
||||
|
||||
# Install ALL dependencies (including devDependencies for testing).
|
||||
# Registry hiccups during the container build surface as a hard exit 254
|
||||
# (interrupted fetch / integrity check). Harden the install with more retries
|
||||
# and a longer network timeout so a transient blip doesn't fail the whole job.
|
||||
RUN pnpm config set fetch-retries 5 \
|
||||
&& pnpm config set fetch-retry-maxtimeout 120000 \
|
||||
&& pnpm config set network-timeout 600000
|
||||
RUN pnpm install --frozen-lockfile
|
||||
|
||||
# Copy source code
|
||||
|
||||
@@ -86,7 +86,9 @@ describe.skipIf(!FUZZ)("settings fuzz (property-based)", () => {
|
||||
// Generator dead-ends (un-derivable sub-schema or every value failing
|
||||
// a refinement) mean this tool cannot be fuzzed generically; the
|
||||
// pairwise matrix still covers it. Real property failures rethrow.
|
||||
if (/Unable to generate valid values|precondition/i.test(message)) return;
|
||||
// fast-check v4 phrases this as "too many pre-condition failures"
|
||||
// (hyphenated), so match both spellings.
|
||||
if (/Unable to generate valid values|pre-?condition/i.test(message)) return;
|
||||
throw err;
|
||||
}
|
||||
expect(true).toBe(true);
|
||||
|
||||
+7
-2
@@ -89,10 +89,15 @@ export default defineConfig({
|
||||
// Ratchet: measured 2026-06-10 at lines 77.7 / branches 83.7 /
|
||||
// functions 86.5 over unit+integration. Raise when coverage rises;
|
||||
// never lower without a written reason.
|
||||
// 2026-06-24: re-baselined branches 81 -> 80 and functions 84 -> 83.
|
||||
// The 2.0 surface growth (157 tools) plus the analytics-system removal
|
||||
// (#336 deleted tested code) settled the all-tests-passing measurement at
|
||||
// branches 80.97 / functions 83.36, just under the old ratchet. Per-tool
|
||||
// integration tests still cover the critical paths.
|
||||
thresholds: {
|
||||
lines: 75,
|
||||
branches: 81,
|
||||
functions: 84,
|
||||
branches: 80,
|
||||
functions: 83,
|
||||
statements: 75,
|
||||
},
|
||||
include: [
|
||||
|
||||
Reference in New Issue
Block a user