# Task D.7.10 – Setup Integration Test & Golden Dataset

## Objective

Build a complete end-to-end integration test suite and Golden Dataset for the ALLA OS Setup Platform.

This task validates that a brand-new database can be transformed into a fully operational CRM system using only the Setup Platform.

The Golden Dataset becomes the canonical dataset for:

- Development
- CI/CD
- QA
- UAT
- Customer Demo
- Regression Testing

This task must not introduce new business behavior. It verifies the implementation completed in D.7.1–D.7.8.

---

# Review Before Implementation

Review

- AGENTS.md
- plans/task-d.7.md
- plans/task-d.7.1.md
- plans/task-d.7.2.md
- plans/task-d.7.3.md
- plans/task-d.7.4.md
- plans/task-d.7.5.md
- plans/task-d.7.6.md
- plans/task-d.7.7.md
- plans/task-d.7.8.md

Review

docs/setup/*

Review

setup/templates/*

Review

src/features/setup/**

Review

src/db/seeds/**

Review

CRM business modules

Customer

Lead

Opportunity

Quotation

Approval

PDF

Document Sequence

Storage

---

# Objective Validation

The following workflow must succeed without manual SQL.

Empty Database

↓

Migration

↓

Foundation Setup

↓

Organization Setup

↓

CSV Import

↓

Verification

↓

Login

↓

CRM Ready

↓

Quotation Ready

↓

Approval Ready

↓

PDF Ready

---

# Golden Dataset

Create

setup/golden-dataset/

Contents

README.md

dataset.json

organizations.csv

users.csv

memberships.csv

crm-role-assignments.csv

master-options.csv

branches.csv

product-types.csv

document-sequences.csv

approval-workflows.csv

approval-steps.csv

approval-matrix.csv

customers.csv

contacts.csv

contact-shares.csv

leads.csv

opportunities.csv

opportunity-parties.csv

quotations.csv

quotation-items.csv

quotation-parties.csv

quotation-topics.csv

quotation-topic-items.csv

This dataset becomes the official reference dataset.

---

# Dataset Rules

Organizations

ALLA

ONVALLA

Users

IT

Marketing

Sales

Sales Manager

CEO

Customers

At least

10

Contacts

At least

20

Leads

At least

20

Opportunities

At least

15

Quotations

At least

20

Include

Draft

Pending Approval

Approved

Rejected

Revision

Include

Multiple Branches

Multiple Product Types

Multiple Approval Levels

Multiple Currencies

Discount

Tax

Project Parties

Attachments metadata only

---

# Scenario Matrix

Create

docs/setup/integration-scenarios.md

Document

Scenario

Purpose

Expected Result

Required Dataset

Verification

Example

Scenario

Fresh Installation

↓

PASS

Scenario

Resume Setup

↓

PASS

Scenario

CSV Re-import

↓

Idempotent

Scenario

Duplicate Import

↓

No Duplicate

Scenario

Business Reset

↓

Foundation Retained

Scenario

Setup Run Reset

↓

Business Retained

Scenario

Preview Hash Changed

↓

Commit Blocked

Scenario

Verification After Import

↓

PASS

Scenario

Manifest Version Check

↓

PASS

---

# Automated Integration Tests

Create

src/tests/setup/

Recommended

setup-install.test.ts

setup-preview.test.ts

setup-commit.test.ts

setup-verification.test.ts

setup-resume.test.ts

setup-reset.test.ts

golden-dataset.test.ts

Tests must cover

Migration

↓

Readiness

↓

Template Registry

↓

Preview

↓

Commit

↓

Verification

↓

Manifest

↓

Resume

↓

Reset

---

# End-to-End Workflow Test

Automate

Fresh Database

↓

Run Migration

↓

Foundation Ready

↓

Create Organization

↓

Preview CSV

↓

Commit CSV

↓

Verification PASS

↓

Login

↓

Create Customer

↓

Create Lead

↓

Assign Opportunity

↓

Create Quotation

↓

Approval

↓

Generate PDF

↓

Completed

Every step must assert expected results.

---

# Idempotency Tests

Run

Import

↓

Import Again

↓

Import Again

Verify

No Duplicate

Only

Create

↓

Update

↓

Skip

Allowed.

---

# Preview Hash Tests

Verify

Preview

↓

Commit

↓

Modify CSV

↓

Commit

↓

Rejected

---

# Seed Manifest Tests

Verify

Manifest Created

↓

Manifest Item Created

↓

Checksum

↓

Version

↓

Status

↓

Resume

---

# Reset Tests

Verify

Business Reset

Deletes CRM

Keeps Foundation

Setup Run Reset

Deletes Setup Metadata

Keeps Business

Foundation Reset

Blocked

Organization Reset

Blocked

Production Reset

Blocked

CSV Rollback

Blocked

---

# Verification Tests

Verify

PASS

Environment

Database

Storage

Template

Approval

Document Sequence

Report Definitions

Notification Templates

Organization

Branch

Product Type

CRM Assignment

---

# Performance Targets

Preview

1000 rows

<5 seconds

Commit

1000 rows

<10 seconds

Verification

<3 seconds

Setup Wizard Load

<2 seconds

---

# Deliverables

setup/golden-dataset/

README.md

dataset.json

Official CSV Pack

docs/setup/integration-scenarios.md

Automated integration tests

Setup smoke test

Golden dataset validation

Performance report

---

# Acceptance Criteria

✓ Empty database can be fully initialized.

✓ Migration succeeds.

✓ Setup Wizard completes.

✓ Golden Dataset imports successfully.

✓ Verification returns PASS.

✓ Login works.

✓ Customer creation works.

✓ Lead workflow works.

✓ Opportunity workflow works.

✓ Quotation workflow works.

✓ Approval workflow works.

✓ PDF generation works.

✓ Document sequence works.

✓ Import is idempotent.

✓ Preview hash validation works.

✓ Seed manifests created.

✓ Resume works.

✓ Business reset works.

✓ Setup metadata reset works.

✓ Blocked reset scopes remain blocked.

✓ All automated integration tests pass.

✓ Golden Dataset becomes official regression dataset.

---

# Future

After D.7.10

Freeze the Setup Platform.

All future modules

(HR, Asset, Purchase, Inventory, Service, etc.)

must integrate with the existing Setup Platform rather than creating new setup or import mechanisms.

The Setup Platform becomes the single supported installation, onboarding, import, verification, and maintenance foundation for ALLA OS.
