219 lines
8.3 KiB
YAML
219 lines
8.3 KiB
YAML
apiVersion: devrunbook.io/v1alpha1
|
|
kind: Playbook
|
|
metadata:
|
|
id: testing.unit-test-foundation
|
|
slug: unit-test-foundation
|
|
version: 1.0.0
|
|
title: Establish Unit Test Foundation
|
|
summary: Introduce a maintainable unit-test baseline around core domain behavior without over-mocking implementation details.
|
|
category: testing
|
|
tags:
|
|
- testing
|
|
- unit-tests
|
|
- foundation
|
|
lifecycle: reviewed
|
|
riskTier: moderate
|
|
authors:
|
|
- name: DevRunbook Core Team
|
|
license: MIT
|
|
package:
|
|
files:
|
|
- path: prompt.md
|
|
role: template
|
|
digest: true
|
|
exportByDefault: false
|
|
- path: README.md
|
|
role: documentation
|
|
digest: true
|
|
exportByDefault: false
|
|
- path: CHANGELOG.md
|
|
role: changelog
|
|
digest: true
|
|
exportByDefault: false
|
|
- path: examples/minimal.yaml
|
|
role: example
|
|
digest: true
|
|
exportByDefault: false
|
|
- path: evaluations/static-structure.yaml
|
|
role: evaluation
|
|
digest: true
|
|
exportByDefault: false
|
|
spec:
|
|
type: run-pack
|
|
intent:
|
|
problem: Development work around establish unit test foundation is often underspecified, inconsistently executed or reported
|
|
without enough evidence.
|
|
outcome: Introduce a maintainable unit-test baseline around core domain behavior without over-mocking implementation details.
|
|
whenToUse:
|
|
- Use this playbook when the repository needs a bounded establish unit test foundation task with explicit evidence and
|
|
completion criteria.
|
|
- Use it when Codex should follow a repeatable workflow rather than improvise from a one-line request.
|
|
whenNotToUse:
|
|
- Do not use it when the desired outcome or authority boundaries are still materially undecided.
|
|
- Do not use it to access unavailable production credentials, bypass safeguards or claim validation that cannot be performed.
|
|
modes:
|
|
- guided
|
|
- execute
|
|
- recovery
|
|
defaultMode: execute
|
|
autonomy:
|
|
min: implement
|
|
max: repair
|
|
default: verify
|
|
inputs:
|
|
- key: criticalModules
|
|
label: Critical modules
|
|
description: List the modules or behavior that need the first unit-test coverage.
|
|
type: string-list
|
|
required: true
|
|
sensitive: false
|
|
includeInOutput: true
|
|
- key: testFrameworkPreference
|
|
label: Test framework preference
|
|
description: State an existing or preferred test framework, or leave blank to follow repository conventions.
|
|
type: string
|
|
required: false
|
|
sensitive: false
|
|
includeInOutput: true
|
|
default: ''
|
|
compatibility:
|
|
repositoryRequired: true
|
|
languages: []
|
|
frameworks: []
|
|
packageManagers: []
|
|
databases: []
|
|
deploymentTypes: []
|
|
requiredProfileCapabilities: []
|
|
incompatibleConditions: []
|
|
guardrails:
|
|
- id: guardrail-1
|
|
severity: blocking
|
|
text: Follow existing architecture and avoid introducing a competing test framework without justification.
|
|
- id: guardrail-2
|
|
severity: blocking
|
|
text: Do not test private implementation details when observable behavior provides a stable contract.
|
|
- id: guardrail-3
|
|
severity: blocking
|
|
text: Do not add broad mocks that make tests pass while bypassing meaningful behavior.
|
|
workflow:
|
|
- id: inventory-testability
|
|
title: Inventory testability
|
|
instruction: Inspect current test tooling, module boundaries, side effects and critical untested behavior.
|
|
required: true
|
|
- id: select-framework
|
|
title: Select framework
|
|
instruction: Use the existing framework or justify the smallest compatible addition.
|
|
required: true
|
|
- id: configure
|
|
title: Configure foundation
|
|
instruction: Add deterministic configuration, scripts, fixtures and test environment isolation.
|
|
required: true
|
|
- id: add-critical-tests
|
|
title: Add critical tests
|
|
instruction: Cover the selected modules with behavior-focused tests and representative edge cases.
|
|
required: true
|
|
- id: improve-boundaries
|
|
title: Improve test seams
|
|
instruction: Make minimal architecture changes only where necessary to isolate external effects.
|
|
required: true
|
|
- id: document
|
|
title: Document usage
|
|
instruction: Document commands, conventions and how to add new tests.
|
|
required: true
|
|
- id: verify
|
|
title: Verify suite
|
|
instruction: Run tests repeatedly plus relevant lint, typecheck and build checks.
|
|
required: true
|
|
validation:
|
|
commandRoles:
|
|
- lint
|
|
- typecheck
|
|
- unit-test
|
|
- build
|
|
checks:
|
|
- id: check-1
|
|
type: assertion
|
|
description: The test command is reproducible from a fresh checkout.
|
|
blocking: true
|
|
evidence: Referenced files, command results or explicit review notes.
|
|
- id: check-2
|
|
type: assertion
|
|
description: Critical selected modules have meaningful behavior coverage and stable fixtures.
|
|
blocking: true
|
|
evidence: Referenced files, command results or explicit review notes.
|
|
- id: command-lint
|
|
type: command
|
|
description: Run the resolved lint command when the repository profile provides it and record the result.
|
|
blocking: true
|
|
evidence: Resolved command, exit status and concise result summary.
|
|
- id: command-typecheck
|
|
type: command
|
|
description: Run the resolved typecheck command when the repository profile provides it and record the result.
|
|
blocking: true
|
|
evidence: Resolved command, exit status and concise result summary.
|
|
- id: command-unit-test
|
|
type: command
|
|
description: Run the resolved unit-test command when the repository profile provides it and record the result.
|
|
blocking: true
|
|
evidence: Resolved command, exit status and concise result summary.
|
|
- id: command-build
|
|
type: command
|
|
description: Run the resolved build command when the repository profile provides it and record the result.
|
|
blocking: true
|
|
evidence: Resolved command, exit status and concise result summary.
|
|
completion:
|
|
criteria:
|
|
- Critical behavior has deterministic tests.
|
|
- Test command is documented and integrated into validation.
|
|
- Validation evidence and unresolved limitations are reported honestly.
|
|
failurePolicy:
|
|
onValidationFailure: Investigate failures caused by the current work, repair them when they remain within scope, rerun
|
|
affected validation and report any genuine blocker without claiming success.
|
|
onAmbiguity: Use repository evidence and existing conventions for minor reversible choices. Preserve current behavior
|
|
and stop before any material irreversible decision that the specification does not resolve.
|
|
onMissingContext: Inspect the repository for missing non-sensitive context. Never invent commands, credentials, production
|
|
behavior or validation results; report what remains unavailable.
|
|
onOutOfScopeCause: Explain the evidenced out-of-scope cause, avoid unrelated changes and provide the smallest safe follow-up
|
|
recommendation.
|
|
onExternalDependencyUnavailable: Use an approved local substitute or fixture only when it preserves the behavior under
|
|
test. Otherwise record the blocked validation and do not claim the external path succeeded.
|
|
onUnableToReproduce: Record attempted reproduction, environment and observed evidence. Do not apply speculative production
|
|
changes; provide the narrowest next diagnostic action.
|
|
reporting:
|
|
sections:
|
|
- id: outcome
|
|
title: Outcome
|
|
required: true
|
|
description: State the delivered result or audit conclusion without overstating evidence.
|
|
- id: evidence
|
|
title: Evidence and scope
|
|
required: true
|
|
description: List inspected or changed areas and the evidence supporting the result.
|
|
- id: validation
|
|
title: Validation
|
|
required: true
|
|
description: Report commands, manual checks and their actual outcomes.
|
|
- id: risks
|
|
title: Risks and limitations
|
|
required: true
|
|
description: State residual risk, inaccessible evidence and untested conditions.
|
|
- id: follow-up
|
|
title: Recommended follow-up
|
|
required: true
|
|
description: List the smallest useful next actions or state None.
|
|
template:
|
|
main: prompt.md
|
|
partials: []
|
|
exports:
|
|
prompt: true
|
|
markdown: true
|
|
runPack: true
|
|
agentsSuggestion: false
|
|
quality:
|
|
reviewStatus: editorial-reviewed
|
|
testedStacks: []
|
|
knownLimitations:
|
|
- Repository-specific effectiveness depends on the accuracy of the selected profile and the evidence available to Codex.
|
|
evaluationCaseIds:
|
|
- unit-test-foundation.static-structure
|