universal-dev-standards 5.4.0 → 5.5.0

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 (114) hide show
  1. package/bundled/ai/standards/adversarial-test.ai.yaml +277 -0
  2. package/bundled/ai/standards/audit-trail.ai.yaml +113 -0
  3. package/bundled/ai/standards/chaos-injection-tests.ai.yaml +91 -0
  4. package/bundled/ai/standards/container-image-standards.ai.yaml +88 -0
  5. package/bundled/ai/standards/container-security.ai.yaml +331 -0
  6. package/bundled/ai/standards/cost-budget-test.ai.yaml +96 -0
  7. package/bundled/ai/standards/data-contract.ai.yaml +110 -0
  8. package/bundled/ai/standards/data-migration-testing.ai.yaml +96 -0
  9. package/bundled/ai/standards/data-pipeline.ai.yaml +113 -0
  10. package/bundled/ai/standards/disaster-recovery-drill.ai.yaml +89 -0
  11. package/bundled/ai/standards/flaky-test-management.ai.yaml +89 -0
  12. package/bundled/ai/standards/flow-based-testing.ai.yaml +240 -0
  13. package/bundled/ai/standards/iac-design-principles.ai.yaml +83 -0
  14. package/bundled/ai/standards/incident-response.ai.yaml +107 -0
  15. package/bundled/ai/standards/license-compliance.ai.yaml +106 -0
  16. package/bundled/ai/standards/llm-output-validation.ai.yaml +269 -0
  17. package/bundled/ai/standards/mock-boundary.ai.yaml +250 -0
  18. package/bundled/ai/standards/mutation-testing.ai.yaml +192 -0
  19. package/bundled/ai/standards/pii-classification.ai.yaml +109 -0
  20. package/bundled/ai/standards/policy-as-code-testing.ai.yaml +227 -0
  21. package/bundled/ai/standards/prd-standards.ai.yaml +88 -0
  22. package/bundled/ai/standards/product-metrics-standards.ai.yaml +111 -0
  23. package/bundled/ai/standards/prompt-regression.ai.yaml +94 -0
  24. package/bundled/ai/standards/property-based-testing.ai.yaml +105 -0
  25. package/bundled/ai/standards/release-quality-manifest.ai.yaml +135 -0
  26. package/bundled/ai/standards/replay-test.ai.yaml +111 -0
  27. package/bundled/ai/standards/runbook.ai.yaml +104 -0
  28. package/bundled/ai/standards/sast-advanced.ai.yaml +135 -0
  29. package/bundled/ai/standards/schema-evolution.ai.yaml +111 -0
  30. package/bundled/ai/standards/secret-management-standards.ai.yaml +105 -0
  31. package/bundled/ai/standards/secure-op.ai.yaml +365 -0
  32. package/bundled/ai/standards/security-testing.ai.yaml +171 -0
  33. package/bundled/ai/standards/server-ops-security.ai.yaml +274 -0
  34. package/bundled/ai/standards/slo-sli.ai.yaml +97 -0
  35. package/bundled/ai/standards/smoke-test.ai.yaml +87 -0
  36. package/bundled/ai/standards/supply-chain-attestation.ai.yaml +109 -0
  37. package/bundled/ai/standards/test-completeness-dimensions.ai.yaml +52 -5
  38. package/bundled/ai/standards/user-story-mapping.ai.yaml +108 -0
  39. package/bundled/core/adversarial-test.md +212 -0
  40. package/bundled/core/chaos-injection-tests.md +116 -0
  41. package/bundled/core/container-security.md +521 -0
  42. package/bundled/core/cost-budget-test.md +69 -0
  43. package/bundled/core/data-migration-testing.md +110 -0
  44. package/bundled/core/disaster-recovery-drill.md +73 -0
  45. package/bundled/core/flaky-test-management.md +73 -0
  46. package/bundled/core/flow-based-testing.md +142 -0
  47. package/bundled/core/llm-output-validation.md +178 -0
  48. package/bundled/core/mock-boundary.md +100 -0
  49. package/bundled/core/mutation-testing.md +97 -0
  50. package/bundled/core/policy-as-code-testing.md +188 -0
  51. package/bundled/core/prompt-regression.md +72 -0
  52. package/bundled/core/property-based-testing.md +73 -0
  53. package/bundled/core/release-quality-manifest.md +147 -0
  54. package/bundled/core/replay-test.md +86 -0
  55. package/bundled/core/sast-advanced.md +300 -0
  56. package/bundled/core/secure-op.md +314 -0
  57. package/bundled/core/security-testing.md +87 -0
  58. package/bundled/core/server-ops-security.md +493 -0
  59. package/bundled/core/smoke-test.md +65 -0
  60. package/bundled/core/supply-chain-attestation.md +117 -0
  61. package/bundled/locales/zh-CN/CHANGELOG.md +3 -3
  62. package/bundled/locales/zh-CN/README.md +1 -1
  63. package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +5 -5
  64. package/bundled/locales/zh-TW/CHANGELOG.md +3 -3
  65. package/bundled/locales/zh-TW/README.md +1 -1
  66. package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +183 -79
  67. package/bundled/skills/README.md +4 -3
  68. package/bundled/skills/SKILL_NAMING.md +94 -0
  69. package/bundled/skills/ai-instruction-standards/SKILL.md +181 -88
  70. package/bundled/skills/atdd-assistant/SKILL.md +8 -0
  71. package/bundled/skills/bdd-assistant/SKILL.md +7 -0
  72. package/bundled/skills/checkin-assistant/SKILL.md +8 -0
  73. package/bundled/skills/code-review-assistant/SKILL.md +7 -0
  74. package/bundled/skills/journey-test-assistant/SKILL.md +203 -0
  75. package/bundled/skills/orchestrate/SKILL.md +167 -0
  76. package/bundled/skills/plan/SKILL.md +234 -0
  77. package/bundled/skills/pr-automation-assistant/SKILL.md +8 -0
  78. package/bundled/skills/push/SKILL.md +49 -2
  79. package/bundled/skills/{process-automation → skill-builder}/SKILL.md +1 -1
  80. package/bundled/skills/{forward-derivation → spec-derivation}/SKILL.md +1 -1
  81. package/bundled/skills/spec-driven-dev/SKILL.md +7 -0
  82. package/bundled/skills/sweep/SKILL.md +145 -0
  83. package/bundled/skills/tdd-assistant/SKILL.md +7 -0
  84. package/package.json +1 -1
  85. package/src/commands/flow.js +8 -0
  86. package/src/commands/start.js +14 -0
  87. package/src/commands/sweep.js +8 -0
  88. package/src/commands/workflow.js +8 -0
  89. package/standards-registry.json +426 -4
  90. package/bundled/locales/zh-CN/skills/ac-coverage-assistant/SKILL.md +0 -190
  91. package/bundled/locales/zh-CN/skills/forward-derivation/SKILL.md +0 -71
  92. package/bundled/locales/zh-CN/skills/forward-derivation/guide.md +0 -130
  93. package/bundled/locales/zh-CN/skills/methodology-system/SKILL.md +0 -88
  94. package/bundled/locales/zh-CN/skills/methodology-system/create-methodology.md +0 -350
  95. package/bundled/locales/zh-CN/skills/methodology-system/guide.md +0 -131
  96. package/bundled/locales/zh-CN/skills/methodology-system/runtime.md +0 -279
  97. package/bundled/locales/zh-CN/skills/process-automation/SKILL.md +0 -143
  98. package/bundled/locales/zh-TW/skills/ac-coverage-assistant/SKILL.md +0 -195
  99. package/bundled/locales/zh-TW/skills/deploy-assistant/SKILL.md +0 -178
  100. package/bundled/locales/zh-TW/skills/forward-derivation/SKILL.md +0 -69
  101. package/bundled/locales/zh-TW/skills/forward-derivation/guide.md +0 -415
  102. package/bundled/locales/zh-TW/skills/methodology-system/SKILL.md +0 -86
  103. package/bundled/locales/zh-TW/skills/methodology-system/create-methodology.md +0 -350
  104. package/bundled/locales/zh-TW/skills/methodology-system/guide.md +0 -131
  105. package/bundled/locales/zh-TW/skills/methodology-system/runtime.md +0 -279
  106. package/bundled/locales/zh-TW/skills/process-automation/SKILL.md +0 -144
  107. /package/bundled/skills/{ac-coverage-assistant → ac-coverage}/SKILL.md +0 -0
  108. /package/bundled/skills/{methodology-system → dev-methodology}/SKILL.md +0 -0
  109. /package/bundled/skills/{methodology-system → dev-methodology}/create-methodology.md +0 -0
  110. /package/bundled/skills/{methodology-system → dev-methodology}/guide.md +0 -0
  111. /package/bundled/skills/{methodology-system → dev-methodology}/integrated-flow.md +0 -0
  112. /package/bundled/skills/{methodology-system → dev-methodology}/prerequisite-check.md +0 -0
  113. /package/bundled/skills/{methodology-system → dev-methodology}/runtime.md +0 -0
  114. /package/bundled/skills/{forward-derivation → spec-derivation}/guide.md +0 -0
