225 lines
8.6 KiB
YAML
225 lines
8.6 KiB
YAML
apiVersion: devrunbook.io/v1alpha1
|
|
kind: Playbook
|
|
metadata:
|
|
id: code-quality.error-handling-hardening
|
|
slug: error-handling-hardening
|
|
version: 1.0.0
|
|
title: Harden Error Handling
|
|
summary: Improve error classification, propagation, user feedback and safe logging across a selected flow.
|
|
category: code-quality
|
|
tags:
|
|
- errors
|
|
- logging
|
|
- reliability
|
|
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: guided
|
|
intent:
|
|
problem: Development work around harden error handling is often underspecified, inconsistently executed or reported without
|
|
enough evidence.
|
|
outcome: Improve error classification, propagation, user feedback and safe logging across a selected flow.
|
|
whenToUse:
|
|
- Use this playbook when the repository needs a bounded harden error handling 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: targetFlow
|
|
label: Target flow
|
|
description: Describe the user or system flow whose error behavior must be hardened.
|
|
type: multiline
|
|
required: true
|
|
sensitive: false
|
|
includeInOutput: true
|
|
- key: errorPolicy
|
|
label: Error policy
|
|
description: Describe expected error taxonomy, user messaging, retry and logging behavior.
|
|
type: multiline
|
|
required: false
|
|
sensitive: false
|
|
includeInOutput: true
|
|
default: ''
|
|
compatibility:
|
|
repositoryRequired: true
|
|
languages: []
|
|
frameworks: []
|
|
packageManagers: []
|
|
databases: []
|
|
deploymentTypes: []
|
|
requiredProfileCapabilities: []
|
|
incompatibleConditions: []
|
|
guardrails:
|
|
- id: guardrail-1
|
|
severity: blocking
|
|
text: Do not hide failures with empty catch blocks, blanket retries or generic success responses.
|
|
- id: guardrail-2
|
|
severity: blocking
|
|
text: Do not log secrets, authentication material or excessive private payloads.
|
|
- id: guardrail-3
|
|
severity: blocking
|
|
text: Preserve existing public error contracts unless an explicit migration is documented.
|
|
workflow:
|
|
- id: trace-errors
|
|
title: Trace current error flow
|
|
instruction: Map error creation, propagation, translation, logging and user presentation across the target flow.
|
|
required: true
|
|
- id: define-taxonomy
|
|
title: Define error taxonomy
|
|
instruction: Align domain, validation, authorization, dependency and unexpected errors with repository conventions.
|
|
required: true
|
|
- id: implement-boundaries
|
|
title: Harden boundaries
|
|
instruction: Add precise handling, safe messages, correlation and cleanup at appropriate boundaries.
|
|
required: true
|
|
- id: retry-policy
|
|
title: Review retry behavior
|
|
instruction: Add bounded retry, timeout and idempotency only where the failure mode supports it.
|
|
required: true
|
|
- id: test-failures
|
|
title: Test failure paths
|
|
instruction: Add tests for expected failures, unavailable dependencies and unexpected exceptions.
|
|
required: true
|
|
- id: verify-observability
|
|
title: Verify observability
|
|
instruction: Confirm operators receive actionable safe evidence and users receive appropriate guidance.
|
|
required: true
|
|
- id: full-validation
|
|
title: Run validation
|
|
instruction: Run relevant lint, typecheck, tests and build and inspect the final diff.
|
|
required: true
|
|
validation:
|
|
commandRoles:
|
|
- lint
|
|
- typecheck
|
|
- unit-test
|
|
- integration-test
|
|
- build
|
|
checks:
|
|
- id: check-1
|
|
type: assertion
|
|
description: Representative failure paths are covered by tests.
|
|
blocking: true
|
|
evidence: Referenced files, command results or explicit review notes.
|
|
- id: check-2
|
|
type: assertion
|
|
description: User messages and logs are actionable without exposing sensitive values.
|
|
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-integration-test
|
|
type: command
|
|
description: Run the resolved integration-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:
|
|
- Expected failure modes have explicit behavior.
|
|
- Sensitive details are not leaked and tests cover errors.
|
|
- 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: false
|
|
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:
|
|
- error-handling-hardening.static-structure
|