siesa-agents 2.1.72-qa.2 → 2.1.72-qa.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/bmad/bmm/config.yaml +33 -0
  2. package/claude/skills/sa-agent-sre-sentinel/SKILL.md +180 -0
  3. package/claude/skills/sa-aplicar/SKILL.md +268 -0
  4. package/claude/skills/sa-auditar-servicio/SKILL.md +255 -0
  5. package/claude/skills/sa-nueva-transversal/SKILL.md +317 -0
  6. package/claude/skills/sa-nuevo-ambiente/SKILL.md +147 -0
  7. package/claude/skills/sa-nuevo-servicio/SKILL.md +530 -0
  8. package/claude/skills/sa-onboard-db/SKILL.md +122 -0
  9. package/claude/skills/sa-qa-data-generator/SKILL.md +200 -51
  10. package/claude/skills/sa-quality-process/SKILL.md +6 -0
  11. package/claude/skills/sa-registrar-permisos/SKILL.md +233 -0
  12. package/package.json +1 -1
  13. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/prompts/prompt_design_test.md +1037 -60
  14. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/prompts/prompt_dor_gate.md +419 -379
  15. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/prompts/prompt_e2e_executor.md +273 -0
  16. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/prompts/prompt_playwright_impl.md +359 -355
  17. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/prompts/prompt_test_plan.md +73 -111
  18. package/siesa-agents/bmm/workflows/3-solutioning/quality-process/workflow.md +1320 -997
  19. package/siesa-agents/resources/playwright-kit/.env.example +42 -0
  20. package/siesa-agents/resources/playwright-kit/README.md +228 -0
  21. package/siesa-agents/resources/playwright-kit/allure/categories.json +26 -0
  22. package/siesa-agents/resources/playwright-kit/global-setup.ts +34 -0
  23. package/siesa-agents/resources/playwright-kit/helpers/blazor-e2e-helpers.ts +417 -0
  24. package/siesa-agents/resources/playwright-kit/helpers/react-e2e-helpers.ts +297 -0
  25. package/siesa-agents/resources/playwright-kit/package-lock.json +850 -0
  26. package/siesa-agents/resources/playwright-kit/package.json +27 -0
  27. package/siesa-agents/resources/playwright-kit/playwright.config.ts +60 -0
  28. package/siesa-agents/resources/playwright-kit/proposed/.gitkeep +0 -0
  29. package/siesa-agents/resources/playwright-kit/reporters/agiletest-reporter.ts +252 -0
  30. package/siesa-agents/resources/playwright-kit/specs/.gitkeep +0 -0
  31. package/siesa-agents/resources/playwright-kit/specs/architecture-brief-siesa-erp.md +85 -0
  32. package/siesa-agents/resources/playwright-kit/specs/architecture-brief-siesa-react.md +109 -0
  33. package/siesa-agents/resources/playwright-kit/specs/architecture-brief-template.md +69 -0
  34. package/siesa-agents/resources/playwright-kit/tests/seed-example.spec.ts +95 -0
  35. package/siesa-agents/resources/playwright-kit/tools/locator-overlay.js +1306 -0
  36. package/siesa-agents/resources/playwright-kit/tools/locator-recorder.spec.ts +986 -0
  37. package/siesa-agents/scripts/__pycache__/bmad_to_agiletest.cpython-36.pyc +0 -0
  38. package/siesa-agents/scripts/bmad_to_agiletest.py +352 -337
  39. package/siesa-agents/scripts/converters/convert_csv_to_test_design.py +327 -0
  40. package/siesa-agents/scripts/converters/convert_excel_to_test_design.py +360 -0
  41. package/siesa-agents/scripts/converters/convert_md_to_test_design.py +359 -0
  42. package/siesa-agents/scripts/converters/convert_pdf_to_test_design.py +412 -0
  43. package/siesa-agents/scripts/converters/export_yaml_to_csv.py +149 -0
  44. package/siesa-agents/scripts/converters/export_yaml_to_excel.py +233 -0
  45. package/siesa-agents/scripts/converters/export_yaml_to_markdown.py +172 -0
  46. package/siesa-agents/scripts/converters/export_yaml_to_pdf.py +297 -0
  47. package/siesa-agents/scripts/merge_test_design.py +106 -106
  48. package/siesa-agents/scripts/playwright/yaml-to-playwright-spec.ts +203 -0
  49. package/siesa-agents/scripts/requirements.txt +7 -0
