fix(integration): webhook v2 events, storage migrate, test theatre

- F1: DOCUMENT_DECLINED handler (v2 Decline vs Reject) — routes to same
  handler as DOCUMENT_REJECTED until product refines downstream UX
- Add RECIPIENT_VIEWED / RECIPIENT_SIGNED v2-alias cases with telemetry
  logging so we see when v2 deployments emit them
- D1: populate TABLES_WITH_STORAGE_KEYS (files, berth_pdf_versions,
  brochure_versions, gdpr_exports) — was an empty list, migrated 0 files
- MinIO putObject/getObject/statObject/removeObject socket timeout wrapper
  to prevent worker hangs on TCP blackhole (30s deadline)
- E1: convert test.skip on smoke-setup infra failure to throw new Error
  so green-skipped silence becomes a real test failure (Playwright
  doesn't expose vitest's expect.fail)
- Regression tests: folderId='' → null transform, applyEntityRestoredSuffix
  no-op (never-archived), syncEntityFolderName collision loop past (2)

Note: matching .env.example documentation (D2 — bare DOCUMENSO_API_URL,
DOCUMENSO_API_VERSION, MINIO_AUTO_CREATE_BUCKET, DOCUMENSO_TEMPLATE_ID_EOI,
recipient role id vars) prepared but not committed — pre-commit hook
blocks .env*. Apply manually via the separate .env workflow.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 14:02:26 +02:00
parent 955911302b
commit 9a5ba87d6c
7 changed files with 352 additions and 38 deletions

View File

@@ -94,14 +94,15 @@ test.describe('Documents hub — aggregated view', () => {
email: `hubagg${Date.now()}@e2e.test`,
},
});
// If creation fails (e.g. no active port cookie yet), skip gracefully —
// we still assert basic hub structure in the earlier tests.
// A non-2xx here means smoke setup is broken (port cookie / seed) or the
// clients API regressed. Fail loud rather than skip green — a silent skip
// masked an infra failure for weeks in the audit window. Playwright doesn't
// expose vitest's `expect.fail`, so we throw a plain Error which the
// runner promotes to a failing test the same way.
if (!res.ok()) {
test.skip(
true,
`Client create returned ${res.status()} — entity sub-folder assertion skipped`,
throw new Error(
`Client create returned ${res.status()} ${await res.text()} — entity sub-folder assertion cannot proceed`,
);
return;
}
const { data: client } = (await res.json()) as {
data: { id: string; firstName: string; lastName: string };

View File

@@ -37,9 +37,11 @@ test.describe('Documents hub — upload into entity folder', () => {
email: `uploadsmoke${Date.now()}@e2e.test`,
},
});
// Playwright doesn't expose vitest's `expect.fail`; throw to fail loud.
if (!clientRes.ok()) {
test.skip(true, `Client create returned ${clientRes.status()} — upload test skipped`);
return;
throw new Error(
`Client create returned ${clientRes.status()} ${await clientRes.text()} — upload test cannot proceed`,
);
}
const { data: client } = (await clientRes.json()) as {
data: { id: string; firstName: string; lastName: string };
@@ -126,8 +128,9 @@ test.describe('Documents hub — upload into entity folder', () => {
},
});
if (!clientRes.ok()) {
test.skip(true, `Client create returned ${clientRes.status()} — test skipped`);
return;
throw new Error(
`Client create returned ${clientRes.status()} ${await clientRes.text()} — folderId test cannot proceed`,
);
}
const { data: client } = (await clientRes.json()) as {
data: { id: string; firstName: string; lastName: string };
@@ -148,10 +151,12 @@ test.describe('Documents hub — upload into entity folder', () => {
clientId: client.id,
},
});
// Seed upload may fail if files module isn't fully wired — skip gracefully.
// Seed upload failing means the files API is broken — fail loud so the
// infra regression surfaces in CI instead of staying green-skipped.
if (!seedUpload.ok()) {
test.skip(true, `Seed upload returned ${seedUpload.status()} — folderId test skipped`);
return;
throw new Error(
`Seed upload returned ${seedUpload.status()} ${await seedUpload.text()} — folderId test cannot proceed`,
);
}
// 3. List files for this client to discover the folder id.
@@ -162,8 +167,9 @@ test.describe('Documents hub — upload into entity folder', () => {
},
);
if (!listRes.ok()) {
test.skip(true, `File list returned ${listRes.status()} — folderId test skipped`);
return;
throw new Error(
`File list returned ${listRes.status()} ${await listRes.text()} — folderId test cannot proceed`,
);
}
// 4. Navigate and verify — folder view shows the client entity sections.