code-ai-installer 4.0.1-b → 4.0.1
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.
- package/LICENSE +1 -1
- package/README.md +5 -5
- package/dist/catalog.js +1 -1
- package/dist/contentTransformer.d.ts +1 -1
- package/dist/contentTransformer.js +39 -0
- package/dist/index.js +10 -5
- package/dist/mcp/cli.js +4 -4
- package/dist/mcp/scorecard.d.ts +2 -2
- package/dist/mcp/task_state.d.ts +2 -2
- package/dist/mcp/tools/advance_gate.js +1 -1
- package/dist/mcp/tools/classify_gate.d.ts +2 -2
- package/dist/mcp/tools/classify_gate.js +2 -2
- package/dist/mcp/tools/load_role.d.ts +2 -2
- package/dist/mcp/tools/load_role.js +2 -2
- package/dist/mcp/tools/report_exception.d.ts +3 -3
- package/dist/mcp/tools/report_exception.js +4 -4
- package/dist/mcp/tools/request_decision.d.ts +3 -3
- package/dist/mcp/tools/request_decision.js +5 -5
- package/dist/mcp/tools/review_proposal.d.ts +1 -1
- package/dist/mcp/tools/review_proposal.js +6 -6
- package/dist/mcp/tools/sign_off.d.ts +2 -2
- package/dist/mcp/tools/sign_off.js +7 -7
- package/dist/mcp/tools/verify_claim.d.ts +1 -1
- package/dist/mcp/tools/verify_claim.js +1 -1
- package/dist/mcp_setup.d.ts +84 -31
- package/dist/mcp_setup.js +182 -66
- package/dist/platforms/adapters.js +54 -19
- package/dist/shared/frontmatter.js +1 -1
- package/dist/shared/persona.d.ts +1 -1
- package/dist/shared/persona.js +1 -1
- package/dist/shared/pipeline.d.ts +10 -10
- package/dist/shared/pipeline.js +7 -7
- package/dist/shared/tools.d.ts +15 -15
- package/dist/shared/tools.js +3 -3
- package/dist/shared/vocabulary.d.ts +4 -4
- package/dist/shared/vocabulary.js +4 -4
- package/dist/types.d.ts +1 -1
- package/domains/analytics/.agents/workflows/analytics-pipeline-rules.md +13 -3
- package/domains/analytics/.agents/workflows/analyze.md +1 -0
- package/domains/analytics/.agents/workflows/quick-insight.md +1 -0
- package/domains/analytics/locales/en/.agents/workflows/analytics-pipeline-rules.md +13 -3
- package/domains/analytics/locales/en/.agents/workflows/analyze.md +1 -0
- package/domains/analytics/locales/en/.agents/workflows/quick-insight.md +1 -0
- package/domains/analytics/locales/en/agents/interviewer.md +2 -1
- package/domains/analytics/locales/en/agents/layouter.md +2 -1
- package/domains/analytics/locales/en/agents/mediator.md +2 -1
- package/domains/analytics/locales/en/agents/researcher.md +2 -1
- package/domains/analytics/locales/en/agents/strategist.md +2 -1
- package/domains/analytics/pipeline.yaml +10 -10
- package/domains/content/.agents/skills/content-release-gate/SKILL.md +3 -5
- package/domains/content/.agents/workflows/content-pipeline-rules.md +14 -11
- package/domains/content/.agents/workflows/edit-content.md +0 -1
- package/domains/content/.agents/workflows/quick-post.md +0 -1
- package/domains/content/.agents/workflows/start-content.md +0 -1
- package/domains/content/agents/conductor.md +1 -2
- package/domains/content/locales/en/.agents/skills/content-release-gate/SKILL.md +3 -5
- package/domains/content/locales/en/.agents/workflows/content-pipeline-rules.md +14 -11
- package/domains/content/locales/en/.agents/workflows/edit-content.md +0 -1
- package/domains/content/locales/en/.agents/workflows/quick-post.md +0 -1
- package/domains/content/locales/en/.agents/workflows/start-content.md +0 -1
- package/domains/content/locales/en/agents/conductor.md +1 -2
- package/domains/content/pipeline.yaml +8 -8
- package/domains/development/.agents/skills/handoff/SKILL.md +276 -276
- package/domains/development/.agents/skills/lava-flow-legacy-detection/SKILL.md +197 -197
- package/domains/development/.agents/skills/mcp-integration/SKILL.md +211 -211
- package/domains/development/.agents/skills/qa-test-data-management/SKILL.md +250 -250
- package/domains/development/.agents/workflows/bugfix.md +16 -82
- package/domains/development/.agents/workflows/hotfix.md +16 -66
- package/domains/development/.agents/workflows/pipeline-rules.md +49 -132
- package/domains/development/.agents/workflows/start-task.md +17 -121
- package/domains/development/AGENTS.md +8 -3
- package/domains/development/agents/architect.md +247 -247
- package/domains/development/agents/conductor.md +363 -363
- package/domains/development/agents/devops.md +297 -297
- package/domains/development/agents/reviewer.md +293 -293
- package/domains/development/agents/senior_full_stack.md +295 -295
- package/domains/development/agents/tester.md +395 -395
- package/domains/development/locales/en/.agents/skills/handoff/SKILL.md +276 -276
- package/domains/development/locales/en/.agents/skills/lava-flow-legacy-detection/SKILL.md +197 -197
- package/domains/development/locales/en/.agents/skills/mcp-integration/SKILL.md +211 -211
- package/domains/development/locales/en/.agents/skills/qa-test-data-management/SKILL.md +250 -250
- package/domains/development/locales/en/.agents/workflows/bugfix.md +16 -82
- package/domains/development/locales/en/.agents/workflows/hotfix.md +15 -65
- package/domains/development/locales/en/.agents/workflows/pipeline-rules.md +48 -131
- package/domains/development/locales/en/.agents/workflows/start-task.md +17 -121
- package/domains/development/locales/en/AGENTS.md +15 -0
- package/domains/development/locales/en/agents/architect.md +247 -247
- package/domains/development/locales/en/agents/conductor.md +363 -363
- package/domains/development/locales/en/agents/devops.md +297 -297
- package/domains/development/locales/en/agents/reviewer.md +293 -293
- package/domains/development/locales/en/agents/senior_full_stack.md +295 -295
- package/domains/development/locales/en/agents/tester.md +395 -395
- package/domains/development/locales/en/prompt-examples.md +34 -120
- package/domains/development/pipeline.yaml +150 -135
- package/domains/development/prompt-examples.md +33 -119
- package/domains/product/.agents/workflows/product-pipeline-rules.md +13 -2
- package/domains/product/.agents/workflows/quick-pm.md +1 -1
- package/domains/product/.agents/workflows/shape-prioritize.md +1 -0
- package/domains/product/.agents/workflows/ship-right-thing.md +1 -0
- package/domains/product/.agents/workflows/spec.md +1 -0
- package/domains/product/agents/tech_lead.md +1 -1
- package/domains/product/locales/en/.agents/workflows/product-pipeline-rules.md +13 -2
- package/domains/product/locales/en/.agents/workflows/quick-pm.md +1 -1
- package/domains/product/locales/en/.agents/workflows/shape-prioritize.md +1 -0
- package/domains/product/locales/en/.agents/workflows/ship-right-thing.md +1 -0
- package/domains/product/locales/en/.agents/workflows/spec.md +1 -0
- package/domains/product/locales/en/agents/conductor.md +2 -2
- package/domains/product/locales/en/agents/data_analyst.md +2 -1
- package/domains/product/locales/en/agents/designer.md +2 -1
- package/domains/product/locales/en/agents/discovery.md +2 -1
- package/domains/product/locales/en/agents/layouter.md +2 -1
- package/domains/product/locales/en/agents/mediator.md +2 -1
- package/domains/product/locales/en/agents/pm.md +2 -1
- package/domains/product/locales/en/agents/product_strategist.md +2 -1
- package/domains/product/locales/en/agents/tech_lead.md +3 -2
- package/domains/product/locales/en/agents/ux_designer.md +2 -1
- package/domains/product/pipeline.yaml +12 -12
- package/package.json +5 -5
- package/domains/analytics/CONTEXT.md +0 -25
- package/domains/analytics/locales/en/CONTEXT.md +0 -25
- package/domains/content/CONTEXT.md +0 -19
- package/domains/content/locales/en/CONTEXT.md +0 -19
- package/domains/development/.agents/workflows/auto-restart-containers.md +0 -56
- package/domains/development/CONTEXT.md +0 -62
- package/domains/development/locales/en/.agents/workflows/auto-restart-containers.md +0 -24
- package/domains/development/locales/en/CONTEXT.md +0 -62
- package/domains/product/CONTEXT.md +0 -40
- package/domains/product/locales/en/CONTEXT.md +0 -40
|
@@ -1,250 +1,250 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: qa-test-data-management
|
|
3
|
-
description: Управление test data — fixtures генерируются из real schemas (TS типы, DB schema, OpenAPI), PII hygiene (faker/factory_boy для синтетики), prod-like masking при копировании prod данных, environment isolation (testcontainers, transactional rollback, tempdir), fixture lifecycle. Защита от Mode 1 (mock obsession) — fixture не дрейфует от реальности.
|
|
4
|
-
type: discretionary
|
|
5
|
-
domain: development
|
|
6
|
-
owners:
|
|
7
|
-
- tester
|
|
8
|
-
gates:
|
|
9
|
-
- TEST
|
|
10
|
-
tech:
|
|
11
|
-
- docker
|
|
12
|
-
- faker
|
|
13
|
-
- factory_boy
|
|
14
|
-
topic:
|
|
15
|
-
- qa
|
|
16
|
-
triggers:
|
|
17
|
-
- test data management
|
|
18
|
-
- test fixtures
|
|
19
|
-
- PII в тестах
|
|
20
|
-
- faker
|
|
21
|
-
- factory_boy
|
|
22
|
-
- testcontainers
|
|
23
|
-
- prod data masking
|
|
24
|
-
- fixture drift
|
|
25
|
-
- environment isolation
|
|
26
|
-
related:
|
|
27
|
-
- qa-test-plan
|
|
28
|
-
- qa-regression-baseline
|
|
29
|
-
- qa-mutation-testing
|
|
30
|
-
- tests-quality-review
|
|
31
|
-
budget_lines: 250
|
|
32
|
-
schema_version: 1
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
# Skill: QA Test Data Management
|
|
37
|
-
|
|
38
|
-
Управление тестовыми данными так, чтобы fixtures **не дрейфовали от реальности**, **не содержали PII**, и **не загрязняли** среду между прогонами. Защита от Mode 1 Test Integrity Defense (mock obsession) — потому что mock obsession часто начинается с "придуманного руками" fixture которое расходится с реальной схемой.
|
|
39
|
-
|
|
40
|
-
**Разделы:**
|
|
41
|
-
1. [Когда применять](#1-когда)
|
|
42
|
-
2. [Fixture derivation from real schemas](#2-derivation)
|
|
43
|
-
3. [PII hygiene](#3-pii)
|
|
44
|
-
4. [Prod-like data masking](#4-masking)
|
|
45
|
-
5. [Environment isolation](#5-isolation)
|
|
46
|
-
6. [Fixture lifecycle](#6-lifecycle)
|
|
47
|
-
7. [Anti-patterns](#7-anti)
|
|
48
|
-
8. [Output template](#8-output)
|
|
49
|
-
9. [DoD](#9-dod)
|
|
50
|
-
|
|
51
|
-
---
|
|
52
|
-
|
|
53
|
-
## <a id="1-когда"></a>1. Когда применять
|
|
54
|
-
|
|
55
|
-
**Триггеры:**
|
|
56
|
-
- Первый интеграционный тест на новый модуль / новую DB таблицу / новый API endpoint
|
|
57
|
-
- Security alert: PII обнаружено в test fixtures (auto-scan, см. `$qa-test-integrity-audit`)
|
|
58
|
-
- DB schema migration — fixtures всех затронутых тестов нужно re-generate
|
|
59
|
-
- Stabilization sprint включает audit test data quality
|
|
60
|
-
|
|
61
|
-
**Outputs:**
|
|
62
|
-
- Fixture generation скрипт / decorator / factory class
|
|
63
|
-
- Mask config для prod-data clone (если применимо)
|
|
64
|
-
- Cleanup hooks для testcontainers / tempdir
|
|
65
|
-
- PII audit report
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## <a id="2-derivation"></a>2. Fixture derivation from real schemas
|
|
70
|
-
|
|
71
|
-
**Правило:** fixture генерируется из source-of-truth схемы, не "придуман руками".
|
|
72
|
-
|
|
73
|
-
**JS/TS — из TypeScript типов через faker:**
|
|
74
|
-
```ts
|
|
75
|
-
import { faker } from "@faker-js/faker";
|
|
76
|
-
import type { User } from "@/types/user";
|
|
77
|
-
|
|
78
|
-
export function makeUser(overrides?: Partial<User>): User {
|
|
79
|
-
return {
|
|
80
|
-
id: faker.string.uuid(),
|
|
81
|
-
email: faker.internet.email(),
|
|
82
|
-
name: faker.person.fullName(),
|
|
83
|
-
role: "user",
|
|
84
|
-
createdAt: faker.date.recent(),
|
|
85
|
-
...overrides,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
**Python — из dataclass через factory_boy:**
|
|
91
|
-
```python
|
|
92
|
-
import factory
|
|
93
|
-
from app.models import User
|
|
94
|
-
|
|
95
|
-
class UserFactory(factory.Factory):
|
|
96
|
-
class Meta:
|
|
97
|
-
model = User
|
|
98
|
-
id = factory.Faker("uuid4")
|
|
99
|
-
email = factory.Faker("email")
|
|
100
|
-
name = factory.Faker("name")
|
|
101
|
-
role = "user"
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
**Из OpenAPI / JSON Schema:** используй `openapi-typescript-codegen` (TS) или `datamodel-code-generator` (Python) для type derivation, затем factory как выше.
|
|
105
|
-
|
|
106
|
-
**Зачем:** schema меняется — type meняется — factory падает на компиляции — тесты переписаны под новую схему. Без этого fixture тихо устаревает, тесты зелёные, prod падает.
|
|
107
|
-
|
|
108
|
-
---
|
|
109
|
-
|
|
110
|
-
## <a id="3-pii"></a>3. PII hygiene
|
|
111
|
-
|
|
112
|
-
**Что НЕ должно попадать в test fixtures (никогда):**
|
|
113
|
-
- Real emails / phones / addresses (даже свои)
|
|
114
|
-
- Real payment data (CC numbers, IBAN, SWIFT)
|
|
115
|
-
- Real names of real people
|
|
116
|
-
- Real API keys / tokens / passwords
|
|
117
|
-
- Real customer IDs from prod
|
|
118
|
-
|
|
119
|
-
**Что использовать вместо:**
|
|
120
|
-
- **faker** (JS/TS): `faker.internet.email()`, `faker.phone.number()`, `faker.location.streetAddress()`
|
|
121
|
-
- **factory_boy + faker** (Python): `factory.Faker("email")`, `factory.Faker("phone_number")`
|
|
122
|
-
|
|
123
|
-
**Detection:** ESLint rule `no-restricted-syntax` + custom regex на email/phone patterns в test files. Pre-commit hook block если найдено что-то похожее на real PII (см. `$qa-test-integrity-audit` §1).
|
|
124
|
-
|
|
125
|
-
**Если случайно закоммитили PII:**
|
|
126
|
-
1. Rotate compromised credentials немедленно
|
|
127
|
-
2. Filter git history (`git filter-repo`) — НЕ rebase, чтобы оригинальные commits были недоступны
|
|
128
|
-
3. Notify owners если real customer data была
|
|
129
|
-
4. Document incident в security-baseline-dev runbook
|
|
130
|
-
|
|
131
|
-
---
|
|
132
|
-
|
|
133
|
-
## <a id="4-masking"></a>4. Prod-like data masking
|
|
134
|
-
|
|
135
|
-
Иногда нужно тестировать на realistic distribution (volume, edge cases) — копируем prod data в staging/test, но **маскируем PII**.
|
|
136
|
-
|
|
137
|
-
**Masking rules:**
|
|
138
|
-
- **Emails:** replace local part с hash, keep domain category (`user-a3f9@example.com`)
|
|
139
|
-
- **Names:** replace с faker.person.fullName() seeded by hash of original (consistent within run)
|
|
140
|
-
- **Phones:** randomize last 4 digits keeping country code
|
|
141
|
-
- **Dates:** shift by random Δ ±30 days (preserve weekday patterns)
|
|
142
|
-
- **IDs:** preserve referential integrity through deterministic mapping (`user_123 → user_anon_xyz` consistently)
|
|
143
|
-
- **Payment:** zeroize CC, randomize amounts within ±20% range
|
|
144
|
-
|
|
145
|
-
**Tools:** `pgmasq` (Postgres), `Faker.unique` + custom transformers, в-house masking script. Run AS PART OF prod→staging sync, не в test runtime.
|
|
146
|
-
|
|
147
|
-
**Audit:** после mask sample 100 rows, manual check on no leakage. Document mask config in repo so reviewer audits.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## <a id="5-isolation"></a>5. Environment isolation
|
|
152
|
-
|
|
153
|
-
Каждый прогон тестов должен начинаться с **clean state** и **не оставлять** артефактов следующему.
|
|
154
|
-
|
|
155
|
-
**DB isolation patterns:**
|
|
156
|
-
- **Testcontainers** (Docker-based fresh DB per test suite): `@testcontainers/postgresql` (JS), `testcontainers` (Python). Spin up real Postgres/MongoDB в Docker container, teardown after.
|
|
157
|
-
- **Transactional rollback** (быстрее testcontainers): wrap test в transaction, rollback at end. Works for SQL DBs, не работает для MongoDB.
|
|
158
|
-
- **In-memory adapters** (быстрее всех, но менее real): SQLite for Postgres-like, mongo-memory-server.
|
|
159
|
-
|
|
160
|
-
**File system isolation:**
|
|
161
|
-
- `tmp` директории per test (`os.tmpdir()` + uuid)
|
|
162
|
-
- Cleanup в `afterEach` / pytest fixture teardown
|
|
163
|
-
- НЕ использовать shared `tests/fixtures/output/` директорию
|
|
164
|
-
|
|
165
|
-
**Network isolation:**
|
|
166
|
-
- MSW (JS) / responses (Python) для mock external HTTP at boundary
|
|
167
|
-
- Никогда не hit реальный API в тесте — flaky + slow + cost
|
|
168
|
-
|
|
169
|
-
**State между тестами:**
|
|
170
|
-
- Module-level state НЕ shared (avoid singletons в production code или wipe в `beforeEach`)
|
|
171
|
-
- DB indexes/sequences reset between suites
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## <a id="6-lifecycle"></a>6. Fixture lifecycle
|
|
176
|
-
|
|
177
|
-
**Create:**
|
|
178
|
-
- Generation через factory (не hardcode)
|
|
179
|
-
- Minimum data needed for test (no "kitchen sink" fixtures)
|
|
180
|
-
- Specific test → specific fixture builder
|
|
181
|
-
|
|
182
|
-
**Use:**
|
|
183
|
-
- Один тест → один fixture instance (не shared)
|
|
184
|
-
- Если нужны связанные entities — factory composition (`UserFactory.subFactory(OrderFactory)`)
|
|
185
|
-
- Overrides только для test-specific вариаций
|
|
186
|
-
|
|
187
|
-
**Cleanup:**
|
|
188
|
-
- Testcontainers — auto-teardown on suite exit
|
|
189
|
-
- DB transactional rollback — auto on test exit
|
|
190
|
-
- File system — `afterEach` cleanup hook
|
|
191
|
-
- Tempdir — registered for OS cleanup
|
|
192
|
-
|
|
193
|
-
**Storage convention:**
|
|
194
|
-
- Factory definitions: `tests/factories/` (JS) или `tests/conftest.py` + factory module (Python)
|
|
195
|
-
- Test data files: НЕ commit large fixture JSON files в git; generate on demand
|
|
196
|
-
- Snapshot files OK в git (Playwright traces, vitest snapshots) — но без PII
|
|
197
|
-
|
|
198
|
-
---
|
|
199
|
-
|
|
200
|
-
## <a id="7-anti"></a>7. Anti-patterns
|
|
201
|
-
|
|
202
|
-
- 🔴 **Hardcoded real PII** — `expect(user.email).toBe("
|
|
203
|
-
- 🔴 **Shared mutable fixture** — `beforeAll(() => fixture = makeUser())` + tests mutate fixture — order dependence, flaky.
|
|
204
|
-
- 🔴 **Fixture drift** — handcrafted `{id: 1, name: "test"}` который не использует TS type / schema. Schema меняется, fixture не падает, prod падает.
|
|
205
|
-
- 🟠 **No cleanup** — testcontainers вы стартанули, забыли teardown — CI runner забит зомби-контейнерами через час.
|
|
206
|
-
- 🟠 **Kitchen sink fixture** — `makeUserWithEverything()` возвращает user + orders + payments + sessions — каждый тест получает больше чем нужно, обновление ломает все тесты.
|
|
207
|
-
- 🟡 **Faker без seed** — рандомность хорошо, но без seed невозможно воспроизвести failing test. Pin seed for reproducible builds (`faker.seed(42)` per test).
|
|
208
|
-
|
|
209
|
-
---
|
|
210
|
-
|
|
211
|
-
## <a id="8-output"></a>8. Output template
|
|
212
|
-
|
|
213
|
-
Tester включает в TEST report (если применимо):
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
### Test Data Management
|
|
217
|
-
- Factories used: N (list)
|
|
218
|
-
- PII audit: pass / N findings
|
|
219
|
-
- Masking config: configured / N/A
|
|
220
|
-
- Environment isolation:
|
|
221
|
-
- testcontainers: N suites
|
|
222
|
-
- transactional rollback: N suites
|
|
223
|
-
- tempdir cleanup: configured
|
|
224
|
-
- Fixture seeding: seeded (reproducible) / random
|
|
225
|
-
- Action items: [fixture refactors / PII findings to fix]
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
---
|
|
229
|
-
|
|
230
|
-
## <a id="9-dod"></a>9. DoD
|
|
231
|
-
|
|
232
|
-
- [ ] Все fixtures генерируются через factory (no hardcoded entities)
|
|
233
|
-
- [ ] PII audit pre-commit hook настроен (см. `$qa-test-integrity-audit`)
|
|
234
|
-
- [ ] Environment isolation: testcontainers или transactional rollback per integration suite
|
|
235
|
-
- [ ] Mask config документирован для любого prod→staging sync
|
|
236
|
-
- [ ] Cleanup hooks в каждом test suite (no zombie state)
|
|
237
|
-
- [ ] Faker seed pin'нут для reproducibility
|
|
238
|
-
- [ ] Output template включён в TEST report
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## См. также
|
|
243
|
-
|
|
244
|
-
- `$qa-test-plan` — план тестирования учитывает test data requirements per flow
|
|
245
|
-
- `$qa-regression-baseline` — baseline tracks fixture changes between releases
|
|
246
|
-
- `$qa-mutation-testing` — mutation сильно зависит от quality fixtures
|
|
247
|
-
- `$qa-test-integrity-audit` — PII detection rules + fixture drift detection
|
|
248
|
-
- `$qa-flaky-test-protocol` — env isolation issues → flaky cause
|
|
249
|
-
- `$tests-quality-review` — Reviewer-side audit включая test data quality
|
|
250
|
-
- `$security-baseline-dev` — PII handling rules consistent с production code
|
|
1
|
+
---
|
|
2
|
+
name: qa-test-data-management
|
|
3
|
+
description: Управление test data — fixtures генерируются из real schemas (TS типы, DB schema, OpenAPI), PII hygiene (faker/factory_boy для синтетики), prod-like masking при копировании prod данных, environment isolation (testcontainers, transactional rollback, tempdir), fixture lifecycle. Защита от Mode 1 (mock obsession) — fixture не дрейфует от реальности.
|
|
4
|
+
type: discretionary
|
|
5
|
+
domain: development
|
|
6
|
+
owners:
|
|
7
|
+
- tester
|
|
8
|
+
gates:
|
|
9
|
+
- TEST
|
|
10
|
+
tech:
|
|
11
|
+
- docker
|
|
12
|
+
- faker
|
|
13
|
+
- factory_boy
|
|
14
|
+
topic:
|
|
15
|
+
- qa
|
|
16
|
+
triggers:
|
|
17
|
+
- test data management
|
|
18
|
+
- test fixtures
|
|
19
|
+
- PII в тестах
|
|
20
|
+
- faker
|
|
21
|
+
- factory_boy
|
|
22
|
+
- testcontainers
|
|
23
|
+
- prod data masking
|
|
24
|
+
- fixture drift
|
|
25
|
+
- environment isolation
|
|
26
|
+
related:
|
|
27
|
+
- qa-test-plan
|
|
28
|
+
- qa-regression-baseline
|
|
29
|
+
- qa-mutation-testing
|
|
30
|
+
- tests-quality-review
|
|
31
|
+
budget_lines: 250
|
|
32
|
+
schema_version: 1
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
# Skill: QA Test Data Management
|
|
37
|
+
|
|
38
|
+
Управление тестовыми данными так, чтобы fixtures **не дрейфовали от реальности**, **не содержали PII**, и **не загрязняли** среду между прогонами. Защита от Mode 1 Test Integrity Defense (mock obsession) — потому что mock obsession часто начинается с "придуманного руками" fixture которое расходится с реальной схемой.
|
|
39
|
+
|
|
40
|
+
**Разделы:**
|
|
41
|
+
1. [Когда применять](#1-когда)
|
|
42
|
+
2. [Fixture derivation from real schemas](#2-derivation)
|
|
43
|
+
3. [PII hygiene](#3-pii)
|
|
44
|
+
4. [Prod-like data masking](#4-masking)
|
|
45
|
+
5. [Environment isolation](#5-isolation)
|
|
46
|
+
6. [Fixture lifecycle](#6-lifecycle)
|
|
47
|
+
7. [Anti-patterns](#7-anti)
|
|
48
|
+
8. [Output template](#8-output)
|
|
49
|
+
9. [DoD](#9-dod)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## <a id="1-когда"></a>1. Когда применять
|
|
54
|
+
|
|
55
|
+
**Триггеры:**
|
|
56
|
+
- Первый интеграционный тест на новый модуль / новую DB таблицу / новый API endpoint
|
|
57
|
+
- Security alert: PII обнаружено в test fixtures (auto-scan, см. `$qa-test-integrity-audit`)
|
|
58
|
+
- DB schema migration — fixtures всех затронутых тестов нужно re-generate
|
|
59
|
+
- Stabilization sprint включает audit test data quality
|
|
60
|
+
|
|
61
|
+
**Outputs:**
|
|
62
|
+
- Fixture generation скрипт / decorator / factory class
|
|
63
|
+
- Mask config для prod-data clone (если применимо)
|
|
64
|
+
- Cleanup hooks для testcontainers / tempdir
|
|
65
|
+
- PII audit report
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## <a id="2-derivation"></a>2. Fixture derivation from real schemas
|
|
70
|
+
|
|
71
|
+
**Правило:** fixture генерируется из source-of-truth схемы, не "придуман руками".
|
|
72
|
+
|
|
73
|
+
**JS/TS — из TypeScript типов через faker:**
|
|
74
|
+
```ts
|
|
75
|
+
import { faker } from "@faker-js/faker";
|
|
76
|
+
import type { User } from "@/types/user";
|
|
77
|
+
|
|
78
|
+
export function makeUser(overrides?: Partial<User>): User {
|
|
79
|
+
return {
|
|
80
|
+
id: faker.string.uuid(),
|
|
81
|
+
email: faker.internet.email(),
|
|
82
|
+
name: faker.person.fullName(),
|
|
83
|
+
role: "user",
|
|
84
|
+
createdAt: faker.date.recent(),
|
|
85
|
+
...overrides,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Python — из dataclass через factory_boy:**
|
|
91
|
+
```python
|
|
92
|
+
import factory
|
|
93
|
+
from app.models import User
|
|
94
|
+
|
|
95
|
+
class UserFactory(factory.Factory):
|
|
96
|
+
class Meta:
|
|
97
|
+
model = User
|
|
98
|
+
id = factory.Faker("uuid4")
|
|
99
|
+
email = factory.Faker("email")
|
|
100
|
+
name = factory.Faker("name")
|
|
101
|
+
role = "user"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Из OpenAPI / JSON Schema:** используй `openapi-typescript-codegen` (TS) или `datamodel-code-generator` (Python) для type derivation, затем factory как выше.
|
|
105
|
+
|
|
106
|
+
**Зачем:** schema меняется — type meняется — factory падает на компиляции — тесты переписаны под новую схему. Без этого fixture тихо устаревает, тесты зелёные, prod падает.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## <a id="3-pii"></a>3. PII hygiene
|
|
111
|
+
|
|
112
|
+
**Что НЕ должно попадать в test fixtures (никогда):**
|
|
113
|
+
- Real emails / phones / addresses (даже свои)
|
|
114
|
+
- Real payment data (CC numbers, IBAN, SWIFT)
|
|
115
|
+
- Real names of real people
|
|
116
|
+
- Real API keys / tokens / passwords
|
|
117
|
+
- Real customer IDs from prod
|
|
118
|
+
|
|
119
|
+
**Что использовать вместо:**
|
|
120
|
+
- **faker** (JS/TS): `faker.internet.email()`, `faker.phone.number()`, `faker.location.streetAddress()`
|
|
121
|
+
- **factory_boy + faker** (Python): `factory.Faker("email")`, `factory.Faker("phone_number")`
|
|
122
|
+
|
|
123
|
+
**Detection:** ESLint rule `no-restricted-syntax` + custom regex на email/phone patterns в test files. Pre-commit hook block если найдено что-то похожее на real PII (см. `$qa-test-integrity-audit` §1).
|
|
124
|
+
|
|
125
|
+
**Если случайно закоммитили PII:**
|
|
126
|
+
1. Rotate compromised credentials немедленно
|
|
127
|
+
2. Filter git history (`git filter-repo`) — НЕ rebase, чтобы оригинальные commits были недоступны
|
|
128
|
+
3. Notify owners если real customer data была
|
|
129
|
+
4. Document incident в security-baseline-dev runbook
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## <a id="4-masking"></a>4. Prod-like data masking
|
|
134
|
+
|
|
135
|
+
Иногда нужно тестировать на realistic distribution (volume, edge cases) — копируем prod data в staging/test, но **маскируем PII**.
|
|
136
|
+
|
|
137
|
+
**Masking rules:**
|
|
138
|
+
- **Emails:** replace local part с hash, keep domain category (`user-a3f9@example.com`)
|
|
139
|
+
- **Names:** replace с faker.person.fullName() seeded by hash of original (consistent within run)
|
|
140
|
+
- **Phones:** randomize last 4 digits keeping country code
|
|
141
|
+
- **Dates:** shift by random Δ ±30 days (preserve weekday patterns)
|
|
142
|
+
- **IDs:** preserve referential integrity through deterministic mapping (`user_123 → user_anon_xyz` consistently)
|
|
143
|
+
- **Payment:** zeroize CC, randomize amounts within ±20% range
|
|
144
|
+
|
|
145
|
+
**Tools:** `pgmasq` (Postgres), `Faker.unique` + custom transformers, в-house masking script. Run AS PART OF prod→staging sync, не в test runtime.
|
|
146
|
+
|
|
147
|
+
**Audit:** после mask sample 100 rows, manual check on no leakage. Document mask config in repo so reviewer audits.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## <a id="5-isolation"></a>5. Environment isolation
|
|
152
|
+
|
|
153
|
+
Каждый прогон тестов должен начинаться с **clean state** и **не оставлять** артефактов следующему.
|
|
154
|
+
|
|
155
|
+
**DB isolation patterns:**
|
|
156
|
+
- **Testcontainers** (Docker-based fresh DB per test suite): `@testcontainers/postgresql` (JS), `testcontainers` (Python). Spin up real Postgres/MongoDB в Docker container, teardown after.
|
|
157
|
+
- **Transactional rollback** (быстрее testcontainers): wrap test в transaction, rollback at end. Works for SQL DBs, не работает для MongoDB.
|
|
158
|
+
- **In-memory adapters** (быстрее всех, но менее real): SQLite for Postgres-like, mongo-memory-server.
|
|
159
|
+
|
|
160
|
+
**File system isolation:**
|
|
161
|
+
- `tmp` директории per test (`os.tmpdir()` + uuid)
|
|
162
|
+
- Cleanup в `afterEach` / pytest fixture teardown
|
|
163
|
+
- НЕ использовать shared `tests/fixtures/output/` директорию
|
|
164
|
+
|
|
165
|
+
**Network isolation:**
|
|
166
|
+
- MSW (JS) / responses (Python) для mock external HTTP at boundary
|
|
167
|
+
- Никогда не hit реальный API в тесте — flaky + slow + cost
|
|
168
|
+
|
|
169
|
+
**State между тестами:**
|
|
170
|
+
- Module-level state НЕ shared (avoid singletons в production code или wipe в `beforeEach`)
|
|
171
|
+
- DB indexes/sequences reset between suites
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## <a id="6-lifecycle"></a>6. Fixture lifecycle
|
|
176
|
+
|
|
177
|
+
**Create:**
|
|
178
|
+
- Generation через factory (не hardcode)
|
|
179
|
+
- Minimum data needed for test (no "kitchen sink" fixtures)
|
|
180
|
+
- Specific test → specific fixture builder
|
|
181
|
+
|
|
182
|
+
**Use:**
|
|
183
|
+
- Один тест → один fixture instance (не shared)
|
|
184
|
+
- Если нужны связанные entities — factory composition (`UserFactory.subFactory(OrderFactory)`)
|
|
185
|
+
- Overrides только для test-specific вариаций
|
|
186
|
+
|
|
187
|
+
**Cleanup:**
|
|
188
|
+
- Testcontainers — auto-teardown on suite exit
|
|
189
|
+
- DB transactional rollback — auto on test exit
|
|
190
|
+
- File system — `afterEach` cleanup hook
|
|
191
|
+
- Tempdir — registered for OS cleanup
|
|
192
|
+
|
|
193
|
+
**Storage convention:**
|
|
194
|
+
- Factory definitions: `tests/factories/` (JS) или `tests/conftest.py` + factory module (Python)
|
|
195
|
+
- Test data files: НЕ commit large fixture JSON files в git; generate on demand
|
|
196
|
+
- Snapshot files OK в git (Playwright traces, vitest snapshots) — но без PII
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## <a id="7-anti"></a>7. Anti-patterns
|
|
201
|
+
|
|
202
|
+
- 🔴 **Hardcoded real PII** — `expect(user.email).toBe("user@example.com")` — security leak + flaky когда пользователь меняет email.
|
|
203
|
+
- 🔴 **Shared mutable fixture** — `beforeAll(() => fixture = makeUser())` + tests mutate fixture — order dependence, flaky.
|
|
204
|
+
- 🔴 **Fixture drift** — handcrafted `{id: 1, name: "test"}` который не использует TS type / schema. Schema меняется, fixture не падает, prod падает.
|
|
205
|
+
- 🟠 **No cleanup** — testcontainers вы стартанули, забыли teardown — CI runner забит зомби-контейнерами через час.
|
|
206
|
+
- 🟠 **Kitchen sink fixture** — `makeUserWithEverything()` возвращает user + orders + payments + sessions — каждый тест получает больше чем нужно, обновление ломает все тесты.
|
|
207
|
+
- 🟡 **Faker без seed** — рандомность хорошо, но без seed невозможно воспроизвести failing test. Pin seed for reproducible builds (`faker.seed(42)` per test).
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## <a id="8-output"></a>8. Output template
|
|
212
|
+
|
|
213
|
+
Tester включает в TEST report (если применимо):
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
### Test Data Management
|
|
217
|
+
- Factories used: N (list)
|
|
218
|
+
- PII audit: pass / N findings
|
|
219
|
+
- Masking config: configured / N/A
|
|
220
|
+
- Environment isolation:
|
|
221
|
+
- testcontainers: N suites
|
|
222
|
+
- transactional rollback: N suites
|
|
223
|
+
- tempdir cleanup: configured
|
|
224
|
+
- Fixture seeding: seeded (reproducible) / random
|
|
225
|
+
- Action items: [fixture refactors / PII findings to fix]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## <a id="9-dod"></a>9. DoD
|
|
231
|
+
|
|
232
|
+
- [ ] Все fixtures генерируются через factory (no hardcoded entities)
|
|
233
|
+
- [ ] PII audit pre-commit hook настроен (см. `$qa-test-integrity-audit`)
|
|
234
|
+
- [ ] Environment isolation: testcontainers или transactional rollback per integration suite
|
|
235
|
+
- [ ] Mask config документирован для любого prod→staging sync
|
|
236
|
+
- [ ] Cleanup hooks в каждом test suite (no zombie state)
|
|
237
|
+
- [ ] Faker seed pin'нут для reproducibility
|
|
238
|
+
- [ ] Output template включён в TEST report
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## См. также
|
|
243
|
+
|
|
244
|
+
- `$qa-test-plan` — план тестирования учитывает test data requirements per flow
|
|
245
|
+
- `$qa-regression-baseline` — baseline tracks fixture changes between releases
|
|
246
|
+
- `$qa-mutation-testing` — mutation сильно зависит от quality fixtures
|
|
247
|
+
- `$qa-test-integrity-audit` — PII detection rules + fixture drift detection
|
|
248
|
+
- `$qa-flaky-test-protocol` — env isolation issues → flaky cause
|
|
249
|
+
- `$tests-quality-review` — Reviewer-side audit включая test data quality
|
|
250
|
+
- `$security-baseline-dev` — PII handling rules consistent с production code
|
|
@@ -1,90 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Запуск сокращённого
|
|
2
|
+
description: Запуск сокращённого багфикс-пайплайна (3 гейта: DEV → REV → TEST).
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
# /bugfix —
|
|
5
|
+
# /bugfix — багфикс-пайплайн (3 гейта)
|
|
6
6
|
|
|
7
|
-
> 🟢
|
|
8
|
-
>
|
|
7
|
+
> 🟢 Для багов в существующем функционале. Полный режим — `/start-task`, мелочь — `/hotfix`.
|
|
8
|
+
> Абсолютные правила — в `pipeline-rules`.
|
|
9
9
|
|
|
10
|
-
## Когда
|
|
10
|
+
## Когда
|
|
11
|
+
- Баг в логике, ошибки API, сломанная валидация, проблемы с данными.
|
|
12
|
+
- Затрагивает > 2 файлов или нетривиальный blast radius.
|
|
13
|
+
- НЕ меняет UI-layout, не добавляет API, не меняет схему данных (иначе → `/start-task`).
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
## Поток
|
|
16
|
+
Conductor подтверждает режим (bugfix) и инициализирует доску. Затем по гейтам через поток MCP (`classify_gate → load_role → submit_artifact → sign_off → advance_gate`):
|
|
17
|
+
1. **DEV** — TDD-фикс: RED (тест, воспроизводящий баг) → GREEN → REFACTOR; JSDoc. Подпись `mcp`.
|
|
18
|
+
2. **REV** — ревью: тест реально воспроизводит баг? побочные эффекты? regression-риск? Подпись `mcp`.
|
|
19
|
+
3. **TEST** — верификация: баг исправлен, регрессий нет; авто-пас на зелёном `run_tests`. Подпись `mcp`.
|
|
15
20
|
|
|
16
|
-
|
|
21
|
+
Пользователь в рутину не вовлекается — только на `fork` через `request_decision`.
|
|
17
22
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
## Шаг 1: CONDUCTOR — Классификация
|
|
21
|
-
|
|
22
|
-
1. Выполни `view_file` на `agents/conductor.md`
|
|
23
|
-
2. Подтверди что задача = bugfix (по Decision Tree)
|
|
24
|
-
3. Создай Mini Checklist:
|
|
25
|
-
```
|
|
26
|
-
[ ] BF-DEV-01 Fix + TDD + Handoff Envelope
|
|
27
|
-
[ ] BF-REV-01 Code review + regression check + Handoff Envelope
|
|
28
|
-
[ ] BF-TEST-01 Verification + regression smoke + GO/NO-GO
|
|
29
|
-
```
|
|
30
|
-
4. `notify_user` → ждать **Approved**
|
|
31
|
-
|
|
32
|
-
## Шаг 2: DEV — TDD-фикс
|
|
33
|
-
|
|
34
|
-
1. Выполни `view_file` на `agents/senior_full_stack.md`
|
|
35
|
-
2. Пройди протокол (пропуская §1 UX review и §6 DEMO):
|
|
36
|
-
- §0: Context + read skills
|
|
37
|
-
- §2: Analyze bug + root cause
|
|
38
|
-
- §3: RED — написать падающий тест, воспроизводящий баг
|
|
39
|
-
- §4: GREEN — минимальный код для прохождения теста
|
|
40
|
-
- §5: REFACTOR — улучшить без изменения поведения
|
|
41
|
-
- §7: JSDoc на изменённых функциях
|
|
42
|
-
3. Перезапустить затронутые сервисы (если применимо)
|
|
43
|
-
4. Сформировать Handoff Envelope → REV
|
|
44
|
-
5. `notify_user` → ждать **Approved**
|
|
45
|
-
|
|
46
|
-
## Шаг 3: REV — Code Review
|
|
47
|
-
|
|
48
|
-
1. Выполни `view_file` на `agents/reviewer.md`
|
|
49
|
-
2. Фокус ревью:
|
|
50
|
-
- Тест действительно воспроизводит баг (RED-фаза)?
|
|
51
|
-
- Фикс не создаёт побочных эффектов?
|
|
52
|
-
- Regression risk оценён?
|
|
53
|
-
- JSDoc на месте?
|
|
54
|
-
3. Сформировать Handoff Envelope → TEST
|
|
55
|
-
4. `notify_user` → ждать **Approved**
|
|
56
|
-
|
|
57
|
-
## Шаг 4: TEST — Верификация
|
|
58
|
-
|
|
59
|
-
1. Выполни `view_file` на `agents/tester.md`
|
|
60
|
-
2. Проверить:
|
|
61
|
-
- Баг исправлен (по шагам воспроизведения)
|
|
62
|
-
- Регрессии нет (smoke по затронутым модулям)
|
|
63
|
-
- Тесты проходят (CI green)
|
|
64
|
-
3. Вынести вердикт: **GO ✅ / NO-GO ❌**
|
|
65
|
-
4. `notify_user` → ждать **Approved**
|
|
66
|
-
|
|
67
|
-
---
|
|
68
|
-
|
|
69
|
-
## При FAIL на REV или TEST
|
|
70
|
-
|
|
71
|
-
1. Агент выдаёт FAIL Report + Handoff → DEV
|
|
72
|
-
2. DEV исправляет → Handoff → REV → TEST (повтор цикла)
|
|
73
|
-
3. Approved на каждом гейте обязателен
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Шаблон промпта
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
@AGENTS.md /bugfix
|
|
81
|
-
|
|
82
|
-
Баг: [описание бага, 1-2 предложения].
|
|
83
|
-
Воспроизведение: [шаги, если известны].
|
|
84
|
-
Файлы: [затронутые файлы, если известны].
|
|
85
|
-
|
|
86
|
-
Правила:
|
|
87
|
-
1. Bugfix Pipeline: CONDUCTOR → DEV → REV → TEST
|
|
88
|
-
2. TDD обязательно (RED → GREEN → REFACTOR)
|
|
89
|
-
3. Approved на каждом гейте
|
|
90
|
-
```
|
|
23
|
+
## Fix Cycle
|
|
24
|
+
FAIL на REV/TEST или красный `run_tests` → откат к DEV. 2 отката на полосе → аудит Архитектора в свежей сессии (`pipeline-rules`).
|