@@ -0,0 +1,122 @@
1
+ ---
2
+ name: sa-onboard-db
3
+ description: 'Generates the exact SQL block of GRANTs that must run in psql to enable the dev user on a new Cloud SQL schema, plus the connection command. Use whenever the user is provisioning a new database schema and needs the GRANT statements ready to copy-paste.'
4
+ ---
5
+
6
+ > **Contexto de ejecución:** este skill asume que el cwd está dentro de la carpeta del workspace de despliegue (`_siesa-agents/devops/` en Siesa-Agents tras correr `/sa-init-devops`, o la raíz de un clon directo de `architecture-sa-devops`). Las rutas relativas (`environments/`, `terraform/`, `k8s/`, `scripts/`, etc.) se resuelven contra ese cwd.
7
+
8
+ Genera el bloque SQL exacto de GRANTs que se debe ejecutar en psql para habilitar el usuario `dev` en un schema nuevo de Cloud SQL. También muestra el comando para conectarse.
9
+
10
+ **Uso:** `/sa-onboard-db {schema} {owner-role}`
11
+
12
+ **Ejemplo:** `/sa-onboard-db treasury treasury`
13
+
14
+ **Schemas existentes y sus owner-roles:**
15
+ | Schema | Owner role |
16
+ |---|---|
17
+ | `access_manager` | `accmgr` |
18
+ | `segment` | `segments` |
19
+ | `base_config` | `base_config` |
20
+ | `tprt` | `third_party` |
21
+ | `acct` | `accounting` |
22
+ | `liquid_tax` | `liquid_tax` |
23
+
24
+ ---
25
+
26
+ ## Instrucciones
27
+
28
+ Los argumentos son: `$ARGUMENTS`
29
+
30
+ - `SCHEMA` = primer argumento
31
+ - `OWNER_ROLE` = segundo argumento
32
+
33
+ Lee `environments/dev.yaml` para obtener:
34
+ - `PROJECT_ID` = `.gcp.project_id`
35
+ - `INSTANCE` = `.database.instance_name`
36
+ - `DB_NAME` = `.database.database_name`
37
+ - `REGION` = `.gcp.region`
38
+
39
+ ---
40
+
41
+ ### Paso 1 — Mostrar el comando de conexión
42
+
43
+ ```bash
44
+ # Conectarse a Cloud SQL via Auth Proxy
45
+ ./scripts/dev-connect.sh
46
+
47
+ # O directamente con cloud-sql-proxy:
48
+ cloud-sql-proxy {PROJECT_ID}:{REGION}:{INSTANCE} --port=5433 &
49
+
50
+ # Conectar con psql (usar PGPASSWORD del entorno):
51
+ psql "host=127.0.0.1 port=5433 dbname={DB_NAME} user=postgres"
52
+ ```
53
+
54
+ ### Paso 2 — Mostrar el bloque SQL a ejecutar
55
+
56
+ ```sql
57
+ -- ============================================================
58
+ -- Grants para schema: {SCHEMA}
59
+ -- Owner role: {OWNER_ROLE}
60
+ -- Ejecutar como: postgres
61
+ -- ============================================================
62
+
63
+ -- 1. Crear el owner role si no existe
64
+ DO $$ BEGIN
65
+ IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = '{OWNER_ROLE}') THEN
66
+ CREATE ROLE {OWNER_ROLE};
67
+ END IF;
68
+ END $$;
69
+
70
+ -- 2. Crear el schema si no existe
71
+ CREATE SCHEMA IF NOT EXISTS {SCHEMA} AUTHORIZATION {OWNER_ROLE};
72
+
73
+ -- 3. Darle al usuario dev acceso al schema
74
+ GRANT USAGE ON SCHEMA {SCHEMA} TO dev;
75
+ GRANT ALL PRIVILEGES ON SCHEMA {SCHEMA} TO dev;
76
+
77
+ -- 4. Permisos sobre objetos existentes
78
+ GRANT ALL ON ALL TABLES IN SCHEMA {SCHEMA} TO dev;
79
+ GRANT ALL ON ALL SEQUENCES IN SCHEMA {SCHEMA} TO dev;
80
+ GRANT ALL ON ALL FUNCTIONS IN SCHEMA {SCHEMA} TO dev;
81
+
82
+ -- 5. Permisos default para objetos FUTUROS (creados por migraciones EF Core)
83
+ ALTER DEFAULT PRIVILEGES IN SCHEMA {SCHEMA}
84
+ GRANT ALL ON TABLES TO dev;
85
+
86
+ ALTER DEFAULT PRIVILEGES IN SCHEMA {SCHEMA}
87
+ GRANT ALL ON SEQUENCES TO dev;
88
+
89
+ ALTER DEFAULT PRIVILEGES IN SCHEMA {SCHEMA}
90
+ GRANT ALL ON FUNCTIONS TO dev;
91
+
92
+ -- 6. Membresía del rol owner → dev puede hacer ALTER TABLE
93
+ GRANT {OWNER_ROLE} TO dev;
94
+
95
+ -- Verificar:
96
+ -- \dn+ {SCHEMA}
97
+ -- \dp {SCHEMA}.*
98
+ ```
99
+
100
+ ### Paso 3 — Notas importantes
101
+
102
+ Muestra:
103
+
104
+ ```
105
+ ⚠️ NOTAS CRÍTICAS:
106
+
107
+ 1. Usar psql, NO DBeaver — DBeaver falla con error 3F000 en GRANT DEFAULT PRIVILEGES.
108
+
109
+ 2. El GRANT {OWNER_ROLE} TO dev es obligatorio.
110
+ Sin él, EF Core puede crear tablas pero no hacer ALTER TABLE en migraciones futuras.
111
+
112
+ 3. El schema en IEntityTypeConfiguration DEBE usar "{SCHEMA}" (guión bajo),
113
+ nunca "{SCHEMA con guiones}" — genera un schema huérfano en PostgreSQL.
114
+
115
+ 4. Después de ejecutar los grants, el primer deploy correrá las migraciones
116
+ automáticamente (db.Database.MigrateAsync() en Program.cs).
117
+
118
+ 5. La contraseña del usuario postgres está en Secret Manager:
119
+ gcloud secrets versions access latest \
120
+ --secret="{SCHEMA}-dev-db-connection" \
121
+ --project={PROJECT_ID}
122
+ ```
@@ -1,19 +1,36 @@
1
1
  ---
