mirror of
https://github.com/norandom/OpenUltraSAST.git
synced 2026-10-21 14:09:27 +00:00
chore: add kiro spec-driven tooling and steering docs
Add the Kiro-style agentic SDLC tooling used to drive this project: the .opencode/skills/kiro-* skill set (discovery, spec init/requirements/design/ tasks, validation, implementation, review, steering), the .kiro/settings templates, and AGENTS.md describing the workflow. Update the spec docs (assessment/design/requirements/tasks) to current state. Scope tests/test_opencode_skills.py to the project's own openultrasast-* skills so the third-party kiro-* tooling (which uses a different frontmatter convention) no longer breaks the frontmatter check. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8fe8911020
commit
6699f1f8f9
@@ -0,0 +1,59 @@
|
||||
# Error Handling Standards
|
||||
|
||||
[Purpose: unify how errors are classified, shaped, propagated, logged, and monitored]
|
||||
|
||||
## Philosophy
|
||||
- Fail fast where possible; degrade gracefully at system boundaries
|
||||
- Consistent error shape across the stack (human + machine readable)
|
||||
- Handle known errors close to source; surface unknowns to a global handler
|
||||
|
||||
## Classification (decide handling by source)
|
||||
- Client: Input/validation/user action issues → 4xx
|
||||
- Server: System failures/unexpected exceptions → 5xx
|
||||
- Business: Rule/state violations → 4xx (e.g., 409)
|
||||
- External: 3rd-party/network failures → map to 5xx or 4xx with context
|
||||
|
||||
## Error Shape (single canonical format)
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "ERROR_CODE",
|
||||
"message": "Human-readable message",
|
||||
"requestId": "trace-id",
|
||||
"timestamp": "ISO-8601"
|
||||
}
|
||||
}
|
||||
```
|
||||
Principles: stable code enums, no secrets, include trace info.
|
||||
|
||||
## Propagation (where to convert)
|
||||
- API layer: Convert domain errors → HTTP status + canonical body
|
||||
- Service layer: Throw typed business errors, avoid stringly-typed errors
|
||||
- Data/external layer: Wrap provider errors with safe, actionable codes
|
||||
- Unknown errors: Bubble to global handler → 500 + generic message
|
||||
|
||||
Example pattern:
|
||||
```typescript
|
||||
try { return await useCase(); }
|
||||
catch (e) {
|
||||
if (e instanceof BusinessError) return respondMapped(e);
|
||||
logError(e); return respondInternal();
|
||||
}
|
||||
```
|
||||
|
||||
## Logging (context over noise)
|
||||
Log: operation, userId (if available), code, message, stack, requestId, minimal context.
|
||||
Do not log: passwords, tokens, secrets, full PII, full bodies with sensitive data.
|
||||
Levels: ERROR (failures), WARN (recoverable/edge), INFO (key events), DEBUG (diagnostics).
|
||||
|
||||
## Retry (only when safe)
|
||||
Retry when: network/timeouts/transient 5xx AND operation is idempotent.
|
||||
Do not retry: 4xx, business errors, non-idempotent flows.
|
||||
Strategy: exponential backoff + jitter, capped attempts; require idempotency keys.
|
||||
|
||||
## Monitoring & Health
|
||||
Track: error rates by code/category, latency, saturation; alert on spikes/SLI breaches.
|
||||
Expose health: `/health` (live), `/health/ready` (ready). Link errors to traces.
|
||||
|
||||
---
|
||||
_Focus on patterns and decisions. No implementation details or exhaustive lists._
|
||||
Reference in New Issue
Block a user