# Task D.7.10 Setup Integration Test & Golden Dataset

Date: 2026-07-03
Status: implemented

## Scope Delivered

Added official setup golden dataset:

- `setup/golden-dataset/README.md`
- `setup/golden-dataset/dataset.json`
- 22 setup CSV files matching `setup/templates/templates.json`

Dataset coverage:

- Organizations: `ALLA`, `ONVALLA`
- Users: IT/admin, marketing, sales, sales manager, CEO
- Customers: 10
- Contacts: 20
- Leads: 20
- Opportunities: 15
- Quotations: 20
- Multiple branches and product types
- Quotation statuses: draft, pending approval, approved, rejected, revision

Added setup integration documentation:

- `docs/setup/integration-scenarios.md`
- `docs/setup/setup-performance-report.md`

Added automated setup contract tests:

- `src/tests/setup/helpers.ts`
- `src/tests/setup/golden-dataset.test.ts`
- `src/tests/setup/setup-install.test.ts`
- `src/tests/setup/setup-preview.test.ts`
- `src/tests/setup/setup-commit.test.ts`
- `src/tests/setup/setup-verification.test.ts`
- `src/tests/setup/setup-resume.test.ts`
- `src/tests/setup/setup-reset.test.ts`

Added script:

- `npm run test:setup`

## Test Coverage

The setup test suite validates:

- Golden dataset files exist.
- Golden dataset headers match official setup templates.
- Required row counts are present.
- Quotation statuses cover approval and revision scenarios.
- Golden dataset includes every supported setup template.
- Dataset import order follows template registry ordering.
- Preview hash semantics change when CSV content changes.
- Commit API and seed manifest integration exist.
- Commit engine preserves preview hash validation contract.
- Setup readiness and verification APIs exist.
- Setup run resume APIs exist.
- Setup wizard persists core step outputs.
- Reset and reseed APIs exist.
- Reset guard source blocks production and requires preview token semantics.
- Unsafe reset scopes are intentionally blocked.
- Integration scenarios document operational readiness checks.

## Validation

- `npm run test:setup` passed: 17 tests.
- `npm run typecheck -- --pretty false` passed.
- `npx oxlint src/tests/setup` passed.

## Residual Notes

- This task adds runnable setup contract tests using Node's built-in test runner to avoid introducing a new test framework.
- Full empty-database E2E execution is documented in `docs/setup/integration-scenarios.md` but not automated because this repository does not yet have an isolated CI test database harness.
- Performance targets are documented in `docs/setup/setup-performance-report.md`; measured preview/commit/verification timings require the future isolated database harness.