2
2
  name: sa-qa-data-generator
3
3
  description: Generates synthetic data for QA testing by reading test case files (CSV/Excel) and querying the real database via MCP. Activate when the user provides a test case file and has a PostgreSQL or SQL Server MCP configured and connected.
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  ---
6
6
 
7
7
  # Synthetic Data Engine for QA
8
8
 
9
+ ## Usage
10
+
11
+ **Prerequisites**:
12
+ - PostgreSQL (or SQL Server) MCP configured and connected to the DB
13
+ - Dependency functions (`get_all_dependencies_json` / `dbo.GetAllDependencies_JSON`) installed in the DB
14
+ - A CSV or Excel file with the test cases
15
+
16
+ **Activation**: Provide the test case file and optionally indicate the functional process or module. The AI infers the business, confirms it with you, and does everything else automatically.
17
+
18
+ **Output to disk**: Artifacts are written next to the test case file (or in `mcp_database/output/<business>_<date>/` if the user does not indicate another path): `insertion_plan.md` (reviewable plan written and approved BEFORE inserting), `test-data.md`, `seed.sql`, `rollback.sql`.
19
+
20
+ ---
21
+
9
22
  ## Role
10
23
 
11
24
  You are an automated synthetic data generator for QA testing. Your job is to:
12
25
 
13
26
  1. Read the test case file (CSV/Excel) provided by the user
14
- 2. Query the real database via MCP to obtain schemas, dependencies, and existing data
15
- 3. **Reuse existing QA data whenever it satisfies the test case.** Only generate and insert new data for cases that cannot be covered by what already exists
16
- 4. Guarantee referential integrity, correct data types, and realistic values when insertion is required
27
+ 2. **Infer the business/domain the cases target and confirm it with the user before generating anything**
28
+ 3. Query the real database via MCP to obtain schemas, dependencies, and existing data
29
+ 4. **Reuse existing QA data whenever it satisfies the test case.** Only generate and insert new data for cases that cannot be covered by what already exists
30
+ 5. Guarantee referential integrity, correct data types, and realistic values when insertion is required
31
+ 6. **Deliver 3 artifacts on disk**: (a) `test-data.md` with the case→data relation, (b) `seed.sql` executable with the insertions, (c) `rollback.sql` that reverts exactly this run
32
+
33
+ **Three mandatory deliverables** (in addition to the direct DB insertion): for every execution that generates data you must write `test-data.md`, `seed.sql`, and `rollback.sql` to disk. The `seed.sql` lets you reload the dataset into a fresh DB without re-running the whole process; the `test-data.md` is designed so that later an AI agent (e.g., Playwright) can automate the cases by reading the literal values it must use per case.
17
34
 
