universal-dev-standards 5.17.0 → 6.1.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.
- package/bin/uds.js +13 -135
- package/bundled/ai/options/commit-message/bilingual.ai.yaml +19 -1
- package/bundled/ai/standards/acceptance-criteria-traceability.ai.yaml +13 -4
- package/bundled/ai/standards/accessibility-standards.ai.yaml +1 -1
- package/bundled/ai/standards/ai-response-navigation.ai.yaml +15 -2
- package/bundled/ai/standards/api-design-standards.ai.yaml +27 -4
- package/bundled/ai/standards/behavior-snapshot.ai.yaml +86 -9
- package/bundled/ai/standards/checkin-standards.ai.yaml +3 -3
- package/bundled/ai/standards/code-review.ai.yaml +2 -2
- package/bundled/ai/standards/context-aware-loading.ai.yaml +3 -3
- package/bundled/ai/standards/data-migration-testing.ai.yaml +79 -3
- package/bundled/ai/standards/deprecation-standards.ai.yaml +10 -2
- package/bundled/ai/standards/developer-memory.ai.yaml +4 -3
- package/bundled/ai/standards/documentation-writing-standards.ai.yaml +1 -1
- package/bundled/ai/standards/flow-based-testing.ai.yaml +2 -2
- package/bundled/ai/standards/forward-derivation-standards.ai.yaml +26 -2
- package/bundled/ai/standards/frontend-design-standards.ai.yaml +33 -3
- package/bundled/ai/standards/full-coverage-testing.ai.yaml +34 -2
- package/bundled/ai/standards/git-worktree.ai.yaml +3 -3
- package/bundled/ai/standards/logging.ai.yaml +97 -3
- package/bundled/ai/standards/mock-boundary.ai.yaml +48 -2
- package/bundled/ai/standards/model-provenance.ai.yaml +297 -0
- package/bundled/ai/standards/model-selection.ai.yaml +11 -2
- package/bundled/ai/standards/observability-standards.ai.yaml +10 -0
- package/bundled/ai/standards/performance-standards.ai.yaml +46 -1
- package/bundled/ai/standards/pii-classification.ai.yaml +15 -1
- package/bundled/ai/standards/pipeline-security-gates.ai.yaml +10 -0
- package/bundled/ai/standards/privacy-standards.ai.yaml +2 -2
- package/bundled/ai/standards/project-context-memory.ai.yaml +2 -2
- package/bundled/ai/standards/push-standards.ai.yaml +14 -3
- package/bundled/ai/standards/refactoring-standards.ai.yaml +68 -3
- package/bundled/ai/standards/requirement-engineering.ai.yaml +42 -3
- package/bundled/ai/standards/resource-cost-boundary.ai.yaml +279 -0
- package/bundled/ai/standards/reverse-engineering-standards.ai.yaml +55 -2
- package/bundled/ai/standards/security-testing.ai.yaml +13 -2
- package/bundled/ai/standards/self-review-protocol.ai.yaml +15 -10
- package/bundled/ai/standards/skill-standard-alignment-check.ai.yaml +37 -2
- package/bundled/ai/standards/user-journey-testing.ai.yaml +107 -0
- package/bundled/ai/standards/verification-evidence.ai.yaml +88 -5
- package/bundled/ai/standards/verification-oracle.ai.yaml +278 -0
- package/bundled/ai/standards/versioning.ai.yaml +32 -38
- package/bundled/core/acceptance-criteria-traceability.md +15 -5
- package/bundled/core/accessibility-standards.md +8 -4
- package/bundled/core/ai-friendly-architecture.md +1 -1
- package/bundled/core/ai-response-navigation.md +31 -3
- package/bundled/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/core/api-design-standards.md +92 -7
- package/bundled/core/audit-trail.md +119 -0
- package/bundled/core/behavior-snapshot.md +94 -7
- package/bundled/core/browser-compatibility-standards.md +15 -2
- package/bundled/core/checkin-standards.md +10 -3
- package/bundled/core/code-review-checklist.md +10 -2
- package/bundled/core/container-image-standards.md +97 -0
- package/bundled/core/context-aware-loading.md +2 -2
- package/bundled/core/cost-budget-test.md +1 -1
- package/bundled/core/cross-flow-regression.md +3 -2
- package/bundled/core/data-contract.md +104 -0
- package/bundled/core/data-migration-testing.md +90 -0
- package/bundled/core/data-pipeline.md +113 -0
- package/bundled/core/deprecation-standards.md +16 -2
- package/bundled/core/developer-memory.md +13 -8
- package/bundled/core/documentation-writing-standards.md +2 -2
- package/bundled/core/error-code-standards.md +4 -3
- package/bundled/core/feature-discovery-standards.md +191 -0
- package/bundled/core/flaky-test-management.md +1 -1
- package/bundled/core/flow-based-testing.md +3 -3
- package/bundled/core/forward-derivation-standards.md +33 -5
- package/bundled/core/frontend-design-standards.md +93 -4
- package/bundled/core/full-coverage-testing.md +72 -0
- package/bundled/core/git-worktree.md +4 -4
- package/bundled/core/guides/performance-guide.md +1 -1
- package/bundled/core/guides/security-guide.md +1 -1
- package/bundled/core/health-check-standards.md +2 -2
- package/bundled/core/iac-design-principles.md +97 -0
- package/bundled/core/incident-response.md +119 -0
- package/bundled/core/license-compliance.md +2 -0
- package/bundled/core/logging-standards.md +78 -2
- package/bundled/core/mock-boundary.md +54 -2
- package/bundled/core/model-provenance.md +181 -0
- package/bundled/core/model-selection.md +27 -2
- package/bundled/core/multi-environment-e2e-testing.md +195 -0
- package/bundled/core/packaging-standards.md +1 -0
- package/bundled/core/performance-standards.md +96 -2
- package/bundled/core/pii-classification.md +148 -0
- package/bundled/core/pipeline-security-gates.md +22 -2
- package/bundled/core/postmortem-standards.md +2 -0
- package/bundled/core/prd-standards.md +91 -0
- package/bundled/core/privacy-standards.md +14 -3
- package/bundled/core/product-metrics-standards.md +100 -0
- package/bundled/core/project-context-memory.md +8 -2
- package/bundled/core/prompt-regression.md +1 -1
- package/bundled/core/push-standards.md +82 -0
- package/bundled/core/refactoring-standards.md +44 -3
- package/bundled/core/replay-test.md +1 -1
- package/bundled/core/requirement-engineering.md +2 -2
- package/bundled/core/resource-cost-boundary.md +180 -0
- package/bundled/core/reverse-engineering-standards.md +66 -2
- package/bundled/core/runbook.md +113 -0
- package/bundled/core/schema-evolution.md +105 -0
- package/bundled/core/secret-management-standards.md +110 -0
- package/bundled/core/security-testing.md +26 -2
- package/bundled/core/self-review-protocol.md +15 -10
- package/bundled/core/skill-standard-alignment-check.md +53 -0
- package/bundled/core/slo-sli.md +109 -0
- package/bundled/core/smoke-test.md +1 -1
- package/bundled/core/tech-debt-standards.md +1 -1
- package/bundled/core/test-data-standards.md +2 -2
- package/bundled/core/user-journey-testing.md +102 -0
- package/bundled/core/user-story-mapping.md +96 -0
- package/bundled/core/verification-evidence.md +170 -10
- package/bundled/core/verification-oracle.md +167 -0
- package/bundled/core/versioning.md +133 -109
- package/bundled/locales/COVERAGE.md +94 -77
- package/bundled/locales/zh-CN/CHANGELOG.md +94 -6
- package/bundled/locales/zh-CN/CLAUDE.md +1 -1
- package/bundled/locales/zh-CN/MAINTENANCE.md +42 -661
- package/bundled/locales/zh-CN/README.md +25 -12
- package/bundled/locales/zh-CN/SECURITY.md +2 -2
- package/bundled/locales/zh-CN/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-CN/ai/options/commit-message/bilingual.ai.yaml +6 -1
- package/bundled/locales/zh-CN/core/acceptance-criteria-traceability.md +4 -6
- package/bundled/locales/zh-CN/core/accessibility-standards.md +1 -1
- package/bundled/locales/zh-CN/core/adversarial-test.md +226 -0
- package/bundled/locales/zh-CN/core/agent-behavior-discipline.md +187 -0
- package/bundled/locales/zh-CN/core/ai-response-navigation.md +32 -6
- package/bundled/locales/zh-CN/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/locales/zh-CN/core/api-design-standards.md +1 -1
- package/bundled/locales/zh-CN/core/behavior-snapshot.md +335 -0
- package/bundled/locales/zh-CN/core/browser-compatibility-standards.md +239 -0
- package/bundled/locales/zh-CN/core/cd-deployment-strategies.md +135 -0
- package/bundled/locales/zh-CN/core/chaos-injection-tests.md +130 -0
- package/bundled/locales/zh-CN/core/checkin-standards.md +1 -1
- package/bundled/locales/zh-CN/core/code-review-checklist.md +1 -1
- package/bundled/locales/zh-CN/core/container-security.md +535 -0
- package/bundled/locales/zh-CN/core/context-aware-loading.md +1 -1
- package/bundled/locales/zh-CN/core/contract-testing-standards.md +191 -0
- package/bundled/locales/zh-CN/core/cost-budget-test.md +86 -0
- package/bundled/locales/zh-CN/core/cross-flow-regression.md +200 -0
- package/bundled/locales/zh-CN/core/data-migration-testing.md +217 -0
- package/bundled/locales/zh-CN/core/deployment-standards.md +328 -9
- package/bundled/locales/zh-CN/core/deprecation-standards.md +1 -1
- package/bundled/locales/zh-CN/core/developer-memory.md +2 -2
- package/bundled/locales/zh-CN/core/disaster-recovery-drill.md +87 -0
- package/bundled/locales/zh-CN/core/documentation-structure.md +1 -1
- package/bundled/locales/zh-CN/core/documentation-writing-standards.md +1 -1
- package/bundled/locales/zh-CN/core/error-code-standards.md +2 -2
- package/bundled/locales/zh-CN/core/feature-manifest-standard.md +222 -0
- package/bundled/locales/zh-CN/core/flaky-test-management.md +87 -0
- package/bundled/locales/zh-CN/core/flow-based-testing.md +284 -0
- package/bundled/locales/zh-CN/core/forward-derivation-standards.md +3 -4
- package/bundled/locales/zh-CN/core/frontend-design-standards.md +1 -1
- package/bundled/locales/zh-CN/core/full-coverage-testing.md +269 -0
- package/bundled/locales/zh-CN/core/git-worktree.md +1 -1
- package/bundled/locales/zh-CN/core/governance-layer.md +160 -0
- package/bundled/locales/zh-CN/core/guides/performance-guide.md +515 -0
- package/bundled/locales/zh-CN/core/guides/security-guide.md +494 -0
- package/bundled/locales/zh-CN/core/knowledge-graph-memory.md +128 -0
- package/bundled/locales/zh-CN/core/license-compliance.md +131 -0
- package/bundled/locales/zh-CN/core/llm-output-validation.md +192 -0
- package/bundled/locales/zh-CN/core/logging-standards.md +205 -7
- package/bundled/locales/zh-CN/core/mock-boundary.md +161 -0
- package/bundled/locales/zh-CN/core/model-selection.md +28 -5
- package/bundled/locales/zh-CN/core/mutation-testing.md +106 -0
- package/bundled/locales/zh-CN/core/no-cicd-deployment.md +219 -0
- package/bundled/locales/zh-CN/core/packaging-standards.md +77 -5
- package/bundled/locales/zh-CN/core/pipeline-security-gates.md +146 -0
- package/bundled/locales/zh-CN/core/policy-as-code-testing.md +203 -0
- package/bundled/locales/zh-CN/core/privacy-standards.md +1 -1
- package/bundled/locales/zh-CN/core/project-context-memory.md +1 -1
- package/bundled/locales/zh-CN/core/prompt-regression.md +88 -0
- package/bundled/locales/zh-CN/core/property-based-testing.md +87 -0
- package/bundled/locales/zh-CN/core/release-quality-manifest.md +207 -0
- package/bundled/locales/zh-CN/core/release-readiness-gate.md +193 -0
- package/bundled/locales/zh-CN/core/replay-test.md +102 -0
- package/bundled/locales/zh-CN/core/requirement-engineering.md +1 -1
- package/bundled/locales/zh-CN/core/reverse-engineering-standards.md +46 -1
- package/bundled/locales/zh-CN/core/rollback-standards.md +120 -0
- package/bundled/locales/zh-CN/core/sast-advanced.md +309 -0
- package/bundled/locales/zh-CN/core/secure-op.md +328 -0
- package/bundled/locales/zh-CN/core/security-testing.md +113 -0
- package/bundled/locales/zh-CN/core/self-review-protocol.md +172 -0
- package/bundled/locales/zh-CN/core/server-ops-security.md +507 -0
- package/bundled/locales/zh-CN/core/smoke-test.md +79 -0
- package/bundled/locales/zh-CN/core/spec-driven-development.md +39 -3
- package/bundled/locales/zh-CN/core/supply-chain-attestation.md +131 -0
- package/bundled/locales/zh-CN/core/verification-evidence.md +252 -41
- package/bundled/locales/zh-CN/core/versioning.md +1 -1
- package/bundled/locales/zh-CN/docs/CHEATSHEET.md +36 -7
- package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +71 -53
- package/bundled/locales/zh-CN/docs/MIGRATION-v6.md +88 -0
- package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +2 -2
- package/bundled/locales/zh-CN/docs/USER-MANUAL.md +14 -14
- package/bundled/locales/zh-CN/docs/specs/system/memory-adoption-strategy.md +105 -0
- package/bundled/locales/zh-CN/docs/user/FAQ.md +132 -0
- package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +144 -0
- package/bundled/locales/zh-CN/docs/user/GLOSSARY.md +178 -0
- package/bundled/locales/zh-CN/docs/user/README.md +70 -0
- package/bundled/locales/zh-CN/docs/user/TROUBLESHOOTING.md +190 -0
- package/bundled/locales/zh-CN/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +1 -1
- package/bundled/locales/zh-CN/integrations/github-copilot/README.md +1 -1
- package/bundled/locales/zh-CN/integrations/github-copilot/skills-mapping.md +3 -3
- package/bundled/locales/zh-CN/integrations/opencode/skills-mapping.md +3 -3
- package/bundled/locales/zh-CN/methodologies/guides/sdd-guide.md +836 -0
- package/bundled/locales/zh-CN/options/changelog/auto-generated.md +166 -0
- package/bundled/locales/zh-CN/options/changelog/keep-a-changelog.md +140 -0
- package/bundled/locales/zh-CN/options/code-review/automated-review.md +214 -0
- package/bundled/locales/zh-CN/options/code-review/pair-programming.md +166 -0
- package/bundled/locales/zh-CN/options/code-review/pr-review.md +167 -0
- package/bundled/locales/zh-CN/options/commit-message/bilingual.md +10 -3
- package/bundled/locales/zh-CN/options/documentation/api-docs.md +191 -0
- package/bundled/locales/zh-CN/options/documentation/markdown-docs.md +150 -0
- package/bundled/locales/zh-CN/options/documentation/wiki-style.md +131 -0
- package/bundled/locales/zh-CN/options/project-structure/kotlin.md +144 -0
- package/bundled/locales/zh-CN/options/project-structure/php.md +168 -0
- package/bundled/locales/zh-CN/options/project-structure/ruby.md +156 -0
- package/bundled/locales/zh-CN/options/project-structure/rust.md +136 -0
- package/bundled/locales/zh-CN/options/project-structure/swift.md +165 -0
- package/bundled/locales/zh-CN/options/testing/contract-testing.md +237 -0
- package/bundled/locales/zh-CN/options/testing/industry-pyramid.md +200 -0
- package/bundled/locales/zh-CN/options/testing/istqb-framework.md +144 -0
- package/bundled/locales/zh-CN/options/testing/performance-testing.md +251 -0
- package/bundled/locales/zh-CN/options/testing/security-testing.md +192 -0
- package/bundled/locales/zh-CN/skills/README.md +89 -126
- package/bundled/locales/zh-CN/skills/ac-coverage/SKILL.md +5 -7
- package/bundled/locales/zh-CN/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/agents/code-architect.md +263 -0
- package/bundled/locales/zh-CN/skills/agents/doc-writer.md +410 -0
- package/bundled/locales/zh-CN/skills/agents/reviewer.md +357 -0
- package/bundled/locales/zh-CN/skills/agents/spec-analyst.md +410 -0
- package/bundled/locales/zh-CN/skills/agents/test-specialist.md +368 -0
- package/bundled/locales/zh-CN/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/locales/zh-CN/skills/atdd-assistant/atdd-workflow.md +3 -4
- package/bundled/locales/zh-CN/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/bdd-assistant/guide.md +1 -2
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/SKILL.md +115 -17
- package/bundled/locales/zh-CN/skills/brainstorm-assistant/guide.md +37 -12
- package/bundled/locales/zh-CN/skills/checkin-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/ci-cd-assistant/SKILL.md +50 -0
- package/bundled/locales/zh-CN/skills/code-review-assistant/SKILL.md +5 -5
- package/bundled/locales/zh-CN/skills/commands/ac-coverage.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/atdd.md +3 -3
- package/bundled/locales/zh-CN/skills/commands/bdd.md +2 -2
- package/bundled/locales/zh-CN/skills/commands/brainstorm.md +26 -17
- package/bundled/locales/zh-CN/skills/commands/{review.md → code-review.md} +4 -4
- package/bundled/locales/zh-CN/skills/commands/derive-all.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive-atdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive-bdd.md +2 -3
- package/bundled/locales/zh-CN/skills/commands/derive-tdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/derive.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/dev-workflow.md +2 -2
- package/bundled/locales/zh-CN/skills/commands/methodology.md +4 -4
- package/bundled/locales/zh-CN/skills/commands/pr.md +1 -1
- package/bundled/locales/zh-CN/skills/commands/tdd.md +1 -1
- package/bundled/locales/zh-CN/skills/commit-standards/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/dev-methodology/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/dev-methodology/create-methodology.md +456 -0
- package/bundled/locales/zh-CN/skills/dev-methodology/guide.md +6 -6
- package/bundled/locales/zh-CN/skills/dev-methodology/runtime.md +296 -0
- package/bundled/locales/zh-CN/skills/dev-workflow-guide/SKILL.md +5 -5
- package/bundled/locales/zh-CN/skills/docs-generator/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/e2e-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/journey-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/logging-guide/SKILL.md +169 -142
- package/bundled/locales/zh-CN/skills/migration-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/observability-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/pr-automation-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/project-discovery/guide.md +2 -2
- package/bundled/locales/zh-CN/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/runbook-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/security-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/skill-builder/SKILL.md +3 -3
- package/bundled/locales/zh-CN/skills/slo-assistant/guide.md +1 -1
- package/bundled/locales/zh-CN/skills/spec-derivation/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/spec-derivation/guide.md +8 -9
- package/bundled/locales/zh-CN/skills/spec-driven-dev/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/sweep/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/tdd-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-CN/skills/testing-guide/SKILL.md +2 -2
- package/bundled/locales/zh-CN/skills/testing-guide/testing-theory.md +2298 -0
- package/bundled/locales/zh-CN/skills/workflows/README.md +451 -0
- package/bundled/locales/zh-TW/CHANGELOG.md +94 -6
- package/bundled/locales/zh-TW/CLAUDE.md +1 -1
- package/bundled/locales/zh-TW/MAINTENANCE.md +51 -4
- package/bundled/locales/zh-TW/README.md +25 -12
- package/bundled/locales/zh-TW/SECURITY.md +2 -2
- package/bundled/locales/zh-TW/adoption/DAILY-WORKFLOW-GUIDE.md +2 -2
- package/bundled/locales/zh-TW/ai/options/commit-message/bilingual.ai.yaml +6 -1
- package/bundled/locales/zh-TW/ai/standards/versioning.ai.yaml +8 -48
- package/bundled/locales/zh-TW/core/acceptance-criteria-traceability.md +4 -6
- package/bundled/locales/zh-TW/core/accessibility-standards.md +1 -1
- package/bundled/locales/zh-TW/core/adversarial-test.md +226 -0
- package/bundled/locales/zh-TW/core/agent-behavior-discipline.md +187 -0
- package/bundled/locales/zh-TW/core/ai-response-navigation.md +32 -6
- package/bundled/locales/zh-TW/core/anti-sycophancy-prompting.md +1 -1
- package/bundled/locales/zh-TW/core/api-design-standards.md +91 -9
- package/bundled/locales/zh-TW/core/audit-trail.md +110 -0
- package/bundled/locales/zh-TW/core/behavior-snapshot.md +335 -0
- package/bundled/locales/zh-TW/core/browser-compatibility-standards.md +1 -0
- package/bundled/locales/zh-TW/core/cd-deployment-strategies.md +135 -0
- package/bundled/locales/zh-TW/core/chaos-injection-tests.md +130 -0
- package/bundled/locales/zh-TW/core/checkin-standards.md +1 -1
- package/bundled/locales/zh-TW/core/code-review-checklist.md +1 -1
- package/bundled/locales/zh-TW/core/container-image-standards.md +93 -0
- package/bundled/locales/zh-TW/core/container-security.md +535 -0
- package/bundled/locales/zh-TW/core/cost-budget-test.md +86 -0
- package/bundled/locales/zh-TW/core/cross-flow-regression.md +1 -0
- package/bundled/locales/zh-TW/core/data-contract.md +101 -0
- package/bundled/locales/zh-TW/core/data-migration-testing.md +217 -0
- package/bundled/locales/zh-TW/core/data-pipeline.md +105 -0
- package/bundled/locales/zh-TW/core/deployment-standards.md +363 -25
- package/bundled/locales/zh-TW/core/deprecation-standards.md +17 -4
- package/bundled/locales/zh-TW/core/developer-memory.md +2 -2
- package/bundled/locales/zh-TW/core/disaster-recovery-drill.md +87 -0
- package/bundled/locales/zh-TW/core/documentation-writing-standards.md +1 -1
- package/bundled/locales/zh-TW/core/error-code-standards.md +2 -2
- package/bundled/locales/zh-TW/core/feature-manifest-standard.md +222 -0
- package/bundled/locales/zh-TW/core/flaky-test-management.md +87 -0
- package/bundled/locales/zh-TW/core/flow-based-testing.md +284 -0
- package/bundled/locales/zh-TW/core/forward-derivation-standards.md +3 -4
- package/bundled/locales/zh-TW/core/frontend-design-standards.md +1 -1
- package/bundled/locales/zh-TW/core/full-coverage-testing.md +250 -0
- package/bundled/locales/zh-TW/core/git-worktree.md +1 -1
- package/bundled/locales/zh-TW/core/guides/performance-guide.md +515 -0
- package/bundled/locales/zh-TW/core/guides/security-guide.md +494 -0
- package/bundled/locales/zh-TW/core/iac-design-principles.md +90 -0
- package/bundled/locales/zh-TW/core/incident-response.md +111 -0
- package/bundled/locales/zh-TW/core/license-compliance.md +131 -0
- package/bundled/locales/zh-TW/core/llm-output-validation.md +192 -0
- package/bundled/locales/zh-TW/core/logging-standards.md +208 -4
- package/bundled/locales/zh-TW/core/mock-boundary.md +161 -0
- package/bundled/locales/zh-TW/core/model-provenance.md +173 -0
- package/bundled/locales/zh-TW/core/model-selection.md +28 -5
- package/bundled/locales/zh-TW/core/mutation-testing.md +106 -0
- package/bundled/locales/zh-TW/core/no-cicd-deployment.md +219 -0
- package/bundled/locales/zh-TW/core/packaging-standards.md +77 -5
- package/bundled/locales/zh-TW/core/performance-standards.md +84 -5
- package/bundled/locales/zh-TW/core/pii-classification.md +102 -0
- package/bundled/locales/zh-TW/core/pipeline-security-gates.md +146 -0
- package/bundled/locales/zh-TW/core/policy-as-code-testing.md +203 -0
- package/bundled/locales/zh-TW/core/prd-standards.md +88 -0
- package/bundled/locales/zh-TW/core/privacy-standards.md +1 -1
- package/bundled/locales/zh-TW/core/product-metrics-standards.md +96 -0
- package/bundled/locales/zh-TW/core/project-context-memory.md +1 -1
- package/bundled/locales/zh-TW/core/prompt-regression.md +88 -0
- package/bundled/locales/zh-TW/core/property-based-testing.md +87 -0
- package/bundled/locales/zh-TW/core/refactoring-standards.md +43 -6
- package/bundled/locales/zh-TW/core/release-quality-manifest.md +207 -0
- package/bundled/locales/zh-TW/core/replay-test.md +102 -0
- package/bundled/locales/zh-TW/core/requirement-engineering.md +1 -1
- package/bundled/locales/zh-TW/core/resource-cost-boundary.md +175 -0
- package/bundled/locales/zh-TW/core/reverse-engineering-standards.md +64 -5
- package/bundled/locales/zh-TW/core/rollback-standards.md +120 -0
- package/bundled/locales/zh-TW/core/runbook.md +110 -0
- package/bundled/locales/zh-TW/core/sast-advanced.md +309 -0
- package/bundled/locales/zh-TW/core/schema-evolution.md +98 -0
- package/bundled/locales/zh-TW/core/secret-management-standards.md +101 -0
- package/bundled/locales/zh-TW/core/secure-op.md +328 -0
- package/bundled/locales/zh-TW/core/security-testing.md +113 -0
- package/bundled/locales/zh-TW/core/self-review-protocol.md +18 -13
- package/bundled/locales/zh-TW/core/server-ops-security.md +507 -0
- package/bundled/locales/zh-TW/core/slo-sli.md +108 -0
- package/bundled/locales/zh-TW/core/smoke-test.md +79 -0
- package/bundled/locales/zh-TW/core/spec-driven-development.md +19 -11
- package/bundled/locales/zh-TW/core/supply-chain-attestation.md +131 -0
- package/bundled/locales/zh-TW/core/user-journey-testing.md +111 -0
- package/bundled/locales/zh-TW/core/user-story-mapping.md +94 -0
- package/bundled/locales/zh-TW/core/verification-evidence.md +260 -31
- package/bundled/locales/zh-TW/core/verification-oracle.md +159 -0
- package/bundled/locales/zh-TW/core/versioning.md +112 -112
- package/bundled/locales/zh-TW/docs/CHEATSHEET.md +36 -7
- package/bundled/locales/zh-TW/docs/DEV-WORKFLOW-MAPPING.md +6 -6
- package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +71 -53
- package/bundled/locales/zh-TW/docs/MIGRATION-v6.md +88 -0
- package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +2 -2
- package/bundled/locales/zh-TW/docs/USER-MANUAL.md +14 -14
- package/bundled/locales/zh-TW/docs/specs/system/memory-adoption-strategy.md +105 -0
- package/bundled/locales/zh-TW/docs/user/FAQ.md +132 -0
- package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +144 -0
- package/bundled/locales/zh-TW/docs/user/GLOSSARY.md +178 -0
- package/bundled/locales/zh-TW/docs/user/README.md +70 -0
- package/bundled/locales/zh-TW/docs/user/TROUBLESHOOTING.md +190 -0
- package/bundled/locales/zh-TW/integrations/github-copilot/COPILOT-CHAT-REFERENCE.md +1 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/README.md +1 -1
- package/bundled/locales/zh-TW/integrations/github-copilot/skills-mapping.md +3 -3
- package/bundled/locales/zh-TW/integrations/opencode/skills-mapping.md +3 -3
- package/bundled/locales/zh-TW/methodologies/guides/sdd-guide.md +523 -26
- package/bundled/locales/zh-TW/options/changelog/auto-generated.md +166 -0
- package/bundled/locales/zh-TW/options/changelog/keep-a-changelog.md +140 -0
- package/bundled/locales/zh-TW/options/code-review/automated-review.md +214 -0
- package/bundled/locales/zh-TW/options/code-review/pair-programming.md +166 -0
- package/bundled/locales/zh-TW/options/code-review/pr-review.md +167 -0
- package/bundled/locales/zh-TW/options/commit-message/bilingual.md +10 -3
- package/bundled/locales/zh-TW/options/documentation/api-docs.md +191 -0
- package/bundled/locales/zh-TW/options/documentation/markdown-docs.md +150 -0
- package/bundled/locales/zh-TW/options/documentation/wiki-style.md +131 -0
- package/bundled/locales/zh-TW/options/project-structure/kotlin.md +144 -0
- package/bundled/locales/zh-TW/options/project-structure/php.md +168 -0
- package/bundled/locales/zh-TW/options/project-structure/ruby.md +156 -0
- package/bundled/locales/zh-TW/options/project-structure/rust.md +136 -0
- package/bundled/locales/zh-TW/options/project-structure/swift.md +165 -0
- package/bundled/locales/zh-TW/options/testing/contract-testing.md +237 -0
- package/bundled/locales/zh-TW/options/testing/industry-pyramid.md +200 -0
- package/bundled/locales/zh-TW/options/testing/istqb-framework.md +144 -0
- package/bundled/locales/zh-TW/options/testing/performance-testing.md +251 -0
- package/bundled/locales/zh-TW/options/testing/security-testing.md +192 -0
- package/bundled/locales/zh-TW/skills/README.md +91 -128
- package/bundled/locales/zh-TW/skills/ac-coverage/SKILL.md +4 -6
- package/bundled/locales/zh-TW/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/agents/code-architect.md +263 -0
- package/bundled/locales/zh-TW/skills/agents/doc-writer.md +410 -0
- package/bundled/locales/zh-TW/skills/agents/reviewer.md +357 -0
- package/bundled/locales/zh-TW/skills/agents/spec-analyst.md +410 -0
- package/bundled/locales/zh-TW/skills/agents/test-specialist.md +368 -0
- package/bundled/locales/zh-TW/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/locales/zh-TW/skills/atdd-assistant/atdd-workflow.md +3 -4
- package/bundled/locales/zh-TW/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/bdd-assistant/SKILL.md +2 -0
- package/bundled/locales/zh-TW/skills/bdd-assistant/guide.md +1 -2
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/SKILL.md +116 -18
- package/bundled/locales/zh-TW/skills/brainstorm-assistant/guide.md +38 -11
- package/bundled/locales/zh-TW/skills/checkin-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/ci-cd-assistant/SKILL.md +50 -0
- package/bundled/locales/zh-TW/skills/code-review-assistant/SKILL.md +7 -5
- package/bundled/locales/zh-TW/skills/commands/ac-coverage.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/atdd.md +3 -3
- package/bundled/locales/zh-TW/skills/commands/bdd.md +2 -2
- package/bundled/locales/zh-TW/skills/commands/brainstorm.md +26 -17
- package/bundled/locales/zh-TW/skills/commands/{review.md → code-review.md} +5 -5
- package/bundled/locales/zh-TW/skills/commands/derive-all.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive-atdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive-bdd.md +2 -3
- package/bundled/locales/zh-TW/skills/commands/derive-tdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/derive.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/dev-workflow.md +2 -2
- package/bundled/locales/zh-TW/skills/commands/methodology.md +4 -4
- package/bundled/locales/zh-TW/skills/commands/pr.md +1 -1
- package/bundled/locales/zh-TW/skills/commands/tdd.md +1 -1
- package/bundled/locales/zh-TW/skills/commit-standards/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/contract-test-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/dev-methodology/create-methodology.md +456 -0
- package/bundled/locales/zh-TW/skills/dev-methodology/guide.md +5 -5
- package/bundled/locales/zh-TW/skills/dev-methodology/runtime.md +296 -0
- package/bundled/locales/zh-TW/skills/dev-workflow-guide/SKILL.md +5 -5
- package/bundled/locales/zh-TW/skills/docs-generator/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/e2e-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/logging-guide/SKILL.md +52 -27
- package/bundled/locales/zh-TW/skills/migration-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/pr-automation-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/project-discovery/guide.md +2 -2
- package/bundled/locales/zh-TW/skills/reverse-engineer/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/security-assistant/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/spec-derivation/guide.md +7 -8
- package/bundled/locales/zh-TW/skills/spec-driven-dev/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/sweep/SKILL.md +1 -1
- package/bundled/locales/zh-TW/skills/tdd-assistant/SKILL.md +3 -1
- package/bundled/locales/zh-TW/skills/testing-guide/SKILL.md +2 -2
- package/bundled/locales/zh-TW/skills/testing-guide/testing-theory.md +2298 -0
- package/bundled/locales/zh-TW/skills/workflows/README.md +451 -0
- package/bundled/skills/README.md +1 -1
- package/bundled/skills/ac-coverage/SKILL.md +17 -7
- package/bundled/skills/adr-assistant/SKILL.md +1 -1
- package/bundled/skills/agents/code-architect.md +1 -1
- package/bundled/skills/agents/doc-writer.md +1 -1
- package/bundled/skills/agents/reviewer.md +2 -2
- package/bundled/skills/agents/spec-analyst.md +1 -1
- package/bundled/skills/agents/test-specialist.md +1 -1
- package/bundled/skills/ai-collaboration-standards/SKILL.md +2 -2
- package/bundled/skills/ai-friendly-architecture/SKILL.md +2 -2
- package/bundled/skills/ai-instruction-standards/SKILL.md +1 -1
- package/bundled/skills/atdd-assistant/SKILL.md +7 -0
- package/bundled/skills/atdd-assistant/acceptance-criteria-guide.md +1 -1
- package/bundled/skills/atdd-assistant/atdd-workflow.md +6 -8
- package/bundled/skills/audit-assistant/SKILL.md +2 -2
- package/bundled/skills/bdd-assistant/SKILL.md +7 -0
- package/bundled/skills/bdd-assistant/guide.md +1 -2
- package/bundled/skills/brainstorm-assistant/SKILL.md +139 -15
- package/bundled/skills/brainstorm-assistant/guide.md +39 -8
- package/bundled/skills/checkin-assistant/SKILL.md +8 -1
- package/bundled/skills/ci-cd-assistant/SKILL.md +57 -0
- package/bundled/skills/code-review-assistant/SKILL.md +15 -8
- package/bundled/skills/commands/COMMAND-FAMILY-OVERVIEW.md +2 -2
- package/bundled/skills/commands/COMMAND-INDEX.json +3 -3
- package/bundled/skills/commands/README.md +2 -2
- package/bundled/skills/commands/ac-coverage.md +1 -1
- package/bundled/skills/commands/atdd.md +2 -2
- package/bundled/skills/commands/bdd.md +2 -2
- package/bundled/skills/commands/brainstorm.md +25 -14
- package/bundled/skills/commands/{review.md → code-review.md} +6 -6
- package/bundled/skills/commands/derive-all.md +1 -1
- package/bundled/skills/commands/derive-atdd.md +1 -1
- package/bundled/skills/commands/derive-bdd.md +2 -3
- package/bundled/skills/commands/derive-tdd.md +1 -1
- package/bundled/skills/commands/derive.md +1 -1
- package/bundled/skills/commands/dev-workflow.md +1 -1
- package/bundled/skills/commands/journey-test.md +45 -0
- package/bundled/skills/commands/methodology.md +4 -4
- package/bundled/skills/commands/pr.md +1 -1
- package/bundled/skills/commands/skill-builder.md +42 -0
- package/bundled/skills/commands/tdd.md +1 -1
- package/bundled/skills/dev-methodology/create-methodology.md +1 -1
- package/bundled/skills/dev-methodology/guide.md +1 -1
- package/bundled/skills/dev-methodology/runtime.md +1 -1
- package/bundled/skills/dev-workflow-guide/SKILL.md +3 -3
- package/bundled/skills/dev-workflow-guide/workflow-phases.md +3 -3
- package/bundled/skills/docs-generator/SKILL.md +3 -3
- package/bundled/skills/incident-response-assistant/SKILL.md +2 -2
- package/bundled/skills/logging-guide/SKILL.md +38 -2
- package/bundled/skills/migration-assistant/SKILL.md +226 -0
- package/bundled/skills/observability-assistant/SKILL.md +74 -0
- package/bundled/skills/pr-automation-assistant/SKILL.md +5 -1
- package/bundled/skills/project-discovery/guide.md +2 -2
- package/bundled/skills/push/SKILL.md +1 -1
- package/bundled/skills/release-standards/SKILL.md +19 -5
- package/bundled/skills/security-assistant/SKILL.md +1 -1
- package/bundled/skills/skill-builder/SKILL.md +1 -1
- package/bundled/skills/spec-derivation/guide.md +3 -4
- package/bundled/skills/spec-driven-dev/SKILL.md +13 -2
- package/bundled/skills/sweep/SKILL.md +1 -1
- package/bundled/skills/tdd-assistant/SKILL.md +8 -1
- package/bundled/skills/testing-guide/SKILL.md +1 -1
- package/bundled/skills/testing-guide/testing-theory.md +1 -1
- package/bundled/skills/workflows/README.md +2 -2
- package/package.json +4 -4
- package/src/commands/audit.js +30 -9
- package/src/commands/config.js +33 -2
- package/src/commands/hitl.js +14 -1
- package/src/commands/init.js +168 -75
- package/src/commands/quickstart.js +1 -2
- package/src/commands/release.js +51 -6
- package/src/commands/run-intent.js +9 -0
- package/src/commands/spec-split.js +27 -2
- package/src/commands/update.js +22 -6
- package/src/config/ai-agent-paths.js +3 -1
- package/src/i18n/messages.js +3 -102
- package/src/missions/MissionManager.js +44 -12
- package/src/utils/build-manifest.js +35 -3
- package/src/utils/friction-detector.js +71 -22
- package/src/utils/health-checker.js +29 -2
- package/src/utils/transaction.js +111 -0
- package/src/utils/version-promote.js +16 -0
- package/standards-registry.json +61 -149
- package/bundled/ai/standards/agent-communication-protocol.ai.yaml +0 -42
- package/bundled/ai/standards/agent-dispatch.ai.yaml +0 -42
- package/bundled/ai/standards/branch-completion.ai.yaml +0 -44
- package/bundled/ai/standards/change-batching-standards.ai.yaml +0 -44
- package/bundled/ai/standards/execution-history.ai.yaml +0 -42
- package/bundled/ai/standards/pipeline-integration-standards.ai.yaml +0 -42
- package/bundled/ai/standards/workflow-enforcement.ai.yaml +0 -44
- package/bundled/ai/standards/workflow-state-protocol.ai.yaml +0 -43
- package/src/commands/flow.js +0 -260
- package/src/commands/start.js +0 -372
- package/src/commands/sweep.js +0 -151
- package/src/commands/workflow.js +0 -681
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/mock-boundary.md
|
|
3
|
+
source_version: 1.1.0
|
|
4
|
+
translation_version: 1.1.0
|
|
5
|
+
last_synced: 2026-07-01
|
|
6
|
+
source_hash: fe4715991a4c
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Mock 邊界標準
|
|
11
|
+
|
|
12
|
+
> **Language**: [English](../../../core/mock-boundary.md) | 繁體中文
|
|
13
|
+
|
|
14
|
+
**版本**: 1.1.0
|
|
15
|
+
**最後更新**: 2026-07-01
|
|
16
|
+
**適用範圍**: 所有具備單元測試與整合測試的軟體專案
|
|
17
|
+
**Scope**: universal
|
|
18
|
+
**產業標準**: ISTQB Foundation(Test Doubles), xUnit Patterns(Gerard Meszaros)
|
|
19
|
+
**參考資料**: "Working Effectively with Legacy Code"(Feathers), "Growing Object-Oriented Software"(Freeman & Pryce)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 目的
|
|
24
|
+
|
|
25
|
+
本文件定義測試中哪些東西可以 mock、哪些不可以。其目標是防止**空心測試(hollow tests)**——永遠通過卻無法偵測真實 bug 的測試,因為它們用 stub 取代了系統的邏輯。
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 空心測試問題
|
|
30
|
+
|
|
31
|
+
空心測試 mock 掉系統的大部分內容,使測試變成 mock 接線的規格說明,而非系統行為的規格說明。經典症狀:你可以刪掉實作檔案,測試仍然通過。
|
|
32
|
+
|
|
33
|
+
**真實案例(Multi-agent pipeline SPEC-002.test.ts)**:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
vi.mock('../../src/runner/agent-runner.js') // Core logic replaced
|
|
37
|
+
vi.mock('../../src/runner/guardian-hooks.js') // Core logic replaced
|
|
38
|
+
vi.mock('../../src/runner/prototyper.js') // Core logic replaced
|
|
39
|
+
vi.mock('../../src/runner/iteration-report.js') // Core logic replaced
|
|
40
|
+
vi.mock('../../src/memory/memory-store.js') // Core logic replaced
|
|
41
|
+
vi.mock('node:fs/promises', ...) // I/O replaced
|
|
42
|
+
|
|
43
|
+
// All assertions verify mock call counts — not actual outputs.
|
|
44
|
+
// runPipeline() touches zero real code.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 可以 Mock 的項目
|
|
50
|
+
|
|
51
|
+
| 類別 | 範例 | 理由 |
|
|
52
|
+
|------|------|------|
|
|
53
|
+
| 外部 HTTP 服務 | LLM API、金流閘道、email 服務 | 防止不穩定(flaky)測試;可控制回應情境 |
|
|
54
|
+
| 時間函式 | `Date.now()`、`new Date()`、`setTimeout` | 使測試具確定性 |
|
|
55
|
+
| 環境變數 | `process.env.NODE_ENV`、`process.env.LICENSE_KEY` | 支援組態變化 |
|
|
56
|
+
| 檔案系統(僅限單元測試) | `fs.readFile`、`fs.writeFile` | 讓快速單元測試避免 I/O |
|
|
57
|
+
| 跨模組邊界(須有對應 IT) | 其他模組的 public API | 隔離受測單元 |
|
|
58
|
+
| 行程內背景執行(透過可注入 runner) | `Task.Run`、unawaited promise、`setTimeout`、goroutine、thread-pool dispatch | 注入 runner seam 讓測試能 await 到確定完成,消除 race |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## 不可 Mock 的項目
|
|
63
|
+
|
|
64
|
+
| 類別 | 違規範例 | 禁止原因 |
|
|
65
|
+
|------|---------|---------|
|
|
66
|
+
| 自身模組的核心邏輯 | 在 pipeline-runner 測試中 `vi.mock('./pipeline-runner.js')` | 使測試形同虛設 |
|
|
67
|
+
| IT/flow/E2E 測試中的資料庫 | 在整合測試中 `vi.mock('./db/client.js')` | 隱藏查詢 bug、schema 問題 |
|
|
68
|
+
| HTTP 框架內部 | `vi.mock('express')` | 真實路由可能已壞 |
|
|
69
|
+
| 安全控制 | 永遠通過的 auth middleware stub | 安全性回歸不可見 |
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 可注入的背景執行(Injectable Background Execution)
|
|
74
|
+
|
|
75
|
+
fire-and-forget 的背景工作(`Task.Run`、unawaited promise、`setTimeout`、goroutine、`java.util.concurrent` executor 提交,或 `asyncio.create_task`)是一個 **seam**,就跟系統時鐘一樣。正如你注入 clock 而非讀取 wall-clock 時間,你也應注入背景 dispatcher,而非直接生出背景工作。這讓測試能把工作驅動到**確定、可被 await 的完成**,並斷言其結果(成功、例外或 retry)——不用 poll、不用 sleep、沒有 race。
|
|
76
|
+
|
|
77
|
+
把 dispatch 抽象成一個小介面(例如 `IBackgroundTaskRunner` / `BackgroundDispatcher`),再提供兩種實作:
|
|
78
|
+
|
|
79
|
+
- **Production**:保留真正的 fire-and-forget 語意——dispatch 立即回傳,工作以 detached 方式執行。
|
|
80
|
+
- **Test**:以 **inline** 方式執行工作並**追蹤底層 Task/promise**,對外暴露一個 handle 讓測試能 `await`,使完成(與任何失敗)可被觀察。
|
|
81
|
+
|
|
82
|
+
語言中立示意(TypeScript pseudo-code):
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
// Seam — 於任何 dispatch 背景工作處注入
|
|
86
|
+
interface BackgroundDispatcher {
|
|
87
|
+
dispatch(work: () => Promise<void>): void
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Production:真正的 fire-and-forget——立即回傳,工作以 detached 執行
|
|
91
|
+
class FireAndForgetDispatcher implements BackgroundDispatcher {
|
|
92
|
+
dispatch(work: () => Promise<void>): void {
|
|
93
|
+
void work() // 刻意不 await
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Test:inline 執行 + 追蹤 task,讓測試能 await 到完成
|
|
98
|
+
class DeterministicDispatcher implements BackgroundDispatcher {
|
|
99
|
+
private readonly tasks: Promise<void>[] = []
|
|
100
|
+
dispatch(work: () => Promise<void>): void {
|
|
101
|
+
this.tasks.push(work()) // inline 啟動並保留 handle
|
|
102
|
+
}
|
|
103
|
+
async settle(): Promise<void> {
|
|
104
|
+
await Promise.all(this.tasks) // 測試 await 到確定完成
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
測試注入 `DeterministicDispatcher`,執行受測程式碼,再於斷言結果前 `await dispatcher.settle()`——背景副作用此時已完全可觀察且具確定性。
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## 空心測試偵測
|
|
114
|
+
|
|
115
|
+
提交測試檔之前,請檢查:
|
|
116
|
+
|
|
117
|
+
1. **Mock 數量 ≥ import 數量** → 審查:至少要有一個斷言驗證實際輸出
|
|
118
|
+
2. **所有斷言都是 `.toHaveBeenCalled()` 系列** → 加入輸出值斷言
|
|
119
|
+
3. **Mock 路徑與受測對象目錄相同** → 自我引用 mock;移除之
|
|
120
|
+
4. **Mock 設定行數多於斷言行數** → 很可能是空心測試
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 反模式
|
|
125
|
+
|
|
126
|
+
- **Total Mock Isolation**:所有 import 都被 mock;只斷言 mock 互動
|
|
127
|
+
- **Mock the World**:外部 + 內部 + DB + FS 在同一個測試中全部 mock
|
|
128
|
+
- **Orphan Mock**:跨模組 mock 卻沒有對應的整合測試
|
|
129
|
+
- **Security Bypass Mock**:auth/權限邏輯被換成直接放行的 stub
|
|
130
|
+
- **Database Mock Cascade**:DB 回傳寫死的資料,隱藏真實查詢錯誤
|
|
131
|
+
- **Poll/Sleep for Background Result**:用 sleep 或 poll 等待 fire-and-forget 背景工作完成。race 依然存在——timeout 只是多數時候把它遮住,同時拖慢整套測試;在共用 runner 上更會把 flakiness 洩漏進其他 MR 的 CI。改注入 deterministic runner 並 await 被追蹤的 task。
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 規則摘要
|
|
136
|
+
|
|
137
|
+
| 規則 | 觸發條件 | 動作 |
|
|
138
|
+
|------|---------|------|
|
|
139
|
+
| 禁止 self-mock | 測試檔 mock 自己的模組 | 移除 mock;讓真實程式碼執行 |
|
|
140
|
+
| IT/flow 用真實 DB | 撰寫 IT 或 flow 測試 | 使用 in-memory SQLite 或測試 schema |
|
|
141
|
+
| IT 對應測試 | mock 跨模組邊界 | 確保有對應的 IT 存在 |
|
|
142
|
+
| 禁止 mock 安全機制 | 測試涉及 auth/權限 | 使用真實測試使用者 + 真實 token |
|
|
143
|
+
| 空心審查 | Mock 數量 ≥ import 數量 | 加入輸出值斷言 |
|
|
144
|
+
| 背景工作禁止 poll/sleep | 測試斷言某個 fire-and-forget 副作用 | 注入 deterministic runner;await 被追蹤的 task |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## 與其他標準的關係
|
|
149
|
+
|
|
150
|
+
- **testing**:Mock 邊界規則適用於測試金字塔的所有測試層級
|
|
151
|
+
- **test-completeness-dimensions**:維度 8(AI 測試品質)引用了這些規則
|
|
152
|
+
- **flow-based-testing**:Flow 測試必須遵循 mock 邊界規則
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 版本歷史
|
|
157
|
+
|
|
158
|
+
| 版本 | 日期 | 變更 |
|
|
159
|
+
|------|------|------|
|
|
160
|
+
| 1.0.0 | 2026-05-04 | 初始標準:空心測試問題、可/不可 Mock 表格、偵測、反模式、規則摘要 |
|
|
161
|
+
| 1.1.0 | 2026-07-01 | 新增可注入的背景執行作為 seam(平行於 clock injection):可 Mock 表列、`可注入的背景執行` 章節、`Poll/Sleep for Background Result` 反模式,以及背景工作禁止 poll/sleep 規則(issue #143) |
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/model-provenance.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-17
|
|
6
|
+
source_hash: 62e6b25a38dd
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 模型來源政策標準
|
|
11
|
+
|
|
12
|
+
> **Language**: [English](../../../core/model-provenance.md) | 繁體中文
|
|
13
|
+
|
|
14
|
+
> **版本**: 1.0.0 | **狀態**: Active | **更新日期**: 2026-06-17
|
|
15
|
+
> **AI 最佳化版本**: `ai/standards/model-provenance.ai.yaml`
|
|
16
|
+
> **規格**: XSPEC-255 (cross-project/specs/XSPEC-255-model-provenance-policy.md)
|
|
17
|
+
|
|
18
|
+
## 概述
|
|
19
|
+
|
|
20
|
+
模型選擇不只是「成本 × 品質」——還有 **第三軸:模型的*來源*是否被客戶接受**(地緣政治 /
|
|
21
|
+
資料主權 / 法規)。受監管或地緣敏感的買家(如台灣金融/政府客戶)可能無法使用某司法管轄區的
|
|
22
|
+
模型;最嚴格者連 **本地跑的開源權重** 都拒用。本標準把 **模型的來源(provenance)升為一級、
|
|
23
|
+
可強制、可稽核的屬性**:宣告可接受來源政策、對不合規的模型選擇 **fail-closed block**、並產出
|
|
24
|
+
可稽核證據(「本交付未使用任何被禁來源的模型」)。
|
|
25
|
+
|
|
26
|
+
它是治理閘門家族中的 **來源(provenance)** 成員——與 `license-compliance`(XSPEC-193,
|
|
27
|
+
*授權*)、`verification-oracle`(XSPEC-256,*正確性*)並列——三者共用同一形狀:
|
|
28
|
+
**登錄/檢查 → fail-closed 閘門 → 稽核證據 → 升級給人的天花板**。三者是同一機制在三條軸上的
|
|
29
|
+
profile:**授權 / 來源 / 正確性**。
|
|
30
|
+
|
|
31
|
+
> **範圍**:本標準定義 *來源機制*(來源登錄、政策 schema、在每個模型選擇點的 fail-closed
|
|
32
|
+
> 強制、稽核證據、天花板)。**政策內容(具體的 allow/deny 清單)歸客戶或合規 pack**——那是他
|
|
33
|
+
> 的業務決策(DEC-075 中立機制 / DEC-063 合規姿態歸客戶)。執行引擎接線(如 VibeOps provider
|
|
34
|
+
> 抽象層 / 路由閘門)屬下游採用議題,不在本標準範圍。
|
|
35
|
+
|
|
36
|
+
## 需求
|
|
37
|
+
|
|
38
|
+
| ID | 規則 | 等級 |
|
|
39
|
+
|----|------|------|
|
|
40
|
+
| REQ-001 | Model Origin Registry 為一級工件(模型 → 廠商 → 司法管轄/來源類別) | MUST |
|
|
41
|
+
| REQ-002 | Provenance Policy schema(allow/deny 來源、本地權重區分、mode、unknown-origin) | MUST |
|
|
42
|
+
| REQ-003 | 在每個模型選擇點 fail-closed 強制 | MUST |
|
|
43
|
+
| REQ-004 | 可稽核的來源證據(每次生成記錄模型 + 來源;合規報告) | MUST |
|
|
44
|
+
| REQ-005 | 示範機制的參考政策 pack(內容歸客戶/pack) | SHOULD |
|
|
45
|
+
| REQ-006 | 未知來源模型 → fail-closed block/升級(不靜默放行) | MUST |
|
|
46
|
+
| REQ-007 | 來源政策內容主權——機制中立、政策歸客戶 | SHOULD |
|
|
47
|
+
|
|
48
|
+
### REQ-001 — Model Origin Registry
|
|
49
|
+
|
|
50
|
+
每個已知模型 MUST 依 **廠商 → 司法管轄 → 來源類別** 分類。如同 `license-compliance` 的授權 DB,
|
|
51
|
+
此 registry 可維護、可由生態/客戶擴充。來源類別至少要能區分 western-frontier、western-open
|
|
52
|
+
與其他來源,政策才能針對它們表達。例:
|
|
53
|
+
|
|
54
|
+
| 模型 | 廠商 | 司法管轄 | 來源類別 |
|
|
55
|
+
|------|------|----------|----------|
|
|
56
|
+
| Claude | Anthropic | US | western-frontier |
|
|
57
|
+
| GPT / o-series | OpenAI | US | western-frontier |
|
|
58
|
+
| Gemini | Google | US | western-frontier |
|
|
59
|
+
| Llama | Meta | US | western-open |
|
|
60
|
+
| Mistral | Mistral | EU | western-open |
|
|
61
|
+
| Gemma | Google | US | western-open |
|
|
62
|
+
| DeepSeek | DeepSeek | CN | china-origin |
|
|
63
|
+
| MiniMax | MiniMax | CN | china-origin |
|
|
64
|
+
| Qwen | Alibaba | CN | china-origin |
|
|
65
|
+
|
|
66
|
+
### REQ-002 — Provenance Policy Schema
|
|
67
|
+
|
|
68
|
+
per-project/per-customer 政策 MUST 至少能表達:`allow_origins` / `deny_origins`(依來源類別)、
|
|
69
|
+
一個 **本地權重區分**(透過外國 API 存取的模型——資料外送——vs 同一模型的開源權重本地跑——資料
|
|
70
|
+
留本地但權重是外國的)、強制 `mode`(`block` / `warn` / `require_human`),以及預設 **fail-closed**
|
|
71
|
+
的 `unknown_origin` 行為。
|
|
72
|
+
|
|
73
|
+
```jsonc
|
|
74
|
+
{
|
|
75
|
+
"allow_origins": ["western-frontier", "western-open"],
|
|
76
|
+
"deny_origins": ["china-origin"],
|
|
77
|
+
"china_local_weights": "deny", // deny | allow_local_only —— 嚴格者連本地外國權重都 deny
|
|
78
|
+
"mode": "block", // block | warn | require_human
|
|
79
|
+
"unknown_origin": "block" // fail-closed
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### REQ-003 — Fail-Closed 強制
|
|
84
|
+
|
|
85
|
+
在 **每個模型選擇點**(per-agent config / 路由決策 / BYOK),所選模型的來源 MUST 對照啟用中的
|
|
86
|
+
政策。違規 MUST **fail-closed block(或升級)**——絕不靜默放行(比照 `license-compliance`
|
|
87
|
+
blocklist 與 `verification-oracle` 未複現 block)。強制在路由 *之前* 接線,使不被允許的來源被
|
|
88
|
+
換成可接受的模型,而非被使用。
|
|
89
|
+
|
|
90
|
+
### REQ-004 — 稽核證據
|
|
91
|
+
|
|
92
|
+
每次生成 MUST 記錄 **使用的模型 + 其來源類別**,使其可產出合規報告,如:*「本交付未使用任何
|
|
93
|
+
被禁來源的模型」*。證據接稽核 logger / hash chain、`verification-oracle` 正確性證據(XSPEC-256)
|
|
94
|
+
與 telemetry 白名單(DEC-066)。**此報告=來源/治理護城河的對外證物**,也是客戶的合規證物。
|
|
95
|
+
|
|
96
|
+
### REQ-005 — 參考政策 pack
|
|
97
|
+
|
|
98
|
+
機制 SHOULD ship 少量 **參考政策 pack** 來示範它(例如一個 deny 某來源含本地權重的 pack)。
|
|
99
|
+
機制領域中立;**具體政策內容由客戶或合規夥伴擁有**(比照合規 domain pack 的參考 pack 定位)。
|
|
100
|
+
|
|
101
|
+
### REQ-006 — 未知來源 fail-closed
|
|
102
|
+
|
|
103
|
+
來源 **不在 registry**(未知來源)的模型 MUST NOT 被靜默允許。系統 MUST 把未知來源當成
|
|
104
|
+
**fail-closed block 或升級**(REQ-002 `unknown_origin`),與治理閘門「不靜默放行」規則一致。
|
|
105
|
+
|
|
106
|
+
### REQ-007 — 來源政策內容主權
|
|
107
|
+
|
|
108
|
+
來源 *機制* 領域中立(DEC-075);*政策內容*(哪些來源可接受)歸客戶(DEC-063)。採用者
|
|
109
|
+
SHOULD 讓政策維持客戶範圍且隔離(參見 `license-compliance` / `verification-oracle` 的逐客戶
|
|
110
|
+
模式,DEC-064)。
|
|
111
|
+
|
|
112
|
+
## 原則
|
|
113
|
+
|
|
114
|
+
| ID | 原則 |
|
|
115
|
+
|----|------|
|
|
116
|
+
| P-1 | 來源是第三軸——模型選擇=成本 × 品質 × *可接受來源* |
|
|
117
|
+
| P-2 | Registry First——每個模型先帶廠商/司法管轄/來源類別,政策才能作用 |
|
|
118
|
+
| P-3 | Fail-Closed——被禁或未知來源則 block 或升級;絕不靜默放行 |
|
|
119
|
+
| P-4 | 證據導向——每次生成記錄模型 + 來源;可產合規報告 |
|
|
120
|
+
| P-5 | 人的天花板——模糊/`require_human` 來源升級給人(DEC-076) |
|
|
121
|
+
| P-6 | 內容主權——機制中立,可接受來源政策歸客戶 |
|
|
122
|
+
|
|
123
|
+
## 閘門時機
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
模型選擇點(per-agent config / 路由 / BYOK)
|
|
127
|
+
│
|
|
128
|
+
├─→ [來源政策檢查] ← REQ-003 fail-closed、路由前
|
|
129
|
+
│ │
|
|
130
|
+
│ 被禁 / 未知 ──→ block 或升級給人 ← REQ-006 / P-5 天花板
|
|
131
|
+
│ │
|
|
132
|
+
│ 允許 ──→ 繼續;記錄模型 + 來源 ← REQ-004
|
|
133
|
+
↓
|
|
134
|
+
來源稽核 / 合規報告 ← REQ-004(對外護城河證物)
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## 與治理閘門家族的關係
|
|
138
|
+
|
|
139
|
+
| Profile | 標準 | 軸 | 登錄/檢查 | block 觸發 |
|
|
140
|
+
|---------|------|----|-----------|------------|
|
|
141
|
+
| 授權 | `license-compliance`(XSPEC-193) | legal | blocklist/allowlist/greylist | 禁用授權 |
|
|
142
|
+
| **來源** | **`model-provenance`(XSPEC-255)** | **source** | **模型來源 registry + 政策** | **被禁 / 未知來源** |
|
|
143
|
+
| 正確性 | `verification-oracle`(XSPEC-256) | correct | ground-truth registry | 未複現 / drift |
|
|
144
|
+
|
|
145
|
+
三者皆:fail-closed + 稽核證據 + 客戶覆寫上報 telemetry + 升級給人的天花板。
|
|
146
|
+
|
|
147
|
+
## 與既有標準的整合
|
|
148
|
+
|
|
149
|
+
- **`license-compliance`** — 姊妹 profile;共用 allowlist/denylist + fail-closed + 稽核 +
|
|
150
|
+
覆寫骨架(評估兩者是否為同一治理子系統)。
|
|
151
|
+
- **`verification-oracle`** — 姊妹 profile;來源稽核證據與正確性證據並列於同一稽核/報告工件。
|
|
152
|
+
- **`model-selection`** — 來源是套在 `model-selection` 成本/品質 right-sizing *之前* 的約束;
|
|
153
|
+
不可接受的來源先從候選集移除。
|
|
154
|
+
- **`security-standards`** — 資料外送顧慮(外國 API 存取)對齊資料處理/安全;本地權重區分
|
|
155
|
+
(REQ-002)是資料主權控制。
|
|
156
|
+
- **`verification-evidence`** — 來源報告是一種驗證證據(模型 + 來源 + 無被禁來源軌跡)。
|
|
157
|
+
|
|
158
|
+
## 相關規格
|
|
159
|
+
|
|
160
|
+
- XSPEC-255 — Model Provenance Policy 完整規格(本標準來源)
|
|
161
|
+
- XSPEC-193 / XSPEC-256 — 姊妹治理閘門 profile(授權 / 正確性)
|
|
162
|
+
- DEC-075 — VibeOps 領域中立定位(中立機制 / 政策歸生態)
|
|
163
|
+
- DEC-063 — 法律與合規策略(受監管 / 主權敏感客戶)
|
|
164
|
+
- DEC-064 — 客戶 IP 隔離策略(逐客戶政策範圍)
|
|
165
|
+
- DEC-066 — Telemetry 驅動產品演進(稽核/telemetry 白名單)
|
|
166
|
+
- DEC-076 — 自助北極星(來源=自助天花板)
|
|
167
|
+
- XSPEC-254 — 定位 pre-mortem(§7 #5 成本結構 / token 經濟——來源軸)
|
|
168
|
+
|
|
169
|
+
## 變更紀錄
|
|
170
|
+
|
|
171
|
+
| 版本 | 日期 | 變更 |
|
|
172
|
+
|------|------|------|
|
|
173
|
+
| v1.0.0 | 2026-06-17 | 初版——REQ-001~007:模型來源 registry、來源政策 schema、在每個模型選擇點 fail-closed 強制、稽核證據、參考政策 pack、未知來源 fail-closed、政策內容主權(XSPEC-255) |
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
source: ../../../core/model-selection.md
|
|
3
|
-
source_version: 1.0.
|
|
4
|
-
translation_version: 1.0.
|
|
5
|
-
last_synced: 2026-
|
|
3
|
+
source_version: 1.0.1
|
|
4
|
+
translation_version: 1.0.1
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
6
|
status: current
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -10,8 +10,8 @@ status: current
|
|
|
10
10
|
|
|
11
11
|
> **語言**: [English](../../../core/model-selection.md) | 繁體中文
|
|
12
12
|
|
|
13
|
-
**版本**: 1.0.
|
|
14
|
-
**最後更新**: 2026-
|
|
13
|
+
**版本**: 1.0.1
|
|
14
|
+
**最後更新**: 2026-06-10
|
|
15
15
|
**適用性**: 使用多模型分級的 AI 輔助開發
|
|
16
16
|
**範圍**: 通用 (Universal)
|
|
17
17
|
**靈感來源**: [Superpowers](https://github.com/obra/superpowers) — subagent-driven-development (MIT)
|
|
@@ -76,8 +76,31 @@ status: current
|
|
|
76
76
|
| **預篩選** | 先用低成本模型判斷是否需要升級 |
|
|
77
77
|
| **任務分解** | 將複雜任務拆分為多個簡單子任務 |
|
|
78
78
|
|
|
79
|
+
## 與下一步建議整合
|
|
80
|
+
|
|
81
|
+
[ai-response-navigation](ai-response-navigation.md) 標準(規則 R6,選用)允許每個「建議下一步」選項攜帶等級標注。本標準的複雜度信號即為判斷依據。
|
|
82
|
+
|
|
83
|
+
**與廠商無關原則**:等級名稱(Fast/Standard/Capable)是工具無關的泛稱。各平台自行將等級映射到可用模型。
|
|
84
|
+
|
|
85
|
+
| 等級 | 典型能力定位 |
|
|
86
|
+
|------|-------------|
|
|
87
|
+
| Fast | 輕量級 / 指令遵循 |
|
|
88
|
+
| Standard | 均衡推理 + 程式碼生成 |
|
|
89
|
+
| Capable | 進階推理、架構分析 |
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
79
93
|
## 相關標準
|
|
80
94
|
|
|
81
95
|
- [代理派遣與並行協調](agent-dispatch.md)
|
|
82
96
|
- [驗證證據](verification-evidence.md)
|
|
83
97
|
- [系統化除錯](systematic-debugging.md)
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 版本歷史
|
|
102
|
+
|
|
103
|
+
| 版本 | 日期 | 變更 |
|
|
104
|
+
|------|------|------|
|
|
105
|
+
| 1.0.1 | 2026-06-10 | 新增「與下一步建議整合」節(R6 交叉引用;與廠商無關原則) |
|
|
106
|
+
| 1.0.0 | 2026-03-20 | 初始版本 |
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
---
|
|
2
|
+
source: ../../../core/mutation-testing.md
|
|
3
|
+
source_version: 1.0.0
|
|
4
|
+
translation_version: 1.0.0
|
|
5
|
+
last_synced: 2026-06-10
|
|
6
|
+
source_hash: 6a5286d76274
|
|
7
|
+
status: current
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# 突變測試標準
|
|
11
|
+
|
|
12
|
+
> **Language**: [English](../../../core/mutation-testing.md) | 繁體中文
|
|
13
|
+
|
|
14
|
+
**版本**: 1.0.0
|
|
15
|
+
**最後更新**: 2026-05-04
|
|
16
|
+
**適用範圍**: 所有具備單元/整合測試的軟體專案
|
|
17
|
+
**Scope**: universal
|
|
18
|
+
**產業標準**: ISTQB Foundation Syllabus(測試有效性指標)
|
|
19
|
+
**參考資料**: "Introduction to Software Testing"(Ammann & Offutt), Stryker Mutator 文件
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## 目的
|
|
24
|
+
|
|
25
|
+
突變測試(mutation testing)藉由注入人工 bug 並檢查測試是否能偵測它們,來評估測試套件的有效性。它回答了行覆蓋率無法回答的問題:**「我的測試真的有驗證正確行為嗎?」**
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## 核心概念:Mutation Score
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Mutation Score = Killed Mutants / (Killed + Survived) × 100%
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- **Killed**:測試套件偵測到人工 bug(測試失敗)✅
|
|
36
|
+
- **Survived**:測試套件漏掉了 bug(測試仍通過)❌
|
|
37
|
+
|
|
38
|
+
一個只有 `expect(x).toBeDefined()` 的測試可以達到 100% 行覆蓋率,卻會讓許多突變存活(因為 `x` 是 `null`、`0` 或 `"wrong"` 都滿足 `.toBeDefined()`)。
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## 工具
|
|
43
|
+
|
|
44
|
+
| 語言 | 工具 | 指令 |
|
|
45
|
+
|------|------|------|
|
|
46
|
+
| TypeScript/JS | Stryker Mutator | `npx stryker run` |
|
|
47
|
+
| Python | mutmut | `mutmut run` |
|
|
48
|
+
| Java | PIT (Pitest) | `mvn pitest:mutationCoverage` |
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 閾值
|
|
53
|
+
|
|
54
|
+
| 模組類型 | 最低分數 | 強制程度 |
|
|
55
|
+
|---------|---------|---------|
|
|
56
|
+
| Auth/License/Payment/Security | 80% | 封鎖 release |
|
|
57
|
+
| 標準業務邏輯 | 70% | 警告;下次 release 前解決 |
|
|
58
|
+
| AI 生成的測試 | 50% | 必要;低於即拒絕 |
|
|
59
|
+
| 整體專案 | 60% | 追蹤趨勢;回歸時告警 |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 何時執行
|
|
64
|
+
|
|
65
|
+
| 觸發條件 | 指令 | 強制程度 |
|
|
66
|
+
|---------|------|---------|
|
|
67
|
+
| Pre-release 閘門 | `npm run test:mutation` | 整體 ≥ 60% |
|
|
68
|
+
| 關鍵模組變更 | `npx stryker run --mutate 'src/auth/**'` | ≥ 80% |
|
|
69
|
+
| AI 生成測試審查 | `npx stryker run` | ≥ 50% |
|
|
70
|
+
|
|
71
|
+
**絕不**把突變測試加入 commit hook——它太慢了(10-60 分鐘)。
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Stryker 快速上手(TypeScript + Vitest)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npm install --save-dev @stryker-mutator/core @stryker-mutator/vitest-runner
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
// stryker.config.json
|
|
83
|
+
{
|
|
84
|
+
"testRunner": "vitest",
|
|
85
|
+
"coverageAnalysis": "perTest",
|
|
86
|
+
"mutate": ["src/license/**/*.ts", "!src/**/*.test.ts"],
|
|
87
|
+
"thresholds": { "high": 80, "low": 60, "break": 50 }
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 反模式
|
|
94
|
+
|
|
95
|
+
- 把行覆蓋率當作測試有效性的替代指標
|
|
96
|
+
- 在每個 PR 的 CI 中都加入突變測試(太慢)
|
|
97
|
+
- 未經 mutation score 驗證就接受 AI 生成的測試
|
|
98
|
+
- 靠加 `toBeDefined()` 斷言來殺死突變
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## 與其他標準的關係
|
|
103
|
+
|
|
104
|
+
- `test-completeness-dimensions`:維度 8(AI 測試品質)引用 mutation score
|
|
105
|
+
- `mock-boundary`:空心測試會讓許多突變存活;mock 邊界規則防止空心測試
|
|
106
|
+
- `testing`:突變測試是測試金字塔頂端的品質閘門
|