@@ -0,0 +1,250 @@
1
+ # Mock Boundary Standards - AI Optimized
2
+ # Source: core/mock-boundary.md
3
+
4
+ id: mock-boundary
5
+ meta:
6
+ version: "1.0.0"
7
+ updated: "2026-05-04"
8
+ source: core/mock-boundary.md
9
+ description: >
10
+ Rules defining what can and cannot be mocked to prevent hollow tests —
11
+ tests that pass while the real system is broken.
12
+
13
+ # ─────────────────────────────────────────────────────────
14
+ # Core Problem
15
+ # ─────────────────────────────────────────────────────────
16
+ core_problem:
17
+ name: Hollow Test Anti-Pattern
18
+ description: >
19
+ Over-mocking replaces real business logic with test doubles, making the test suite
20
+ a specification of mock behavior rather than system behavior.
21
+ The tests pass in CI while the real system silently fails.
22
+ real_world_example: |
23
+ // SPEC-002.test.ts (VibeOps) — hollow test example
24
+ vi.mock('../../src/runner/agent-runner.js') // Core dependency mocked
25
+ vi.mock('../../src/runner/guardian-hooks.js') // Core dependency mocked
26
+ vi.mock('../../src/runner/prototyper.js') // Core dependency mocked
27
+ vi.mock('../../src/runner/iteration-report.js') // Core dependency mocked
28
+ vi.mock('../../src/memory/memory-store.js') // Core dependency mocked
29
+ vi.mock('node:fs/promises', ...) // I/O mocked
30
+
31
+ // Result: runPipeline() runs but touches ZERO real code.
32
+ // All 8 agent calls are faked. The test proves nothing about pipeline logic.
33
+
34
+ # ─────────────────────────────────────────────────────────
35
+ # Allowed Mocks
36
+ # ─────────────────────────────────────────────────────────
37
+ allowed:
38
+ - category: External HTTP Services
39
+ description: Third-party APIs, LLM providers, payment gateways, email services
40
+ reason: Prevents flaky tests from external dependencies; enables response scenario control
41
+ examples:
42
+ - OpenAI / Anthropic / Grok API
43
+ - Stripe / payment processors
44
+ - SendGrid / email providers
45
+ - External OAuth providers
46
+ implementation: Mock the HTTP client or provider factory; never mock the internal caller
47
+
48
+ - category: Time Functions
49
+ description: Date.now(), new Date(), setTimeout, setInterval
50
+ reason: Makes tests deterministic and enables time-travel scenarios
51
+ examples:
52
+ - "vi.useFakeTimers()"
53
+ - "vi.setSystemTime(new Date('2026-01-01'))"
54
+ note: Always restore real timers after test with vi.useRealTimers()
55
+
56
+ - category: Environment Variables
57
+ description: process.env values
58
+ reason: Tests need different configurations without changing system state
59
+ implementation: Use vi.stubEnv() or process.env assignment in beforeEach/afterEach
60
+
61
+ - category: File System (unit tests only)
62
+ description: fs.readFile, fs.writeFile, fs.stat in UNIT tests
63
+ reason: Avoids slow I/O in fast unit tests
64
+ constraint: >
65
+ Integration tests, flow tests, and E2E tests MUST use real filesystem
66
+ or in-memory FS (memfs) — never vi.mock('node:fs/promises') at those levels
67
+
68
+ - category: Cross-Module Boundaries (with counterpart)
69
+ description: Calls to OTHER modules when testing THIS module's own logic
70
+ reason: Isolates the unit under test from its collaborators
71
+ constraint: >
72
+ A corresponding integration test MUST exist that exercises the real interaction.
73
+ Mock only when the real collaborator has its own test coverage.
74
+ example: |
75
+ // Mocking the DB layer in a service unit test is OK IF:
76
+ // 1. The DB layer has its own integration tests
77
+ // 2. The service test focuses on service logic (not DB behavior)
78
+
79
+ # ─────────────────────────────────────────────────────────
80
+ # Forbidden Mocks
81
+ # ─────────────────────────────────────────────────────────
82
+ forbidden:
83
+ - category: Own Module Core Logic
84
+ description: Mocking the module's OWN functions in the file that tests it
85
+ example: |
86
+ // ❌ Testing pipeline-runner.ts but mocking pipeline-runner itself
87
+ vi.mock('../../src/runner/pipeline-runner.js')
88
+ import { runPipeline } from '../../src/runner/pipeline-runner.js'
89
+ // runPipeline is now a no-op stub — the test proves nothing
90
+ violation_indicator: >
91
+ The mock import path resolves to the same directory as the test file,
92
+ or the mock replaces the primary export being tested.
93
+ fix: Remove the mock and let the real code run; mock only its external dependencies
94
+
95
+ - category: Database Layer in Integration/Flow Tests
96
+ description: Replacing DB calls with in-memory return values in integration or flow tests
97
+ reason: Masks query bugs, schema constraint violations, index issues, and migration errors
98
+ alternative: >
99
+ Use in-memory SQLite (better-sqlite3 / sql.js), test containers,
100
+ or a dedicated test schema — a real database with controlled data
101
+ example: |
102
+ // ❌ Forbidden in integration/flow tests
103
+ vi.mock('../../src/db/client.js', () => ({ query: vi.fn().mockResolvedValue([]) }))
104
+
105
+ // ✅ Correct: use real in-memory DB
106
+ import Database from 'better-sqlite3'
107
+ const testDb = new Database(':memory:')
108
+
109
+ - category: Core Framework Internals
110
+ description: Express/Fastify routing, ORM core (Drizzle/Prisma internals), auth middleware core
111
+ reason: Tests pass while real routing, query building, or auth enforcement is broken
112
+ example: |
113
+ // ❌ Forbidden
114
+ vi.mock('express', () => ({ Router: () => ({ get: vi.fn(), post: vi.fn() }) }))
115
+
116
+ - category: Security Controls
117
+ description: Auth token validators, permission checks, rate limiters, input sanitizers
118
+ reason: Mocking security controls makes tests useless for security validation
119
+ example: |
120
+ // ❌ Forbidden — this test proves nothing about auth
121
+ vi.mock('../../src/auth/middleware.js', () => ({
122
+ requireAuth: (req, res, next) => next() // always passes
123
+ }))
124
+ fix: Use a real test user with a real valid token; test with real auth logic
125
+
126
+ # ─────────────────────────────────────────────────────────
127
+ # Hollow Test Detection Patterns
128
+ # ─────────────────────────────────────────────────────────
129
+ detection_patterns:
130
+ hollow_test_indicators:
131
+ - name: Mock Count Exceeds Import Count
132
+ check: "vi.mock() call count >= number of non-type imports in the test file"
133
+ severity: high
134
+ action: Review all assertions; verify at least one assertion is on actual output
135
+
136
+ - name: Assertions Only on Mock Calls
137
+ check: "All expect() statements use .toHaveBeenCalled() or .toHaveBeenCalledWith()"
138
+ severity: high
139
+ action: Add assertions on actual return values and system state changes
140
+
141
+ - name: More Mock Setup Than Assertions
142
+ check: "Lines of mock setup > lines of expect() assertions"
143
+ severity: medium
144
+ action: Consider if the test is testing behavior or just mock wiring
145
+
146
+ - name: Self-Referential Mock
147
+ check: "A vi.mock() path resolves to the same module being imported as the subject under test"
148
+ severity: critical
149
+ action: Remove the self-mock immediately; it makes the test a no-op
150
+
151
+ ai_generation_warning: >
152
+ AI tools (including this assistant) tend to generate hollow tests because:
153
+ 1. Mocking makes tests compile and pass without requiring real infrastructure
154
+ 2. AI cannot know the full dependency graph at generation time
155
+ When reviewing AI-generated tests, always apply the hollow test indicators above.
156
+
157
+ # ─────────────────────────────────────────────────────────
158
+ # Anti-Patterns
159
+ # ─────────────────────────────────────────────────────────
160
+ anti_patterns:
161
+ - name: Total Mock Isolation
162
+ description: Every import is mocked; test verifies only mock interaction counts
163
+ problem: Tests pass regardless of actual logic correctness
164
+ symptom: Deleting the implementation file doesn't break the test
165
+
166
+ - name: Mock the World
167
+ description: External + internal + database + filesystem all mocked in one test
168
+ problem: Test becomes a specification of mock behavior, not system behavior
169
+
170
+ - name: Mock Without Integration Counterpart
171
+ description: Cross-module mock with no corresponding integration test
172
+ problem: The interaction between modules is never actually exercised
173
+
174
+ - name: Security Mock Bypass
175
+ description: Auth/permission middleware replaced with always-pass stub
176
+ problem: Security regression cannot be detected
177
+
178
+ - name: Database Mock Cascade
179
+ description: DB mock returns hardcoded data, hiding query logic errors
180
+ problem: Schema migrations, wrong predicates, missing joins — all invisible
181
+
182
+ # ─────────────────────────────────────────────────────────
183
+ # Rules
184
+ # ─────────────────────────────────────────────────────────
185
+ rules:
186
+ - id: no-own-module-mock
187
+ trigger: writing any test for a module
188
+ instruction: Never vi.mock() a path that resolves to the module being tested
189
+ priority: required
190
+
191
+ - id: real-db-in-flow-tests
192
+ trigger: writing flow test, integration test, or E2E test
193
+ instruction: >
194
+ Use a real database (in-memory SQLite, test container, or test schema).
195
+ Never mock the DB layer in these test levels.
196
+ priority: required
197
+
198
+ - id: mock-needs-integration-counterpart
199
+ trigger: adding a vi.mock() for a cross-module dependency in a unit test
200
+ instruction: >
201
+ Ensure a corresponding integration test exercises the real interaction.
202
+ Note the counterpart test in a comment: "// integration: see src/__tests__/integration/..."
203
+ priority: required
204
+
205
+ - id: security-no-mock
206
+ trigger: test involves authentication, authorization, or rate limiting
207
+ instruction: >
208
+ Never mock security controls.
209
+ Create a real test user with a real token; exercise the real auth logic.
210
+ priority: required
211
+
212
+ - id: hollow-test-review
213
+ trigger: mock count in test file equals or exceeds non-type import count
214
+ instruction: >
215
+ Apply hollow test indicators checklist before submitting.
216
+ At least one assertion must verify an actual output value (not a mock call).
217
+ priority: required
218
+
219
+ - id: ai-generated-test-mock-review
220
+ trigger: tests are AI-generated
221
+ instruction: >
222
+ AI-generated tests frequently over-mock. Apply all detection_patterns checks.
223
+ If any hollow test indicator triggers, rewrite the mocking strategy.
224
+ priority: required
225
+
226
+ # ─────────────────────────────────────────────────────────
227
+ # Quick Reference
228
+ # ─────────────────────────────────────────────────────────
229
+ quick_reference:
230
+ allowed_mock_summary:
231
+ - "✅ External HTTP/LLM/payment APIs"
232
+ - "✅ Time functions (Date.now, setTimeout)"
233
+ - "✅ Environment variables"
234
+ - "✅ File system — in unit tests only"
235
+ - "✅ Cross-module boundaries — with integration test counterpart"
236
+
237
+ forbidden_mock_summary:
238
+ - "❌ Own module's core logic (self-referential mock)"
239
+ - "❌ Database layer in integration/flow/E2E tests"
240
+ - "❌ HTTP framework internals (Express router, etc.)"
241
+ - "❌ Security controls (auth middleware, permission checks)"
242
+
243
+ checklist: |
244
+ Before submitting test with mocks:
245
+ □ No vi.mock() path matches the module under test
246
+ □ DB layer not mocked in integration/flow tests
247
+ □ Security controls not mocked
248
+ □ Mock count < import count (or justified with comment)
249
+ □ At least one assertion on actual output value (not mock call)
250
+ □ Integration counterpart exists for each cross-module mock
@@ -0,0 +1,192 @@
1
+ # Mutation Testing Standards - AI Optimized
2
+ # Source: core/mutation-testing.md
3
+
4
+ id: mutation-testing
5
+ meta:
6
+ version: "1.0.0"
7
+ updated: "2026-05-04"
8
+ source: core/mutation-testing.md
9
+ description: >
10
+ Mutation testing methodology to evaluate test suite effectiveness.
11
+ Answers "do my tests actually catch bugs?" beyond line coverage.
12
+
13
+ # ─────────────────────────────────────────────────────────
14
+ # Core Concepts
15
+ # ─────────────────────────────────────────────────────────
16
+ core_concepts:
17
+ definition: >
18
+ Mutation testing automatically injects small bugs (mutations) into source code,
19
+ then runs the test suite to see if tests detect (kill) the bug.
20
+ A test suite that kills most mutations is effective; one that misses them is hollow.
21
+
22
+ key_terms:
23
+ - term: Mutant
24
+ definition: A copy of source code with one small artificial bug injected
25
+ - term: Killed mutant
26
+ definition: Test suite detected the bug (test failed)
27
+ - term: Survived mutant
28
+ definition: Test suite missed the bug (all tests still pass) — indicates weak tests
29
+ - term: Mutation Score
30
+ formula: "Killed / (Killed + Survived) × 100%"
31
+ interpretation: Higher is better; 0% = tests prove nothing; 100% = very thorough
32
+
33
+ common_mutation_operators:
34
+ - category: Arithmetic operators
35
+ examples: ["+ → -", "* → /", "++ → --"]
36
+ - category: Conditional boundaries
37
+ examples: ["> → >=", "< → <=", "=== → !=="]
38
+ - category: Statement deletion
39
+ examples: ["Remove return statement", "Remove function call"]
40
+ - category: Boolean literal
41
+ examples: ["true → false", "false → true"]
42
+
43
+ # ─────────────────────────────────────────────────────────
44
+ # Tools
45
+ # ─────────────────────────────────────────────────────────
46
+ tools:
47
+ typescript_javascript:
48
+ - name: Stryker Mutator
49
+ packages: ["@stryker-mutator/core", "@stryker-mutator/vitest-runner"]
50
+ config_file: stryker.config.json
51
+ command: "npx stryker run"
52
+ strengths: [Deep vitest/jest integration, incremental mode, HTML reports]
53
+ note: Use incremental mode to speed up re-runs (--incremental flag)
54
+
55
+ python:
56
+ - name: mutmut
57
+ command: "mutmut run"
58
+ config: setup.cfg or pyproject.toml
59
+ - name: Cosmic Ray
60
+ command: "cosmic-ray init config.toml && cosmic-ray exec config.toml"
61
+
62
+ java:
63
+ - name: PIT (Pitest)
64
+ command: "mvn org.pitest:pitest-maven:mutationCoverage"
65
+ strengths: [Industry standard for Java, excellent IDE integration]
66
+
67
+ # ─────────────────────────────────────────────────────────
68
+ # Thresholds
69
+ # ─────────────────────────────────────────────────────────
70
+ thresholds:
71
+ description: Minimum acceptable mutation scores by module criticality
72
+
73
+ critical_modules:
74
+ description: Auth, payment, license validation, security controls
75
+ minimum_score: 80
76
+ enforcement: Block release if below threshold
77
+ examples: [auth/*, license/*, payment/*, security/*]
78
+
79
+ standard_modules:
80
+ description: Core business logic
81
+ minimum_score: 70
82
+ enforcement: Warning in CI; must be resolved before next release
83
+
84
+ ai_generated_tests:
85
+ description: Tests produced by AI tools (including this assistant)
86
+ minimum_score: 50
87
+ enforcement: Required review before accepting AI-generated test files
88
+ rationale: AI tends to generate hollow tests; mutation score reveals this
89
+
90
+ overall_project:
91
+ minimum_score: 60
92
+ enforcement: Advisory (track trend; alert on regression > 5%)
93
+
94
+ # ─────────────────────────────────────────────────────────
95
+ # Stryker Quick Start (TypeScript/Vitest)
96
+ # ─────────────────────────────────────────────────────────
97
+ stryker_quickstart:
98
+ install: "npm install --save-dev @stryker-mutator/core @stryker-mutator/vitest-runner"
99
+
100
+ minimal_config: |
101
+ {
102
+ "testRunner": "vitest",
103
+ "coverageAnalysis": "perTest",
104
+ "mutate": [
105
+ "src/license/**/*.ts",
106
+ "src/enterprise/quota/**/*.ts",
107
+ "src/runner/pipeline-runner.ts",
108
+ "!src/**/*.test.ts"
109
+ ],
110
+ "vitest": {
111
+ "configFile": "vitest.config.ts"
112
+ },
113
+ "thresholds": {
114
+ "high": 80,
115
+ "low": 60,
116
+ "break": 50
117
+ },
118
+ "reporters": ["progress", "html", "json"],
119
+ "htmlReporter": {
120
+ "fileName": "reports/mutation/index.html"
121
+ }
122
+ }
123
+
124
+ incremental_mode: "npx stryker run --incremental"
125
+ full_run: "npx stryker run"
126
+
127
+ # ─────────────────────────────────────────────────────────
128
+ # When to Run
129
+ # ─────────────────────────────────────────────────────────
130
+ execution_timing:
131
+ - trigger: On-demand local run
132
+ command: "npm run test:mutation"
133
+ frequency: Before committing changes to critical modules
134
+ note: Mutation testing is slow (minutes to hours); do NOT run in every commit hook
135
+
136
+ - trigger: Pre-release quality gate
137
+ command: "npm run test:mutation -- --breakAt 60"
138
+ frequency: Before every release
139
+ enforcement: Break if overall score < 60%
140
+
141
+ - trigger: Critical module change
142
+ command: "npx stryker run --mutate 'src/license/**'"
143
+ frequency: Any change to auth/license/payment/security code
144
+ enforcement: Must maintain ≥ 80% on changed module
145
+
146
+ - trigger: AI-generated tests acceptance
147
+ command: "npx stryker run --mutate [module under test]"
148
+ frequency: Before accepting AI-generated test PRs
149
+ enforcement: Score < 50% → reject; require human-written tests
150
+
151
+ # ─────────────────────────────────────────────────────────
152
+ # Rules
153
+ # ─────────────────────────────────────────────────────────
154
+ rules:
155
+ - id: mutation-pre-release
156
+ trigger: preparing a release
157
+ instruction: Run mutation testing; overall score must be ≥ 60% to proceed
158
+ priority: required
159
+
160
+ - id: mutation-critical-modules
161
+ trigger: modifying auth, license, payment, or security code
162
+ instruction: Run module-scoped mutation testing; maintain ≥ 80% mutation score
163
+ priority: required
164
+
165
+ - id: mutation-ai-generated
166
+ trigger: accepting AI-generated test files
167
+ instruction: >
168
+ Run mutation testing on the module under test.
169
+ Score < 50% → reject tests; require human-authored replacements.
170
+ priority: required
171
+
172
+ - id: do-not-run-in-every-commit
173
+ trigger: planning CI pipeline
174
+ instruction: Do NOT add mutation testing to commit hooks or every-PR CI; it is too slow
175
+ priority: required
176
+ note: Reserve for pre-release gate and on-demand runs
177
+
178
+ anti_patterns:
179
+ - Treating 100% line coverage as sufficient (lines covered ≠ mutations killed)
180
+ - Adding mutation testing to pre-commit hooks (makes commits 10-60 minutes long)
181
+ - Accepting AI-generated tests without mutation score validation
182
+ - Killing mutations by adding trivial assertions (expect(x).toBeDefined())
183
+ - Targeting only happy paths in mutation testing (branches and boundaries are key)
184
+
185
+ quick_reference:
186
+ mutation_testing_checklist: |
187
+ □ Stryker configured for critical modules (license/*, auth/*, quota/*)
188
+ □ test:mutation script in package.json
189
+ □ Thresholds set: critical ≥ 80%, overall ≥ 60%, break at 50%
190
+ □ Pre-release: run full mutation suite before tagging version
191
+ □ AI-generated tests: validate with mutation score before accepting
192
+ □ NOT in commit hooks (too slow)
@@ -0,0 +1,109 @@
1
+ # PII Classification and Handling Standards - AI Optimized
2
+ # Source: XSPEC-066 Wave 3 Compliance Pack
3
+
4
+ id: pii-classification
5
+ title: PII Classification and Handling Standards
6
+ version: "1.0.0"
7
+ status: Active
8
+ tags: [compliance, privacy, pii, gdpr, data-protection, security]
9
+ summary: |
10
+ Defines how Personally Identifiable Information (PII) and sensitive personal
11
+ data is classified, labeled, stored, transmitted, and disposed of. Covers
12
+ a three-tier data sensitivity classification, mandatory handling controls
13
+ per tier, data minimization principles, consent management requirements,
14
+ retention and deletion schedules, and cross-border transfer restrictions.
15
+ Aligned with GDPR Article 9, CCPA, and general privacy-by-design principles.
16
+
17
+ requirements:
18
+ - id: REQ-001
19
+ title: PII Data Sensitivity Classification
20
+ description: |
21
+ All data fields containing personal information MUST be classified into
22
+ one of three tiers before storage or processing. TIER-1 (Highly
23
+ Sensitive): health data, financial account numbers, government IDs,
24
+ biometrics, passwords, SSNs — requires encryption at rest and in
25
+ transit, access logging, no caching. TIER-2 (Sensitive): full name +
26
+ contact info combination, location history, behavioral profiles,
27
+ IP addresses — requires encryption in transit, access controls.
28
+ TIER-3 (General PII): first name only, country-level location, general
29
+ demographics — standard access controls sufficient.
30
+ level: MUST
31
+ examples:
32
+ - "Field: credit_card_number → TIER-1, encrypted AES-256-GCM, no logging of value"
33
+ - "Field: user_email + user_name together → TIER-2, TLS required, RBAC enforced"
34
+ - "Field: country_code → TIER-3, standard DB access controls"
35
+
36
+ - id: REQ-002
37
+ title: Data Minimization and Purpose Limitation
38
+ description: |
39
+ Systems MUST collect only the minimum PII necessary for the explicitly
40
+ stated purpose. Each PII field in the data model MUST have a documented
41
+ business purpose and legal basis (consent, contract, legitimate
42
+ interest, legal obligation). Collection of PII without documented
43
+ purpose is PROHIBITED. Purpose limitation MUST be enforced: data
44
+ collected for purpose A MUST NOT be used for unrelated purpose B
45
+ without separate consent.
46
+ level: MUST
47
+ examples:
48
+ - "Data dictionary entry: email_address, purpose: account authentication, legal_basis: contract"
49
+ - "Phone number collected for 2FA cannot be reused for marketing without new consent"
50
+ - "PR review checklist: 'Does this new field have a documented purpose in the data dictionary?'"
51
+
52
+ - id: REQ-003
53
+ title: PII Masking and Anonymization in Non-Production
54
+ description: |
55
+ PII MUST NOT exist in non-production environments (development, staging,
56
+ test) unless explicitly required and approved. Test and staging databases
57
+ MUST use anonymized or synthetic data. Any approved exception MUST be
58
+ time-limited, access-controlled, and documented. PII MUST be masked
59
+ in application logs: email addresses shown as u***@domain.com, phone
60
+ numbers as +1-XXX-XXX-1234, card numbers as ****-****-****-1234.
61
+ level: MUST
62
+ examples:
63
+ - "Staging DB: email stored as 'user_12345@test.invalid', not real email"
64
+ - "Log output: 'User u***@example.com logged in' not 'User alice@example.com logged in'"
65
+ - "Exception process: production data copy to staging requires security team approval + 7-day TTL"
66
+
67
+ - id: REQ-004
68
+ title: Data Retention and Deletion Schedule
69
+ description: |
70
+ Every data category containing PII MUST have a documented retention
71
+ schedule with maximum retention period aligned to legal requirements
72
+ and business need. Automated deletion MUST be implemented for data
73
+ past its retention period. Deletion MUST be verifiable (deletion
74
+ receipts or audit logs). Users exercising right-to-erasure MUST
75
+ receive deletion confirmation within 30 days (GDPR) or 45 days (CCPA).
76
+ level: MUST
77
+ examples:
78
+ - "Customer account data: retained 7 years after account closure (tax requirements)"
79
+ - "Session tokens: deleted after 24 hours of inactivity via automated cron job"
80
+ - "Right-to-erasure request: user data purged from all systems within 25 days, confirmation email sent"
81
+
82
+ - id: REQ-005
83
+ title: Cross-Border Data Transfer Controls
84
+ description: |
85
+ Transfers of TIER-1 or TIER-2 PII across national borders MUST comply
86
+ with applicable transfer mechanisms. EU → non-adequate country transfers
87
+ MUST use Standard Contractual Clauses (SCCs) or Binding Corporate Rules.
88
+ Data residency requirements MUST be documented in the system design.
89
+ Cross-border transfers MUST be logged with destination country and
90
+ legal basis.
91
+ level: MUST
92
+ examples:
93
+ - "EU user data stored in AWS eu-west-1, not replicated to us-east-1 without SCC"
94
+ - "Transfer log: destination=US, mechanism=SCC-2021, purpose=customer-support, timestamp=..."
95
+ - "Architecture doc notes: 'All PII stored in EU region per GDPR Article 46'"
96
+
97
+ - id: REQ-006
98
+ title: PII Impact Assessment for New Features
99
+ description: |
100
+ Any new feature or system change that introduces new PII collection or
101
+ processing SHOULD undergo a Privacy Impact Assessment (PIA) before
102
+ implementation. The PIA MUST document: what PII is collected, purpose,
103
+ legal basis, retention period, third-party sharing, and risk mitigations.
104
+ Features with TIER-1 PII require mandatory PIA; TIER-2 is recommended.
105
+ level: SHOULD
106
+ examples:
107
+ - "New feature: 'Save payment method' → PIA required (TIER-1 card data)"
108
+ - "PIA template: docs/templates/privacy-impact-assessment.md"
109
+ - "PIA outcome: fingerprint auth approved with biometric data stored only on-device"