18
35
  Do not invent schemas or columns. Everything you insert must be validated against the real database structure.
19
36
 
@@ -40,15 +57,15 @@ The user will provide a CSV or Excel file with test cases. The file may have dif
40
57
 
41
58
  ---
42
59
 
43
- ## Execution Protocol — 7 Phases
60
+ ## Execution Protocol — 7 Phases (with approval gate at 5.5)
44
61
 
45
- Execute these phases in order. Do not skip any. Show the result of each phase to the user before proceeding.
62
+ Execute these phases in order. Do not skip any. Show the result of each phase to the user before proceeding. There are **two mandatory stop gates**: business confirmation (Phase 1.A) and approval of `insertion_plan.md` (Phase 5.5) — at both you stop and wait for the user.
46
63
 
47
64
  ---
48
65
 
49
- ### PHASE 1 — Test Case Reading and Analysis
66
+ ### PHASE 1 — Test Case Reading, Analysis and Business Inference
50
67
 
51
- **Objective**: Understand what is being tested and what data each case needs.
68
+ **Objective**: Understand what is being tested, what data each case needs, and **which business/domain the cases target** — confirming it with the user before proceeding.
52
69
 
53
70
  **Actions**:
54
71
  1. Read the complete CSV/Excel file
@@ -61,7 +78,32 @@ Execute these phases in order. Do not skip any. Show the result of each phase to
61
78
  - Specific required values (amounts, dates, statuses, etc.)
62
79
  - Data preconditions
63
80
 
64
- **Output**: Summary table with: Case ID | Type | Entities involved | Critical required data
81
+ **1.A Business inference (confirmation GATE)**:
82
+
83
+ From the language of the cases (products, processes, terminology, amounts, units), **deduce which type of business the data targets**. This guides the realism of the values generated (item names, customers, warehouses, plausible amounts for that industry).
84
+
85
+ Present the inference to the user explicitly and **wait for confirmation**:
86
+
87
+ ```
88
+ From the content of the cases, I deduce the data targets:
89
+ >> "A clothing store" <<
90
+ Clues: items like "polo shirt", "regular t-shirt"; inventory-out process by
91
+ warehouse; sizes/colors as attributes.
92
+
93
+ Is this business correct?
94
+ - If you confirm, I will generate items, customers and amounts coherent with a clothing store.
95
+ - If not, tell me which business this data targets.
96
+ ```
97
+
98
+ - If the user **confirms** → synthetic data is generated coherent with that business.
99
+ - If the user **corrects** → use the business they indicate.
100
+ - If the cases are too generic to infer a business → **ask the user directly** which business the data targets, instead of assuming.
101
+
102
+ Record the confirmed business: it is used to name the output folder and as the header of `test-data.md`.
103
+
104
+ **Output**:
105
+ 1. Business confirmed by the user
106
+ 2. Summary table with: Case ID | Type | Entities involved | Critical required data
65
107
 
66
108
  ---
67
109
 
