@accelerationguy/accel 1.0.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/CLAUDE.md +19 -0
- package/LICENSE +33 -0
- package/README.md +275 -0
- package/bin/install.js +661 -0
- package/docs/getting-started.md +164 -0
- package/docs/module-guide.md +139 -0
- package/modules/drive/LICENSE +21 -0
- package/modules/drive/PAUL-VS-GSD.md +171 -0
- package/modules/drive/README.md +555 -0
- package/modules/drive/assets/terminal.svg +67 -0
- package/modules/drive/bin/install.js +210 -0
- package/modules/drive/integration.js +76 -0
- package/modules/drive/package.json +38 -0
- package/modules/drive/src/commands/add-phase.md +36 -0
- package/modules/drive/src/commands/apply.md +83 -0
- package/modules/drive/src/commands/assumptions.md +37 -0
- package/modules/drive/src/commands/audit.md +57 -0
- package/modules/drive/src/commands/complete-milestone.md +36 -0
- package/modules/drive/src/commands/config.md +175 -0
- package/modules/drive/src/commands/consider-issues.md +41 -0
- package/modules/drive/src/commands/discover.md +48 -0
- package/modules/drive/src/commands/discuss-milestone.md +33 -0
- package/modules/drive/src/commands/discuss.md +34 -0
- package/modules/drive/src/commands/flows.md +73 -0
- package/modules/drive/src/commands/handoff.md +201 -0
- package/modules/drive/src/commands/help.md +525 -0
- package/modules/drive/src/commands/init.md +54 -0
- package/modules/drive/src/commands/map-codebase.md +34 -0
- package/modules/drive/src/commands/milestone.md +34 -0
- package/modules/drive/src/commands/pause.md +44 -0
- package/modules/drive/src/commands/plan-fix.md +216 -0
- package/modules/drive/src/commands/plan.md +36 -0
- package/modules/drive/src/commands/progress.md +138 -0
- package/modules/drive/src/commands/register.md +29 -0
- package/modules/drive/src/commands/remove-phase.md +37 -0
- package/modules/drive/src/commands/research-phase.md +209 -0
- package/modules/drive/src/commands/research.md +47 -0
- package/modules/drive/src/commands/resume.md +49 -0
- package/modules/drive/src/commands/status.md +78 -0
- package/modules/drive/src/commands/unify.md +87 -0
- package/modules/drive/src/commands/verify.md +60 -0
- package/modules/drive/src/references/checkpoints.md +234 -0
- package/modules/drive/src/references/context-management.md +219 -0
- package/modules/drive/src/references/git-strategy.md +206 -0
- package/modules/drive/src/references/loop-phases.md +254 -0
- package/modules/drive/src/references/plan-format.md +263 -0
- package/modules/drive/src/references/quality-principles.md +152 -0
- package/modules/drive/src/references/research-quality-control.md +247 -0
- package/modules/drive/src/references/sonarqube-integration.md +244 -0
- package/modules/drive/src/references/specialized-workflow-integration.md +186 -0
- package/modules/drive/src/references/subagent-criteria.md +179 -0
- package/modules/drive/src/references/tdd.md +219 -0
- package/modules/drive/src/references/work-units.md +161 -0
- package/modules/drive/src/rules/commands.md +108 -0
- package/modules/drive/src/rules/references.md +107 -0
- package/modules/drive/src/rules/style.md +123 -0
- package/modules/drive/src/rules/templates.md +51 -0
- package/modules/drive/src/rules/workflows.md +133 -0
- package/modules/drive/src/templates/CONTEXT.md +88 -0
- package/modules/drive/src/templates/DEBUG.md +164 -0
- package/modules/drive/src/templates/DISCOVERY.md +148 -0
- package/modules/drive/src/templates/HANDOFF.md +77 -0
- package/modules/drive/src/templates/ISSUES.md +93 -0
- package/modules/drive/src/templates/MILESTONES.md +167 -0
- package/modules/drive/src/templates/PLAN.md +328 -0
- package/modules/drive/src/templates/PROJECT.md +219 -0
- package/modules/drive/src/templates/RESEARCH.md +130 -0
- package/modules/drive/src/templates/ROADMAP.md +328 -0
- package/modules/drive/src/templates/SPECIAL-FLOWS.md +70 -0
- package/modules/drive/src/templates/STATE.md +210 -0
- package/modules/drive/src/templates/SUMMARY.md +221 -0
- package/modules/drive/src/templates/UAT-ISSUES.md +139 -0
- package/modules/drive/src/templates/codebase/architecture.md +259 -0
- package/modules/drive/src/templates/codebase/concerns.md +329 -0
- package/modules/drive/src/templates/codebase/conventions.md +311 -0
- package/modules/drive/src/templates/codebase/integrations.md +284 -0
- package/modules/drive/src/templates/codebase/stack.md +190 -0
- package/modules/drive/src/templates/codebase/structure.md +287 -0
- package/modules/drive/src/templates/codebase/testing.md +484 -0
- package/modules/drive/src/templates/config.md +181 -0
- package/modules/drive/src/templates/milestone-archive.md +236 -0
- package/modules/drive/src/templates/milestone-context.md +190 -0
- package/modules/drive/src/templates/paul-json.md +147 -0
- package/modules/drive/src/vector-config/PAUL +26 -0
- package/modules/drive/src/vector-config/PAUL.manifest +11 -0
- package/modules/drive/src/workflows/apply-phase.md +393 -0
- package/modules/drive/src/workflows/audit-plan.md +344 -0
- package/modules/drive/src/workflows/complete-milestone.md +479 -0
- package/modules/drive/src/workflows/configure-special-flows.md +283 -0
- package/modules/drive/src/workflows/consider-issues.md +172 -0
- package/modules/drive/src/workflows/create-milestone.md +268 -0
- package/modules/drive/src/workflows/debug.md +292 -0
- package/modules/drive/src/workflows/discovery.md +187 -0
- package/modules/drive/src/workflows/discuss-milestone.md +245 -0
- package/modules/drive/src/workflows/discuss-phase.md +231 -0
- package/modules/drive/src/workflows/init-project.md +698 -0
- package/modules/drive/src/workflows/map-codebase.md +459 -0
- package/modules/drive/src/workflows/pause-work.md +259 -0
- package/modules/drive/src/workflows/phase-assumptions.md +181 -0
- package/modules/drive/src/workflows/plan-phase.md +385 -0
- package/modules/drive/src/workflows/quality-gate.md +263 -0
- package/modules/drive/src/workflows/register-manifest.md +107 -0
- package/modules/drive/src/workflows/research.md +241 -0
- package/modules/drive/src/workflows/resume-project.md +200 -0
- package/modules/drive/src/workflows/roadmap-management.md +334 -0
- package/modules/drive/src/workflows/transition-phase.md +368 -0
- package/modules/drive/src/workflows/unify-phase.md +290 -0
- package/modules/drive/src/workflows/verify-work.md +241 -0
- package/modules/forge/README.md +281 -0
- package/modules/forge/bin/install.js +200 -0
- package/modules/forge/package.json +32 -0
- package/modules/forge/skillsmith/rules/checklists-rules.md +42 -0
- package/modules/forge/skillsmith/rules/context-rules.md +43 -0
- package/modules/forge/skillsmith/rules/entry-point-rules.md +44 -0
- package/modules/forge/skillsmith/rules/frameworks-rules.md +43 -0
- package/modules/forge/skillsmith/rules/tasks-rules.md +52 -0
- package/modules/forge/skillsmith/rules/templates-rules.md +43 -0
- package/modules/forge/skillsmith/skillsmith.md +82 -0
- package/modules/forge/skillsmith/tasks/audit.md +277 -0
- package/modules/forge/skillsmith/tasks/discover.md +145 -0
- package/modules/forge/skillsmith/tasks/distill.md +276 -0
- package/modules/forge/skillsmith/tasks/scaffold.md +349 -0
- package/modules/forge/specs/checklists.md +193 -0
- package/modules/forge/specs/context.md +223 -0
- package/modules/forge/specs/entry-point.md +320 -0
- package/modules/forge/specs/frameworks.md +228 -0
- package/modules/forge/specs/rules.md +245 -0
- package/modules/forge/specs/tasks.md +344 -0
- package/modules/forge/specs/templates.md +335 -0
- package/modules/forge/terminal.svg +70 -0
- package/modules/ignition/README.md +245 -0
- package/modules/ignition/bin/install.js +184 -0
- package/modules/ignition/checklists/planning-quality.md +55 -0
- package/modules/ignition/data/application/config.md +21 -0
- package/modules/ignition/data/application/guide.md +51 -0
- package/modules/ignition/data/application/skill-loadout.md +11 -0
- package/modules/ignition/data/campaign/config.md +18 -0
- package/modules/ignition/data/campaign/guide.md +36 -0
- package/modules/ignition/data/campaign/skill-loadout.md +10 -0
- package/modules/ignition/data/client/config.md +18 -0
- package/modules/ignition/data/client/guide.md +36 -0
- package/modules/ignition/data/client/skill-loadout.md +11 -0
- package/modules/ignition/data/utility/config.md +18 -0
- package/modules/ignition/data/utility/guide.md +31 -0
- package/modules/ignition/data/utility/skill-loadout.md +8 -0
- package/modules/ignition/data/workflow/config.md +19 -0
- package/modules/ignition/data/workflow/guide.md +41 -0
- package/modules/ignition/data/workflow/skill-loadout.md +10 -0
- package/modules/ignition/integration.js +54 -0
- package/modules/ignition/package.json +35 -0
- package/modules/ignition/seed.md +81 -0
- package/modules/ignition/tasks/add-type.md +164 -0
- package/modules/ignition/tasks/graduate.md +182 -0
- package/modules/ignition/tasks/ideate.md +221 -0
- package/modules/ignition/tasks/launch.md +137 -0
- package/modules/ignition/tasks/status.md +71 -0
- package/modules/ignition/templates/planning-application.md +193 -0
- package/modules/ignition/templates/planning-campaign.md +138 -0
- package/modules/ignition/templates/planning-client.md +149 -0
- package/modules/ignition/templates/planning-utility.md +112 -0
- package/modules/ignition/templates/planning-workflow.md +125 -0
- package/modules/ignition/terminal.svg +74 -0
- package/modules/mission-control/CONTEXT-CONTINUITY-SPEC.md +293 -0
- package/modules/mission-control/CONTEXT-ENGINEERING-GUIDE.md +282 -0
- package/modules/mission-control/README.md +91 -0
- package/modules/mission-control/assets/terminal.svg +80 -0
- package/modules/mission-control/examples/entities.example.json +133 -0
- package/modules/mission-control/examples/projects.example.json +318 -0
- package/modules/mission-control/examples/state.example.json +183 -0
- package/modules/mission-control/examples/vector.example.json +245 -0
- package/modules/mission-control/mission-control/checklists/install-verification.md +46 -0
- package/modules/mission-control/mission-control/frameworks/framework-registry.md +83 -0
- package/modules/mission-control/mission-control/mission-control.md +83 -0
- package/modules/mission-control/mission-control/tasks/insights.md +73 -0
- package/modules/mission-control/mission-control/tasks/install.md +194 -0
- package/modules/mission-control/mission-control/tasks/status.md +125 -0
- package/modules/mission-control/schemas/entities.schema.json +89 -0
- package/modules/mission-control/schemas/projects.schema.json +221 -0
- package/modules/mission-control/schemas/state.schema.json +108 -0
- package/modules/mission-control/schemas/vector.schema.json +200 -0
- package/modules/momentum/README.md +678 -0
- package/modules/momentum/bin/install.js +563 -0
- package/modules/momentum/integration.js +131 -0
- package/modules/momentum/package.json +42 -0
- package/modules/momentum/schemas/entities.schema.json +89 -0
- package/modules/momentum/schemas/projects.schema.json +221 -0
- package/modules/momentum/schemas/state.schema.json +108 -0
- package/modules/momentum/src/commands/audit-claude-md.md +31 -0
- package/modules/momentum/src/commands/audit.md +33 -0
- package/modules/momentum/src/commands/groom.md +35 -0
- package/modules/momentum/src/commands/history.md +27 -0
- package/modules/momentum/src/commands/pulse.md +33 -0
- package/modules/momentum/src/commands/scaffold.md +33 -0
- package/modules/momentum/src/commands/status.md +28 -0
- package/modules/momentum/src/commands/surface-convert.md +35 -0
- package/modules/momentum/src/commands/surface-create.md +34 -0
- package/modules/momentum/src/commands/surface-list.md +27 -0
- package/modules/momentum/src/commands/vector-hygiene.md +33 -0
- package/modules/momentum/src/framework/context/momentum-principles.md +71 -0
- package/modules/momentum/src/framework/frameworks/audit-strategies.md +53 -0
- package/modules/momentum/src/framework/frameworks/satellite-registration.md +44 -0
- package/modules/momentum/src/framework/tasks/audit-claude-md.md +68 -0
- package/modules/momentum/src/framework/tasks/audit.md +64 -0
- package/modules/momentum/src/framework/tasks/groom.md +164 -0
- package/modules/momentum/src/framework/tasks/history.md +34 -0
- package/modules/momentum/src/framework/tasks/pulse.md +83 -0
- package/modules/momentum/src/framework/tasks/scaffold.md +202 -0
- package/modules/momentum/src/framework/tasks/status.md +35 -0
- package/modules/momentum/src/framework/tasks/surface-convert.md +143 -0
- package/modules/momentum/src/framework/tasks/surface-create.md +184 -0
- package/modules/momentum/src/framework/tasks/surface-list.md +42 -0
- package/modules/momentum/src/framework/tasks/vector-hygiene.md +160 -0
- package/modules/momentum/src/framework/templates/workspace-json.md +96 -0
- package/modules/momentum/src/hooks/_template.py +129 -0
- package/modules/momentum/src/hooks/active-hook.py +178 -0
- package/modules/momentum/src/hooks/backlog-hook.py +115 -0
- package/modules/momentum/src/hooks/mission-control-insights.py +169 -0
- package/modules/momentum/src/hooks/momentum-pulse-check.py +351 -0
- package/modules/momentum/src/hooks/operator.py +53 -0
- package/modules/momentum/src/hooks/psmm-injector.py +67 -0
- package/modules/momentum/src/hooks/satellite-detection.py +248 -0
- package/modules/momentum/src/packages/momentum-mcp/index.js +119 -0
- package/modules/momentum/src/packages/momentum-mcp/package.json +10 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/entities.js +226 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/operator.js +106 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/projects.js +322 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/psmm.js +206 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/state.js +199 -0
- package/modules/momentum/src/packages/momentum-mcp/tools/surfaces.js +404 -0
- package/modules/momentum/src/skill/momentum.md +111 -0
- package/modules/momentum/src/tasks/groom.md +164 -0
- package/modules/momentum/src/templates/operator.json +66 -0
- package/modules/momentum/src/templates/workspace.json +111 -0
- package/modules/momentum/terminal.svg +77 -0
- package/modules/radar/README.md +1552 -0
- package/modules/radar/commands/audit.md +233 -0
- package/modules/radar/commands/guardrails.md +194 -0
- package/modules/radar/commands/init.md +207 -0
- package/modules/radar/commands/playbook.md +176 -0
- package/modules/radar/commands/remediate.md +156 -0
- package/modules/radar/commands/report.md +172 -0
- package/modules/radar/commands/resume.md +176 -0
- package/modules/radar/commands/status.md +148 -0
- package/modules/radar/commands/transform.md +205 -0
- package/modules/radar/commands/validate.md +177 -0
- package/modules/radar/docs/ARCHITECTURE.md +336 -0
- package/modules/radar/docs/GETTING-STARTED.md +287 -0
- package/modules/radar/docs/standards/agents.md +197 -0
- package/modules/radar/docs/standards/commands.md +250 -0
- package/modules/radar/docs/standards/domains.md +191 -0
- package/modules/radar/docs/standards/personas.md +211 -0
- package/modules/radar/docs/standards/rules.md +218 -0
- package/modules/radar/docs/standards/runtime.md +445 -0
- package/modules/radar/docs/standards/schemas.md +269 -0
- package/modules/radar/docs/standards/tools.md +273 -0
- package/modules/radar/docs/standards/workflows.md +254 -0
- package/modules/radar/docs/terminal.svg +72 -0
- package/modules/radar/docs/validation/convention-compliance-report.md +183 -0
- package/modules/radar/docs/validation/cross-reference-report.md +195 -0
- package/modules/radar/docs/validation/validation-summary.md +118 -0
- package/modules/radar/docs/validation/version-manifest.yaml +363 -0
- package/modules/radar/install.sh +711 -0
- package/modules/radar/integration.js +53 -0
- package/modules/radar/src/core/agents/architect.md +25 -0
- package/modules/radar/src/core/agents/compliance-officer.md +25 -0
- package/modules/radar/src/core/agents/data-engineer.md +25 -0
- package/modules/radar/src/core/agents/devils-advocate.md +22 -0
- package/modules/radar/src/core/agents/performance-engineer.md +25 -0
- package/modules/radar/src/core/agents/principal-engineer.md +23 -0
- package/modules/radar/src/core/agents/reality-gap-analyst.md +22 -0
- package/modules/radar/src/core/agents/security-engineer.md +25 -0
- package/modules/radar/src/core/agents/senior-app-engineer.md +25 -0
- package/modules/radar/src/core/agents/sre.md +25 -0
- package/modules/radar/src/core/agents/staff-engineer.md +23 -0
- package/modules/radar/src/core/agents/test-engineer.md +25 -0
- package/modules/radar/src/core/personas/architect.md +111 -0
- package/modules/radar/src/core/personas/compliance-officer.md +104 -0
- package/modules/radar/src/core/personas/data-engineer.md +113 -0
- package/modules/radar/src/core/personas/devils-advocate.md +105 -0
- package/modules/radar/src/core/personas/performance-engineer.md +119 -0
- package/modules/radar/src/core/personas/principal-engineer.md +119 -0
- package/modules/radar/src/core/personas/reality-gap-analyst.md +111 -0
- package/modules/radar/src/core/personas/security-engineer.md +108 -0
- package/modules/radar/src/core/personas/senior-app-engineer.md +111 -0
- package/modules/radar/src/core/personas/sre.md +117 -0
- package/modules/radar/src/core/personas/staff-engineer.md +109 -0
- package/modules/radar/src/core/personas/test-engineer.md +109 -0
- package/modules/radar/src/core/workflows/disagreement-resolution.md +183 -0
- package/modules/radar/src/core/workflows/phase-0-context.md +148 -0
- package/modules/radar/src/core/workflows/phase-1-reconnaissance.md +169 -0
- package/modules/radar/src/core/workflows/phase-2-domain-audits.md +190 -0
- package/modules/radar/src/core/workflows/phase-3-cross-domain.md +177 -0
- package/modules/radar/src/core/workflows/phase-4-adversarial-review.md +165 -0
- package/modules/radar/src/core/workflows/phase-5-report.md +189 -0
- package/modules/radar/src/core/workflows/phase-checkpoint.md +222 -0
- package/modules/radar/src/core/workflows/session-handoff.md +152 -0
- package/modules/radar/src/domains/00-context.md +201 -0
- package/modules/radar/src/domains/01-architecture.md +248 -0
- package/modules/radar/src/domains/02-data.md +224 -0
- package/modules/radar/src/domains/03-correctness.md +230 -0
- package/modules/radar/src/domains/04-security.md +274 -0
- package/modules/radar/src/domains/05-compliance.md +228 -0
- package/modules/radar/src/domains/06-testing.md +228 -0
- package/modules/radar/src/domains/07-reliability.md +246 -0
- package/modules/radar/src/domains/08-performance.md +247 -0
- package/modules/radar/src/domains/09-maintainability.md +271 -0
- package/modules/radar/src/domains/10-operability.md +250 -0
- package/modules/radar/src/domains/11-change-risk.md +246 -0
- package/modules/radar/src/domains/12-team-risk.md +221 -0
- package/modules/radar/src/domains/13-risk-synthesis.md +202 -0
- package/modules/radar/src/rules/agent-boundaries.md +78 -0
- package/modules/radar/src/rules/disagreement-protocol.md +76 -0
- package/modules/radar/src/rules/epistemic-hygiene.md +78 -0
- package/modules/radar/src/schemas/confidence.md +185 -0
- package/modules/radar/src/schemas/disagreement.md +238 -0
- package/modules/radar/src/schemas/finding.md +287 -0
- package/modules/radar/src/schemas/report-section.md +150 -0
- package/modules/radar/src/schemas/signal.md +108 -0
- package/modules/radar/src/tools/checkov.md +463 -0
- package/modules/radar/src/tools/git-history.md +581 -0
- package/modules/radar/src/tools/gitleaks.md +447 -0
- package/modules/radar/src/tools/grype.md +611 -0
- package/modules/radar/src/tools/semgrep.md +378 -0
- package/modules/radar/src/tools/sonarqube.md +550 -0
- package/modules/radar/src/tools/syft.md +539 -0
- package/modules/radar/src/tools/trivy.md +439 -0
- package/modules/radar/src/transform/agents/change-risk-modeler.md +24 -0
- package/modules/radar/src/transform/agents/execution-validator.md +24 -0
- package/modules/radar/src/transform/agents/guardrail-generator.md +24 -0
- package/modules/radar/src/transform/agents/pedagogy-agent.md +24 -0
- package/modules/radar/src/transform/agents/remediation-architect.md +24 -0
- package/modules/radar/src/transform/personas/change-risk-modeler.md +95 -0
- package/modules/radar/src/transform/personas/execution-validator.md +95 -0
- package/modules/radar/src/transform/personas/guardrail-generator.md +103 -0
- package/modules/radar/src/transform/personas/pedagogy-agent.md +105 -0
- package/modules/radar/src/transform/personas/remediation-architect.md +95 -0
- package/modules/radar/src/transform/rules/change-risk-rules.md +87 -0
- package/modules/radar/src/transform/rules/safety-governance.md +87 -0
- package/modules/radar/src/transform/schemas/change-risk.md +139 -0
- package/modules/radar/src/transform/schemas/intervention-level.md +207 -0
- package/modules/radar/src/transform/schemas/playbook.md +205 -0
- package/modules/radar/src/transform/schemas/verification-plan.md +134 -0
- package/modules/radar/src/transform/workflows/phase-6-remediation.md +148 -0
- package/modules/radar/src/transform/workflows/phase-7-risk-validation.md +161 -0
- package/modules/radar/src/transform/workflows/phase-8-execution-planning.md +159 -0
- package/modules/radar/src/transform/workflows/transform-safety.md +158 -0
- package/modules/vector/.vector-template/sessions/.gitkeep +0 -0
- package/modules/vector/.vector-template/vector.json +72 -0
- package/modules/vector/AUDIT-CLAUDEMD.md +154 -0
- package/modules/vector/INSTALL.md +185 -0
- package/modules/vector/LICENSE +21 -0
- package/modules/vector/README.md +409 -0
- package/modules/vector/VECTOR-BLOCK.md +57 -0
- package/modules/vector/assets/terminal.svg +68 -0
- package/modules/vector/bin/install.js +455 -0
- package/modules/vector/bin/migrate-v1-to-v2.sh +492 -0
- package/modules/vector/commands/help.md +46 -0
- package/modules/vector/hooks/vector-hook.py +775 -0
- package/modules/vector/mcp/index.js +118 -0
- package/modules/vector/mcp/package.json +10 -0
- package/modules/vector/mcp/tools/decisions.js +269 -0
- package/modules/vector/mcp/tools/domains.js +361 -0
- package/modules/vector/mcp/tools/staging.js +252 -0
- package/modules/vector/mcp/tools/vector-json.js +647 -0
- package/modules/vector/package.json +38 -0
- package/modules/vector/schemas/vector.schema.json +237 -0
- package/package.json +39 -0
- package/shared/branding/branding.js +70 -0
- package/shared/config/defaults.json +59 -0
- package/shared/events/README.md +175 -0
- package/shared/events/event-bus.js +134 -0
- package/shared/events/event_bus.py +255 -0
- package/shared/events/integrations.js +161 -0
- package/shared/events/schemas/audit-complete.schema.json +21 -0
- package/shared/events/schemas/phase-progress.schema.json +23 -0
- package/shared/events/schemas/plan-created.schema.json +21 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: domain-02
|
|
3
|
+
number: "02"
|
|
4
|
+
name: Data & State Integrity
|
|
5
|
+
owner_agents: [data-engineer]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Covers data models, schema evolution, migrations, referential integrity, consistency guarantees, and state transition safety. Most catastrophic failures are data bugs, not code bugs — corrupt state, irreversible migrations, silent data loss, and inconsistent derived data can cause damage that outlasts any code fix.
|
|
11
|
+
|
|
12
|
+
Scope: schema design and evolution, migration strategy, referential integrity enforcement, state machine correctness, data validation at system boundaries, backup and recovery strategies, and data lifecycle management. Does NOT cover data security or privacy (domains 04, 05), performance of data access patterns (domain 08), or business logic correctness that happens to involve data (domain 03).
|
|
13
|
+
|
|
14
|
+
## Audit Questions
|
|
15
|
+
|
|
16
|
+
- Are data models explicitly defined (ORM models, schema files, type definitions), or is the schema implicit in code?
|
|
17
|
+
- Is there a versioned migration strategy, and are migrations reversible?
|
|
18
|
+
- Are referential integrity constraints enforced at the database level, application level, or both?
|
|
19
|
+
- Are state machines explicit with defined transitions, or are state changes scattered across the codebase?
|
|
20
|
+
- Is input data validated at system boundaries before entering the data layer?
|
|
21
|
+
- What is the backup and recovery strategy, and has it been tested?
|
|
22
|
+
- Are there orphaned records or data consistency issues that accumulate over time?
|
|
23
|
+
- How is schema evolution handled for API contracts (versioning, backward compatibility)?
|
|
24
|
+
- Is there a data lifecycle policy (retention, archival, deletion)?
|
|
25
|
+
- Are derived/computed data stores (caches, materialized views, denormalized tables) kept consistent with source data?
|
|
26
|
+
- What happens to in-flight data during deployments or schema migrations?
|
|
27
|
+
|
|
28
|
+
## Failure Patterns
|
|
29
|
+
|
|
30
|
+
### Schema Drift
|
|
31
|
+
|
|
32
|
+
- **Description:** The actual database schema has diverged from what the application code expects, causing runtime errors, data corruption, or silent data loss.
|
|
33
|
+
- **Indicators:**
|
|
34
|
+
- Migration files that don't match the current database state
|
|
35
|
+
- ORM model definitions inconsistent with actual table schemas
|
|
36
|
+
- Queries that reference columns or tables that may not exist in all environments
|
|
37
|
+
- Manual schema changes applied directly to production without migration files
|
|
38
|
+
- **Severity Tendency:** critical
|
|
39
|
+
|
|
40
|
+
### Missing Migrations
|
|
41
|
+
|
|
42
|
+
- **Description:** Schema changes are applied manually or through ad-hoc scripts rather than through a versioned, repeatable migration system.
|
|
43
|
+
- **Indicators:**
|
|
44
|
+
- No migration directory or migration tool configured
|
|
45
|
+
- SQL scripts named with dates or "fix_" prefixes applied manually
|
|
46
|
+
- Different environments have different schema states
|
|
47
|
+
- Schema changes require coordination calls or runbooks
|
|
48
|
+
- **Severity Tendency:** high
|
|
49
|
+
|
|
50
|
+
### Inconsistent State Machines
|
|
51
|
+
|
|
52
|
+
- **Description:** Entity state transitions are managed through scattered conditional logic rather than an explicit state machine, allowing invalid transitions and orphaned states.
|
|
53
|
+
- **Indicators:**
|
|
54
|
+
- Status fields with string values set in multiple locations across the codebase
|
|
55
|
+
- No validation of state transitions (e.g., "completed" directly from "draft" skipping "in_progress")
|
|
56
|
+
- Dead states — status values that exist in the database but no code path produces them
|
|
57
|
+
- Business logic that checks status with long if/else chains instead of state machine patterns
|
|
58
|
+
- **Severity Tendency:** high
|
|
59
|
+
|
|
60
|
+
### Data Validation Gaps
|
|
61
|
+
|
|
62
|
+
- **Description:** User input or external data enters the system without proper validation, allowing malformed, out-of-range, or structurally invalid data to persist in storage.
|
|
63
|
+
- **Indicators:**
|
|
64
|
+
- No validation middleware or schema validation library in the request pipeline
|
|
65
|
+
- Database columns without constraints (nullable when shouldn't be, no length limits, no check constraints)
|
|
66
|
+
- Tests that only use well-formed data — no edge case or boundary testing
|
|
67
|
+
- Error reports showing unexpected data types or formats in database records
|
|
68
|
+
- **Severity Tendency:** high
|
|
69
|
+
|
|
70
|
+
### Orphaned Records
|
|
71
|
+
|
|
72
|
+
- **Description:** Related records become disconnected due to missing cascade deletes, soft-delete inconsistencies, or partial transaction failures, leaving data that references nonexistent parents.
|
|
73
|
+
- **Indicators:**
|
|
74
|
+
- Foreign keys without ON DELETE behavior defined
|
|
75
|
+
- Soft-delete implementation that doesn't propagate to related records
|
|
76
|
+
- Cleanup scripts or cron jobs that exist to "fix" orphaned data
|
|
77
|
+
- Queries with LEFT JOINs where INNER JOINs would be semantically correct (defensive coding around orphans)
|
|
78
|
+
- **Severity Tendency:** medium
|
|
79
|
+
|
|
80
|
+
### Implicit Schema
|
|
81
|
+
|
|
82
|
+
- **Description:** The data model has no explicit definition — the schema exists only as an emergent property of the code that reads and writes data, common in NoSQL or dynamic-language systems.
|
|
83
|
+
- **Indicators:**
|
|
84
|
+
- Document databases (MongoDB, DynamoDB) used without schema validation
|
|
85
|
+
- Dynamic object properties added at various points in the codebase
|
|
86
|
+
- No TypeScript interfaces, JSON Schema, or Pydantic models for data structures
|
|
87
|
+
- Different code paths write different fields to the same collection/table
|
|
88
|
+
- **Severity Tendency:** high
|
|
89
|
+
|
|
90
|
+
### Race Conditions in State Transitions
|
|
91
|
+
|
|
92
|
+
- **Description:** Concurrent operations can cause state corruption because state reads and writes are not atomic, leading to lost updates, duplicate processing, or invalid state combinations.
|
|
93
|
+
- **Indicators:**
|
|
94
|
+
- Read-then-write patterns without locking or optimistic concurrency control
|
|
95
|
+
- No unique constraints or idempotency keys on operations that should be atomic
|
|
96
|
+
- Race condition bugs in production history (double charges, duplicate records)
|
|
97
|
+
- State updates using UPDATE without WHERE clause checking current state
|
|
98
|
+
- **Severity Tendency:** critical
|
|
99
|
+
|
|
100
|
+
## Best Practice Patterns
|
|
101
|
+
|
|
102
|
+
### Versioned Migrations
|
|
103
|
+
|
|
104
|
+
- **Replaces Failure Pattern:** Missing Migrations
|
|
105
|
+
- **Abstract Pattern:** Every schema change is captured as a versioned, ordered, idempotent migration file that can be applied forward and (where possible) rolled back. The migration history is the authoritative record of schema evolution.
|
|
106
|
+
- **Framework Mappings:**
|
|
107
|
+
- Rails: ActiveRecord migrations with `db:migrate` and `db:rollback` — timestamped, reversible, tracked in `schema_migrations` table
|
|
108
|
+
- Django: `makemigrations` + `migrate` — auto-generated from model changes, dependency-tracked
|
|
109
|
+
- Laravel: Artisan migrations with `up()` and `down()` methods, batch-tracked
|
|
110
|
+
- **Language Patterns:**
|
|
111
|
+
- Node.js: Knex migrations or Prisma Migrate with explicit up/down SQL
|
|
112
|
+
- Go: golang-migrate or Atlas with versioned SQL files and checksum verification
|
|
113
|
+
|
|
114
|
+
### Schema-Code Synchronization
|
|
115
|
+
|
|
116
|
+
- **Replaces Failure Pattern:** Schema Drift
|
|
117
|
+
- **Abstract Pattern:** The database schema and application code are kept in sync through automated checks that detect divergence. Schema validation runs in CI to ensure the code's expectations match the actual database structure.
|
|
118
|
+
- **Framework Mappings:**
|
|
119
|
+
- Prisma: `prisma db pull` + `prisma migrate diff` to detect drift between schema file and live database
|
|
120
|
+
- Django: `makemigrations --check` in CI fails if model definitions don't match the current migration state
|
|
121
|
+
- Flyway: `flyway validate` checks that applied migrations match the expected checksums and sequence
|
|
122
|
+
- **Language Patterns:**
|
|
123
|
+
- Any: CI pipeline step that compares declared schema against actual database and fails on mismatch
|
|
124
|
+
- TypeScript/Python: ORM schema introspection tools that generate drift reports as part of deployment checks
|
|
125
|
+
|
|
126
|
+
### Explicit State Machines
|
|
127
|
+
|
|
128
|
+
- **Replaces Failure Pattern:** Inconsistent State Machines
|
|
129
|
+
- **Abstract Pattern:** State transitions are modeled as a finite state machine with explicitly defined states, allowed transitions, guard conditions, and side effects. Invalid transitions are rejected, not silently ignored.
|
|
130
|
+
- **Framework Mappings:**
|
|
131
|
+
- Ruby: `aasm` gem — declarative state machine DSL with events, guards, and callbacks
|
|
132
|
+
- Python: `transitions` library — lightweight FSM with diagram generation
|
|
133
|
+
- Laravel: `spatie/laravel-model-states` — type-safe state transitions with configurable transition classes
|
|
134
|
+
- **Language Patterns:**
|
|
135
|
+
- TypeScript: Discriminated unions for states with exhaustive switch statements enforcing transition handling
|
|
136
|
+
- Java/Kotlin: Enum-based state machines with transition methods that return `Optional<NextState>`
|
|
137
|
+
|
|
138
|
+
### Input Validation at Boundaries
|
|
139
|
+
|
|
140
|
+
- **Replaces Failure Pattern:** Data Validation Gaps
|
|
141
|
+
- **Abstract Pattern:** All data entering the system is validated at the boundary — API endpoints, message consumers, file parsers — using schema validation that rejects invalid data before it reaches business logic or persistence.
|
|
142
|
+
- **Framework Mappings:**
|
|
143
|
+
- Express: `zod` or `joi` validation middleware applied at route level
|
|
144
|
+
- Spring Boot: `@Valid` annotation with Bean Validation (JSR 380) on request DTOs
|
|
145
|
+
- FastAPI: Pydantic models as request types — automatic validation and documentation
|
|
146
|
+
- **Language Patterns:**
|
|
147
|
+
- TypeScript: Zod schemas that parse (not just type-check) incoming data: `const user = UserSchema.parse(req.body)`
|
|
148
|
+
- Python: Pydantic models or `marshmallow` schemas at every external data entry point
|
|
149
|
+
|
|
150
|
+
### Referential Integrity Enforcement
|
|
151
|
+
|
|
152
|
+
- **Replaces Failure Pattern:** Orphaned Records
|
|
153
|
+
- **Abstract Pattern:** Relationships between records are enforced at the database level through foreign keys, cascade rules, and constraints — not solely through application logic. The database is the last line of defense for data consistency.
|
|
154
|
+
- **Framework Mappings:**
|
|
155
|
+
- PostgreSQL: Foreign keys with explicit ON DELETE (CASCADE, SET NULL, RESTRICT) based on domain semantics
|
|
156
|
+
- Rails: `dependent: :destroy` at the model level plus database-level foreign key constraints
|
|
157
|
+
- Django: `on_delete` parameter (CASCADE, PROTECT, SET_NULL) on ForeignKey fields
|
|
158
|
+
- **Language Patterns:**
|
|
159
|
+
- SQL: `ALTER TABLE ADD CONSTRAINT ... FOREIGN KEY ... ON DELETE CASCADE` for parent-owned children
|
|
160
|
+
- Any ORM: Configure both ORM-level and database-level constraints — belt and suspenders approach
|
|
161
|
+
|
|
162
|
+
### Schema-First Data Modeling
|
|
163
|
+
|
|
164
|
+
- **Replaces Failure Pattern:** Implicit Schema
|
|
165
|
+
- **Abstract Pattern:** Data schemas are defined explicitly and centrally before code is written against them. The schema definition is the source of truth — code is generated from or validated against the schema, not the other way around.
|
|
166
|
+
- **Framework Mappings:**
|
|
167
|
+
- Prisma: Schema file as single source of truth generating client, types, and migrations
|
|
168
|
+
- Protocol Buffers / gRPC: .proto files defining data structures with code generation for all languages
|
|
169
|
+
- JSON Schema: Central schema definition with runtime validation in document databases
|
|
170
|
+
- **Language Patterns:**
|
|
171
|
+
- TypeScript: Zod schemas that generate TypeScript types: `type User = z.infer<typeof UserSchema>`
|
|
172
|
+
- Python: Pydantic models serving as both validation and documentation for data structures
|
|
173
|
+
|
|
174
|
+
### Optimistic Concurrency Control
|
|
175
|
+
|
|
176
|
+
- **Replaces Failure Pattern:** Race Conditions in State Transitions
|
|
177
|
+
- **Abstract Pattern:** State modifications include a version check — each update verifies that the record hasn't changed since it was read. Conflicts are detected and surfaced rather than silently overwritten.
|
|
178
|
+
- **Framework Mappings:**
|
|
179
|
+
- JPA/Hibernate: `@Version` annotation on a version column — automatic optimistic locking
|
|
180
|
+
- Rails: `lock_version` column with built-in ActiveRecord optimistic locking
|
|
181
|
+
- DynamoDB: Conditional writes using `ConditionExpression` to enforce atomic state transitions
|
|
182
|
+
- **Language Patterns:**
|
|
183
|
+
- SQL: `UPDATE ... SET status = 'shipped', version = version + 1 WHERE id = ? AND version = ?` — zero affected rows means conflict
|
|
184
|
+
- Any: Idempotency keys on write operations to safely retry without duplication
|
|
185
|
+
|
|
186
|
+
## Red Flags
|
|
187
|
+
|
|
188
|
+
- No migration directory or migration tool in the project
|
|
189
|
+
- Database columns with `TEXT` type where structured data is stored (JSON as unvalidated strings)
|
|
190
|
+
- Status fields with string type and no enum constraint
|
|
191
|
+
- Multiple code locations writing to the same table with different field assumptions
|
|
192
|
+
- Manual SQL scripts in a `fixes/` or `patches/` directory
|
|
193
|
+
- Foreign keys missing between obviously related tables
|
|
194
|
+
- No `created_at` / `updated_at` timestamps on tables that track entities
|
|
195
|
+
- Soft-delete (`deleted_at`) without corresponding query scoping
|
|
196
|
+
- NoSQL collections with no schema validation configured
|
|
197
|
+
- Data transformation logic scattered across controllers, services, and background jobs
|
|
198
|
+
|
|
199
|
+
## Tool Affinities
|
|
200
|
+
|
|
201
|
+
| Tool ID | Signal Type | Relevance |
|
|
202
|
+
|---------|-------------|-----------|
|
|
203
|
+
| sonarqube | Data flow analysis, detecting potential null dereferences and unvalidated data usage | contextual |
|
|
204
|
+
| semgrep | Pattern detection for SQL injection, unparameterized queries, missing validation, raw query construction | supporting |
|
|
205
|
+
| checkov | Infrastructure-as-code database configuration — encryption, backup, access controls | supporting |
|
|
206
|
+
|
|
207
|
+
## Standards & Frameworks
|
|
208
|
+
|
|
209
|
+
- Database normalization (1NF through BCNF) — structured approach to eliminating data redundancy and anomalies
|
|
210
|
+
- ACID properties — Atomicity, Consistency, Isolation, Durability as transaction correctness guarantees
|
|
211
|
+
- CAP theorem — Consistency, Availability, Partition tolerance trade-offs for distributed data systems
|
|
212
|
+
- Event Sourcing — Storing state as an append-only sequence of events for full auditability and replay
|
|
213
|
+
- CQRS (Command Query Responsibility Segregation) — Separating read and write models for data access optimization
|
|
214
|
+
- Schema evolution patterns (Avro, Protobuf) — Forward and backward compatible schema changes
|
|
215
|
+
|
|
216
|
+
## Metrics
|
|
217
|
+
|
|
218
|
+
| Metric | What It Measures | Healthy Range |
|
|
219
|
+
|--------|-----------------|---------------|
|
|
220
|
+
| Migration count vs schema age | Ratio of migrations to system age (months) | ≥1 migration per month of active development |
|
|
221
|
+
| Orphan record percentage | Percentage of child records referencing nonexistent parents | 0% |
|
|
222
|
+
| Foreign key coverage | Percentage of relationships enforced by database-level foreign keys | >90% |
|
|
223
|
+
| Schema validation coverage | Percentage of external data entry points with schema validation | >95% |
|
|
224
|
+
| State machine explicitness | Percentage of stateful entities with formally defined state machines | >80% for entities with ≥3 states |
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: domain-03
|
|
3
|
+
number: "03"
|
|
4
|
+
name: Correctness & Logic
|
|
5
|
+
owner_agents: [senior-app-engineer]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This domain covers logic correctness, error propagation, edge case handling, concurrency safety, input validation, invariant enforcement, and idempotency. Most production incidents stem from mundane logic bugs rather than exotic failures. This domain focuses on whether the code does what it claims to do under all conditions, including edge cases, concurrent execution, and failure scenarios. Does NOT cover security vulnerabilities (domain 04), testing strategies (domain 06), or architectural patterns (domain 01).
|
|
11
|
+
|
|
12
|
+
## Audit Questions
|
|
13
|
+
|
|
14
|
+
- Are errors caught and propagated with sufficient context, or are they silently swallowed?
|
|
15
|
+
- Does the code handle edge cases like empty collections, boundary values, and null inputs?
|
|
16
|
+
- Are race conditions possible in concurrent access to shared state?
|
|
17
|
+
- Are critical assumptions documented and validated at runtime?
|
|
18
|
+
- Is input validation performed before business logic execution?
|
|
19
|
+
- Are invariants explicitly enforced at state transition boundaries?
|
|
20
|
+
- Can retry operations be safely executed multiple times without side effects?
|
|
21
|
+
- Does error handling follow a consistent pattern across the codebase?
|
|
22
|
+
- Are null/undefined values handled defensively throughout data flows?
|
|
23
|
+
- Are off-by-one errors prevented in loops, pagination, and range operations?
|
|
24
|
+
- Do concurrent operations maintain data consistency guarantees?
|
|
25
|
+
- Are temporal assumptions (ordering, timing) explicitly validated?
|
|
26
|
+
|
|
27
|
+
## Failure Patterns
|
|
28
|
+
|
|
29
|
+
### Swallowed Errors
|
|
30
|
+
- **Description:** Exceptions or error conditions are caught but not logged, propagated, or handled, causing silent failures that are difficult to diagnose in production.
|
|
31
|
+
- **Indicators:**
|
|
32
|
+
- Empty catch blocks or catch blocks with only comments
|
|
33
|
+
- Error handlers that return default values without logging
|
|
34
|
+
- Promise rejections without .catch() handlers
|
|
35
|
+
- Error objects created but never thrown or returned
|
|
36
|
+
- try-catch wrapping entire functions without discrimination
|
|
37
|
+
- **Severity Tendency:** high
|
|
38
|
+
|
|
39
|
+
### Missing Edge Case Handling
|
|
40
|
+
- **Description:** Code assumes happy-path conditions and fails on boundary values, empty inputs, or unusual but valid data states.
|
|
41
|
+
- **Indicators:**
|
|
42
|
+
- No validation for empty arrays before accessing elements
|
|
43
|
+
- Division operations without zero checks
|
|
44
|
+
- String operations without length validation
|
|
45
|
+
- Loops that assume non-empty collections
|
|
46
|
+
- Missing null/undefined checks before property access
|
|
47
|
+
- Pagination logic that fails on single-page results
|
|
48
|
+
- **Severity Tendency:** medium
|
|
49
|
+
|
|
50
|
+
### Race Conditions
|
|
51
|
+
- **Description:** Concurrent operations on shared state produce inconsistent results due to timing-dependent execution order.
|
|
52
|
+
- **Indicators:**
|
|
53
|
+
- Check-then-act patterns without synchronization
|
|
54
|
+
- Shared mutable state accessed from multiple threads/async contexts
|
|
55
|
+
- Database reads followed by writes without transactions
|
|
56
|
+
- Cache invalidation logic that races with updates
|
|
57
|
+
- Counter increments without atomic operations
|
|
58
|
+
- File operations without locking mechanisms
|
|
59
|
+
- **Severity Tendency:** critical
|
|
60
|
+
|
|
61
|
+
### Implicit Assumptions
|
|
62
|
+
- **Description:** Code relies on undocumented assumptions about data shape, execution environment, or temporal conditions that may not hold.
|
|
63
|
+
- **Indicators:**
|
|
64
|
+
- Missing assertions for preconditions
|
|
65
|
+
- Array access without bounds checking
|
|
66
|
+
- Type coercion without validation
|
|
67
|
+
- Assumptions about API response structure without schema validation
|
|
68
|
+
- Hard-coded constants derived from production data
|
|
69
|
+
- Dependencies on execution order without enforcement
|
|
70
|
+
- **Severity Tendency:** high
|
|
71
|
+
|
|
72
|
+
### Missing Input Validation
|
|
73
|
+
- **Description:** External inputs are processed without validation, allowing invalid data to corrupt business logic or system state.
|
|
74
|
+
- **Indicators:**
|
|
75
|
+
- API handlers that directly use request parameters
|
|
76
|
+
- Database queries constructed from unvalidated input
|
|
77
|
+
- File paths constructed from user input without sanitization
|
|
78
|
+
- Numeric inputs used in calculations without range checks
|
|
79
|
+
- Enum values not validated against allowed set
|
|
80
|
+
- Date/time inputs without format validation
|
|
81
|
+
- **Severity Tendency:** high
|
|
82
|
+
|
|
83
|
+
### Non-Idempotent Retries
|
|
84
|
+
- **Description:** Retry logic can produce duplicate side effects because operations are not designed to be safely re-executed.
|
|
85
|
+
- **Indicators:**
|
|
86
|
+
- Operations that create resources without uniqueness checks
|
|
87
|
+
- Retry logic that increments counters multiple times
|
|
88
|
+
- Payment processing without idempotency keys
|
|
89
|
+
- Email sending in retry paths without deduplication
|
|
90
|
+
- Database inserts in retry handlers without conflict resolution
|
|
91
|
+
- Event publishing without delivery guarantees
|
|
92
|
+
- **Severity Tendency:** critical
|
|
93
|
+
|
|
94
|
+
### Inconsistent Error Propagation
|
|
95
|
+
- **Description:** Error handling patterns vary across the codebase, making it difficult to predict failure behavior and implement reliable error recovery.
|
|
96
|
+
- **Indicators:**
|
|
97
|
+
- Mix of error codes, exceptions, and sentinel values
|
|
98
|
+
- Some functions return errors, others throw exceptions
|
|
99
|
+
- Inconsistent use of Result/Either types
|
|
100
|
+
- Error messages lack context or stack traces
|
|
101
|
+
- Different error formats from different modules
|
|
102
|
+
- No standardized error hierarchy or taxonomy
|
|
103
|
+
- **Severity Tendency:** medium
|
|
104
|
+
|
|
105
|
+
## Best Practice Patterns
|
|
106
|
+
|
|
107
|
+
### Explicit Error Propagation
|
|
108
|
+
- **Replaces Failure Pattern:** Swallowed Errors
|
|
109
|
+
- **Abstract Pattern:** Every error should be logged with context and either handled locally with recovery logic or propagated to a caller capable of making handling decisions. Error handling should be explicit and traceable.
|
|
110
|
+
- **Framework Mappings:**
|
|
111
|
+
- Express.js: Centralized error middleware with `next(error)` propagation
|
|
112
|
+
- Spring Boot: `@ControllerAdvice` with exception hierarchies
|
|
113
|
+
- FastAPI: Exception handlers with status code mapping
|
|
114
|
+
- **Language Patterns:**
|
|
115
|
+
- Go: Explicit error returns with `if err != nil` checks and `fmt.Errorf` wrapping
|
|
116
|
+
- Rust: Result<T, E> types with `?` operator for propagation
|
|
117
|
+
- TypeScript: Either/Result types or explicit Promise rejection handling
|
|
118
|
+
|
|
119
|
+
### Defensive Edge Case Guards
|
|
120
|
+
- **Replaces Failure Pattern:** Missing Edge Case Handling
|
|
121
|
+
- **Abstract Pattern:** Validate boundary conditions, empty states, and null cases before executing business logic. Use guard clauses to fail fast with clear error messages.
|
|
122
|
+
- **Framework Mappings:**
|
|
123
|
+
- Django: Model field validators with `clean()` methods
|
|
124
|
+
- Rails: ActiveModel validations with custom validators
|
|
125
|
+
- NestJS: ValidationPipe with class-validator decorators
|
|
126
|
+
- **Language Patterns:**
|
|
127
|
+
- Python: Guard clauses with early returns and `assert` for invariants
|
|
128
|
+
- Java: Optional<T> for nullable values with `orElseThrow()`
|
|
129
|
+
- JavaScript: Nullish coalescing and optional chaining with validation
|
|
130
|
+
|
|
131
|
+
### Synchronized State Access
|
|
132
|
+
- **Replaces Failure Pattern:** Race Conditions
|
|
133
|
+
- **Abstract Pattern:** Use locks, atomic operations, or immutable data structures to ensure state consistency under concurrent access. Prefer isolation mechanisms provided by databases or message queues.
|
|
134
|
+
- **Framework Mappings:**
|
|
135
|
+
- PostgreSQL: Serializable transactions with SELECT FOR UPDATE
|
|
136
|
+
- Redis: MULTI/EXEC transactions or Lua scripts for atomicity
|
|
137
|
+
- MongoDB: Document-level atomic operations with transactions
|
|
138
|
+
- **Language Patterns:**
|
|
139
|
+
- Java: `synchronized` blocks or `java.util.concurrent` locks
|
|
140
|
+
- Go: Mutexes (`sync.Mutex`) or channels for coordination
|
|
141
|
+
- Rust: Arc<Mutex<T>> or lock-free atomic types
|
|
142
|
+
|
|
143
|
+
### Documented Preconditions
|
|
144
|
+
- **Replaces Failure Pattern:** Implicit Assumptions
|
|
145
|
+
- **Abstract Pattern:** Document assumptions as executable assertions or type constraints. Validate preconditions at function boundaries and invariants at state transitions.
|
|
146
|
+
- **Framework Mappings:**
|
|
147
|
+
- DbC libraries: Contract-based programming with precondition/postcondition decorators
|
|
148
|
+
- GraphQL: Schema validation enforcing structure assumptions
|
|
149
|
+
- OpenAPI: Request/response schemas with strict validation
|
|
150
|
+
- **Language Patterns:**
|
|
151
|
+
- TypeScript: Branded types and discriminated unions for compile-time guarantees
|
|
152
|
+
- Python: Type hints with runtime validation via Pydantic
|
|
153
|
+
- C++: Concepts and static assertions for template constraints
|
|
154
|
+
|
|
155
|
+
### Validated Input Boundaries
|
|
156
|
+
- **Replaces Failure Pattern:** Missing Input Validation
|
|
157
|
+
- **Abstract Pattern:** Validate all external inputs at system boundaries using schema validation or type systems before allowing data to flow into business logic.
|
|
158
|
+
- **Framework Mappings:**
|
|
159
|
+
- Zod/Yup: Schema validation for JavaScript/TypeScript APIs
|
|
160
|
+
- JSON Schema: Standardized validation across languages
|
|
161
|
+
- Bean Validation: JSR-380 annotations for Java
|
|
162
|
+
- **Language Patterns:**
|
|
163
|
+
- Rust: Type system ensures validation at compile time with newtype patterns
|
|
164
|
+
- Elixir: Ecto changesets for data validation and casting
|
|
165
|
+
- Scala: Refined types for compile-time constraint enforcement
|
|
166
|
+
|
|
167
|
+
### Idempotent Operations
|
|
168
|
+
- **Replaces Failure Pattern:** Non-Idempotent Retries
|
|
169
|
+
- **Abstract Pattern:** Design operations to produce the same outcome regardless of how many times they are executed. Use idempotency keys, conditional writes, or natural idempotence.
|
|
170
|
+
- **Framework Mappings:**
|
|
171
|
+
- Stripe API: Idempotency-Key headers for payment operations
|
|
172
|
+
- AWS S3: ETags for conditional writes
|
|
173
|
+
- HTTP: PUT and DELETE methods with idempotent semantics
|
|
174
|
+
- **Language Patterns:**
|
|
175
|
+
- SQL: INSERT ... ON CONFLICT DO NOTHING for safe retries
|
|
176
|
+
- REST: Idempotency middleware checking request fingerprints
|
|
177
|
+
- Event Sourcing: Append-only logs with deduplication on read
|
|
178
|
+
|
|
179
|
+
### Standardized Error Handling
|
|
180
|
+
- **Replaces Failure Pattern:** Inconsistent Error Propagation
|
|
181
|
+
- **Abstract Pattern:** Establish a single error handling strategy across the codebase with consistent error types, context propagation, and recovery patterns.
|
|
182
|
+
- **Framework Mappings:**
|
|
183
|
+
- gRPC: Status codes with structured error details
|
|
184
|
+
- Problem Details (RFC 7807): Standardized HTTP error responses
|
|
185
|
+
- GraphQL: Errors array with extensions for context
|
|
186
|
+
- **Language Patterns:**
|
|
187
|
+
- Go: Error wrapping with `fmt.Errorf("%w", err)` and `errors.Is()`
|
|
188
|
+
- Java: Exception hierarchies with checked/unchecked distinction
|
|
189
|
+
- Kotlin: Sealed classes for exhaustive error handling
|
|
190
|
+
|
|
191
|
+
## Red Flags
|
|
192
|
+
|
|
193
|
+
- Empty catch blocks or generic exception handlers without logging
|
|
194
|
+
- Array/list access with hardcoded indices like `items[0]`
|
|
195
|
+
- Division operations without denominator checks
|
|
196
|
+
- Check-then-act patterns: `if (exists) { use() }`
|
|
197
|
+
- Missing null checks before method calls or property access
|
|
198
|
+
- Retry logic that doesn't use idempotency keys or uniqueness constraints
|
|
199
|
+
- Error handling that varies between similar functions
|
|
200
|
+
- String parsing without format validation
|
|
201
|
+
- Numeric operations without overflow protection
|
|
202
|
+
- Assumptions about API response structure without validation
|
|
203
|
+
- Concurrent access to shared state without synchronization primitives
|
|
204
|
+
- Database operations outside transactions when consistency matters
|
|
205
|
+
|
|
206
|
+
## Tool Affinities
|
|
207
|
+
|
|
208
|
+
| Tool ID | Signal Type | Relevance |
|
|
209
|
+
|---------|-------------|-----------|
|
|
210
|
+
| SonarQube | Null pointer risks, complexity metrics, error handling gaps | primary |
|
|
211
|
+
| Semgrep | Logic patterns, validation missing, concurrency issues | primary |
|
|
212
|
+
| git-history | Logic change patterns, bug fix frequency in modules | contextual |
|
|
213
|
+
|
|
214
|
+
## Standards & Frameworks
|
|
215
|
+
|
|
216
|
+
- Defensive Programming Principles: Validate inputs, handle errors explicitly, fail fast
|
|
217
|
+
- Design by Contract (DbC): Preconditions, postconditions, invariants as first-class concerns
|
|
218
|
+
- CWE-703 (Improper Check or Handling of Exceptional Conditions): Industry classification of error handling failures
|
|
219
|
+
- ACID Properties: Atomicity, Consistency, Isolation, Durability for data correctness
|
|
220
|
+
- CAP Theorem Awareness: Understanding consistency trade-offs in distributed systems
|
|
221
|
+
|
|
222
|
+
## Metrics
|
|
223
|
+
|
|
224
|
+
| Metric | What It Measures | Healthy Range |
|
|
225
|
+
|--------|-----------------|---------------|
|
|
226
|
+
| Bug Density (bugs per KLOC) | Logic defects found in production or testing per thousand lines | <0.5 for mature code, <2.0 for new features |
|
|
227
|
+
| Error Handling Coverage | Percentage of functions with explicit error handling paths | >90% |
|
|
228
|
+
| Cyclomatic Complexity (Hot Paths) | Decision point density in critical business logic | <10 per function in performance-critical or high-risk paths |
|
|
229
|
+
| Null Safety Violations | Potential null pointer dereferences detected by static analysis | 0 in critical paths, <5 per 10K LOC overall |
|
|
230
|
+
| Race Condition Density | Concurrent access issues per 1K LOC of concurrent code | <0.1 |
|