@@ -230,11 +272,37 @@ MCP: read_data("SELECT 'table1' as table, COUNT(*) as records FROM schema.table1
230
272
 
231
273
  ---
232
274
 
275
+ ### PHASE 5.5 — Insertion Plan on disk (approval GATE — MANDATORY)
276
+
277
+ **Objective**: Before touching the database, write a complete `insertion_plan.md` to disk and **wait for the user's approval**. This is a mandatory stop gate.
278
+
279
+ **Why on disk and not in the terminal**: with high volumes the plan does not fit / cannot be reviewed comfortably in the terminal. In a file the user can read it calmly, validate it, and decide whether to approve or request changes. **Always** generate this plan when the run will insert data — never insert directly from the terminal-only summary.
280
+
281
+ **Precondition**: If Phase 4 concluded "0 insertions required", skip this gate (there is nothing to plan) and go to Phase 7.4.
282
+
283
+ **Actions**:
284
+
285
+ 1. Write `insertion_plan.md` next to the test case file (same output folder as the other artifacts) containing **everything that will be inserted**:
286
+ - Confirmed business (from Phase 1) and the run marker / `Run ID`.
287
+ - **Table by table, record by record**, in the Phase 3 insertion order (parents → children): table, schema, and the concrete values of each record to insert.
288
+ - Which cases are **REUSABLE** (0 insertions, with the existing IDs to use) vs. **PARTIAL** / **MISSING** (records to create).
289
+ - Totals: records per table and grand total to insert.
290
+ 2. Present the path to the user and **stop**:
291
+ ```
292
+ 📄 Insertion plan written to: <path>/insertion_plan.md
293
+ Review it and reply: APPROVE to insert, or tell me the changes you want.
294
+ ```
295
+ 3. **Wait for explicit approval.** Do NOT proceed to Phase 6 until the user approves.
296
+ - If the user requests changes: adjust the generated data (back to Phase 5 as needed), **rewrite** `insertion_plan.md`, and ask for approval again.
297
+ - Only an explicit approval unlocks Phase 6.
298
+
299
+ ---
300
+
233
301
  ### PHASE 6 — Database Insertion
234
302
 
235
303
  **Objective**: Insert data into the database in the correct order.
236
304
 
237
- **Precondition**: If Phase 4 concluded "0 insertions required", skip this phase entirely and go to Phase 7.4.
305
+ **Precondition**: If Phase 4 concluded "0 insertions required", skip this phase entirely and go to Phase 7.4. **If there are insertions, the `insertion_plan.md` of Phase 5.5 MUST have been approved by the user before inserting.**
238
306
 
239
307
  **Actions** (in strict Phase 3 order):
240
308
 
@@ -274,11 +342,21 @@ MCP: read_data("SELECT 'table1' as table, COUNT(*) as records FROM schema.table1
274
342
 
275
343
  ---
276
344
 
277
- ### PHASE 7 — Report and Rollback Script
345
+ ### PHASE 7 — Deliverables: Report, test-data.md, seed.sql and rollback.sql
346
+
347
+ **Objective**: Document everything inserted and produce the **three on-disk artifacts**.
348
+
349
+ This phase produces, in addition to the on-screen report, **three files** written with the file-writing tool (not just chat blocks):
278
350
 
279
- **Objective**: Document everything inserted and provide a cleanup mechanism.
351
+ | Deliverable | File | Purpose |
352
+ |-------------|------|---------|
353
+ | 1. Case→data relation | `test-data.md` | Which data to use/was created per case; grouping cases that share the same seed. Designed for an AI agent (Playwright) to automate the cases. |
354
+ | 2. Executable seed | `seed.sql` | Idempotent, transactional insertions to reload the dataset into a fresh DB without re-running the process. |
355
+ | 3. Rollback | `rollback.sql` | Reverts exactly what was inserted in this run, without touching prior QA data. |
280
356
 
281
- **7.1 Generated data report**:
357
+ The three are written to the output path defined in Activation. After writing them, list the absolute paths of each file to the user.
358
+
359
+ **7.1 Generated data report** (on screen):
282
360
 
283
361
  ```
284
362
  EXECUTION SUMMARY
@@ -304,40 +382,105 @@ TOTAL RECORDS REUSED: 7
304
382
  TEST CASES COVERED: 10/10 (100%)
305
383
  ```
306
384
 
307
- **7.2 Traceability matrix**:
385
+ **7.2 Deliverable 1 — `test-data.md` (case→data relation, grouped)**:
386
+
387
+ Write a Markdown file that states, **per case**, with which data it can be executed: which **already exist** and which **were created**. The goal is that ALL cases end with sufficient data associated and that an AI agent (Playwright) can read the **literal values** (codes, names, amounts) it must use in the UI — not just internal DB IDs.
388
+
389
+ **Grouping rule (key)**: if several cases run with **exactly the same data seed**, do NOT repeat the data per case — group them in a single block (e.g., "Cases CP-001 to CP-010"). Only open individual blocks for cases with their own data (typically EDGE and NEGATIVE, which require specific values).
390
+
391
+ File structure:
392
+
393
+ ```markdown
394
+ # Test Data — <Business confirmed in Phase 1>
395
+
396
+ - **Process/module**: [name]
397
+ - **Database**: [DB name]
398
+ - **Generation date**: [date]
399
+ - **Run ID**: QA_<date>_<seq> <!-- common marker of all records in this run -->
400
+
401
+ > Convention: values in **bold** are typed/selected in the UI.
402
+ > The `id=` in parentheses are internal DB references (for traceability/rollback).
403
+
404
+ ## Shared base data
405
+ Apply to most cases unless a case states otherwise.
406
+
407
+ | Entity | Value to use in UI | DB id | Status |
408
+ |--------|--------------------|-------|--------|
409
+ | Company | **CMPQA — Clothing Store QA** | 1 | reused |
410
+ | Document type | **Inventory out (SAL-INV)** | 12 | reused |
411
+ | Warehouse | **Main Warehouse (BOD-001)** | 3 | reused |
412
+
413
+ ## Case groups
414
+
415
+ ### Cases CP-001 to CP-007 — Inventory out, positive flow
416
+ **They share the same seed.** Any of these cases can be tested with:
417
+ - Company: **CMPQA** (id=1)
418
+ - Document type: **Inventory out** (id=12)
419
+ - Items in stock:
420
+ - **Polo Shirt (ITM-POLO-001)** — id=2001 — stock 500 in Main Warehouse
421
+ - **Regular T-shirt (ITM-TEE-001)** — id=2002 — stock 500 in Main Warehouse
422
+ - Source warehouse: **Main Warehouse (BOD-001)** — id=3
423
+
424
+ Data: reused (nothing new was inserted for these cases).
425
+
426
+ ### CP-008 — Edge: out for the maximum quantity in stock
427
+ - Item: **Polo Shirt Edge (ITM-POLO-MAX)** — id=2050 — exact stock 999999
428
+ - Rest of the seed equal to the shared base data.
429
+
430
+ Data: **created** core.items id=2050 (`QA_<run>_ITM_POLO_MAX`).
431
+
432
+ ### CP-009 — Negative: out greater than stock
433
+ - Item: **Out-of-stock shirt (ITM-NOSTOCK)** — id=2051 — stock 0
434
+ - Expected result: controlled error "insufficient stock".
308
435
 
309
- For each test case, indicate whether data was REUSED or CREATED, with exact IDs:
436
+ Data: **created** core.items id=2051 (`QA_<run>_ITM_NOSTOCK`).
310
437
 
438
+ ## Coverage
439
+ Total cases: N — all with sufficient data associated (X reuse base data, Y with their own data).
311
440
  ```
312
- CP-001 (Positive) — REUSABLE:
313
- Use existing records:
314
- - masterdata.customers: id=1001 (QA_CUSTOMER_001)
315
- - core.invoices: id=5001 (QA_INVOICE_001)
316
- - core.invoice_detail: ids=8001,8002
317
- No new data was inserted.
318
-
319
- CP-002 (Edge - maximum amount) — REUSABLE:
320
- Use: core.invoices id=5002 (QA_INVOICE_EDGE_001, amount=999999999.99)
321
-
322
- CP-003 (Positive) PARTIAL:
323
- Reused: masterdata.customers id=1001
324
- Created: core.invoices id=5050 (QA_INVOICE_050), core.invoice_detail ids=8100,8101
325
-
326
- CP-005 (Negative) — MISSING:
327
- → Created:
328
- - masterdata.customers: id=1050 (QA_CUSTOMER_NEG_001)
329
- - core.invoices: id=5051 (QA_INVOICE_NEG_001)
441
+
442
+ Adapt entities, columns and values to what the real schema returned and to the confirmed business. The essential thing: **each case is mapped to concrete data, and cases with an identical seed are grouped in a single block.**
443
+
444
+ **7.3 Deliverable 2 — `seed.sql` (executable, idempotent insertion)**:
445
+
446
+ In addition to inserting directly via MCP (Phase 6), write a `seed.sql` that reproduces **exactly the same insertions**, in Phase 3 order (parents children). Its purpose: if a fresh/clean DB is reached, running this `.sql` is enough to have the complete seed without re-running the whole analysis process.
447
+
448
+ `seed.sql` requirements:
449
+ 1. **Transactional**: wrapped in `BEGIN; ... COMMIT;` so it is all-or-nothing.
450
+ 2. **Idempotent**: use `INSERT ... ON CONFLICT DO NOTHING` (PostgreSQL) or `IF NOT EXISTS` guards (SQL Server) so re-running does not fail or duplicate.
451
+ 3. **Run-marked**: every record carries the `Run ID` (e.g., in code/notes `QA_<date>_<seq>`), so the rollback can be scoped.
452
+ 4. **Correct order**: catalogs/root master → focal → children, same as Phase 6.
453
+ 5. **Commented per case**: head each block with the cases it covers (e.g., `-- Covers CP-001..CP-007`).
454
+ 6. **Only what was created**: do NOT include records marked REUSABLE (those already exist). If a reused base record is needed for the `.sql` to run on an empty DB, include it with `ON CONFLICT DO NOTHING` and comment it as "base data (may already exist)".
455
+
456
+ ```sql
457
+ -- ===============================================
458
+ -- SEED QA Synthetic Data
459
+ -- Business: <confirmed business> | Process: [name]
460
+ -- Target DB: [name] | Date: [date] | Run: QA_<date>_<seq>
461
+ -- EXECUTE ONLY IN TEST ENVIRONMENT
462
+ -- ===============================================
463
+ BEGIN;
464
+
465
+ -- Covers CP-001..CP-007 (base data)
466
+ INSERT INTO masterdata.items (code, name, notes, ...)
467
+ VALUES ('ITM-POLO-001', 'Polo Shirt', 'QA_<run> [SYNTHETIC DATA]', ...)
468
+ ON CONFLICT (code) DO NOTHING;
469
+
470
+ -- ... rest in parents -> children order ...
471
+
472
+ COMMIT;
330
473
  ```
331
474
 
332
- **7.3 Rollback script**:
475
+ **7.4 Deliverable 3 `rollback.sql`**:
333
476
 
334
- Generate a SQL script that deletes ONLY the inserted data, in reverse order (children first, parents after):
477
+ Write a `rollback.sql` that deletes ONLY the data inserted in this run, in reverse order (children first, parents after):
335
478
 
336
479
  ```sql
337
480
  -- ===============================================
338
481
  -- ROLLBACK — QA Synthetic Data
339
- -- Process: [name]
340
- -- Generation date: [date]
482
+ -- Business: <confirmed business> | Process: [name]
483
+ -- Generation date: [date] | Run: QA_<date>_<seq>
341
484
  -- EXECUTE ONLY IN TEST ENVIRONMENT
342
485
  -- ===============================================
343
486
 
@@ -372,9 +515,9 @@ MCP: execute_query("BEGIN; DELETE FROM ... ; COMMIT;")
372
515
 
373
516
  If the execution only generated data for some cases (others were REUSABLE), the rollback must clean up **only** the records inserted in this run. Do not touch previously reused QA data. Scope the DELETE by specific IDs or a run marker (e.g., date suffix `QA_INVOICE_20260420_050`) instead of a broad `LIKE 'QA_%'`.
374
517
 
375
- **7.4 Special case — No insertions required**:
518
+ **7.5 Special case — No insertions required**:
376
519
 
377
- If Phase 4 determined that all cases are REUSABLE, there is no new data or rollback to generate. Deliver this report to the user:
520
+ If Phase 4 determined that all cases are REUSABLE, there is no new data: **`seed.sql` and `rollback.sql` are NOT generated**. However, you **MUST still write `test-data.md`** with the case→data relation of existing data (same grouped blocks as 7.2, but all in "reused" status), so the team/AI agent knows which IDs and values to use. Deliver this report to the user:
378
521
 
379
522
  ```
380
523
  RESULT: NO NEW DATA WAS GENERATED
@@ -410,18 +553,22 @@ NEXT STEPS:
410
553
  ## General Rules
411
554
 
412
555
  ### What you MUST ALWAYS do
556
+ - **Infer the business and confirm it with the user before generating anything** (Phase 1.A)
413
557
  - Query real schemas via MCP before generating any data
414
558
  - **Search for existing QA data and perform case-by-case matching before deciding to generate**
415
559
  - Verify that FKs point to records that exist
416
- - Show the user the plan (including which cases are REUSABLE) before inserting
560
+ - **Write `insertion_plan.md` to disk and wait for the user's approval before inserting** (Phase 5.5 gate), whenever the run will insert data
417
561
  - Report errors immediately with full detail
418
- - Generate rollback script only when insertions occurred
562
+ - **Write deliverables to disk**: `insertion_plan.md` before inserting (when there are insertions); `test-data.md` always; `seed.sql` and `rollback.sql` when there were insertions
563
+ - **Group in `test-data.md` cases that share the same seed** (do not repeat data per case)
564
+ - Mark all records of the run with the same `Run ID` to scope the rollback
419
565
 
420
566
  ### What you must NEVER do
421
567
  - Invent column names without querying the schema
422
568
  - Assume data types without verifying
423
569
  - **Generate duplicate data when QA records already exist that satisfy the case**
424
570
  - **Insert data "just in case" when Phase 4 matching said REUSABLE**
571
+ - Write deliverables as chat blocks instead of files on disk
425
572
  - Insert into production tables (always verify the environment)
426
573
  - Modify or delete data that was not created by this process
427
574
  - Continue inserting if a dependency failed
@@ -448,16 +595,17 @@ NEXT STEPS:
448
595
 
449
596
  **AI**:
450
597
  1. Read the CSV → 15 test cases (10 positive, 3 edge, 2 negative)
451
- 2. Identify entities: invoices, invoice_detail, customers, products, salespeople
452
- 3. Query schemas via MCP → obtain columns, types, FKs for each table
453
- 4. Search existing QA datafind 5 `QA_INVOICE_*` invoices and 3 `QA_CUSTOMER_*` customers
454
- 5. Perform case-by-case matching:
598
+ 2. **Infer the business**: "From the cases, I deduce an invoicing distributor/retailer. Correct?" → user confirms
599
+ 3. Identify entities: invoices, invoice_detail, customers, products, salespeople
600
+ 4. Query schemas via MCPobtain columns, types, FKs for each table
601
+ 5. Search existing QA data → find 5 `QA_INVOICE_*` invoices and 3 `QA_CUSTOMER_*` customers
602
+ 6. Perform case-by-case matching:
455
603
  - 4 cases REUSABLE (QA invoices already apply)
456
604
  - 2 cases PARTIAL (QA customer exists, invoice missing)
457
605
  - 9 cases MISSING
458
- 6. Present plan: "7 records reused. Will insert 2 invoices + 9 new invoices + 33 lines"
459
- 7. User approves → insert in order: [missing] customers → invoices → invoice_detail
460
- 8. Deliver report (with REUSABLE block + created block) + rollback script scoped to this run's IDs
606
+ 7. Present plan: "7 records reused. Will insert 2 invoices + 9 new invoices + 33 lines"
607
+ 8. User approves → insert in order: [missing] customers → invoices → invoice_detail
608
+ 9. **Write the 3 deliverables**: `test-data.md` (cases grouped by seed), `seed.sql` (idempotent) and `rollback.sql` (scoped to this run's IDs); list the paths to the user
461
609
 
462
610
  ---
463
611
 
@@ -471,8 +619,8 @@ NEXT STEPS:
471
619
  2. Identify entities and query schemas via MCP
472
620
  3. Search existing QA data → find 12 `QA_INVOICE_*` invoices, 5 `QA_CUSTOMER_*` customers, associated detail
473
621
  4. Case-by-case matching → all 10 cases are REUSABLE
474
- 5. Deliver report 7.4: **"No new data was generated"** with the list of existing IDs to use per test case
475
- 6. Phases 5, 6 are not executed, no rollback script is generated
622
+ 5. Deliver report 7.5: **"No new data was generated"** + **write `test-data.md`** with the list of existing IDs to use per test case
623
+ 6. Phases 5, 6 are not executed; no `seed.sql` or `rollback.sql` is generated
476
624
 
477
625
  ---
478
626
 
@@ -481,5 +629,6 @@ NEXT STEPS:
481
629
  If the configured MCP is for SQL Server (`mcp_mssql`), the flow is identical but:
482
630
  - Tool names remain the same
483
631
  - The dependency function is `dbo.GetAllDependencies_JSON` instead of `get_all_dependencies_json`
484
- - Rollback scripts use `BEGIN TRANSACTION` / `COMMIT` instead of `BEGIN` / `COMMIT`
632
+ - The scripts (`seed.sql` and `rollback.sql`) use `BEGIN TRANSACTION` / `COMMIT` instead of `BEGIN` / `COMMIT`
633
+ - For idempotency in `seed.sql`, use `IF NOT EXISTS (SELECT 1 FROM ... WHERE ...) INSERT ...` instead of `INSERT ... ON CONFLICT DO NOTHING`
485
634
  - Use `TOP N` instead of `LIMIT N` for queries
@@ -0,0 +1,6 @@
1
+ ---
2
+ name: sa-quality-process
3
+ description: 'QA Quality Process — Phase 1 Planning, Phase 2 DOR Gate, Phase 3 Design, Phase 4 QA Data Generation, Phase 5 AgileTest Registration, or Phase 6 E2E Implementation + Execution (Agente Ejecutor E2E). Asks at startup which phase to execute.'
4
+ ---
5
+
6
+ IT IS CRITICAL THAT YOU FOLLOW THIS COMMAND: LOAD the FULL @_siesa-agents/bmm/workflows/3-solutioning/quality-process/workflow.md, READ its entire contents and follow its directions exactly!