@decocms/start 0.19.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/.cursor/skills/deco-api-call-dedup/SKILL.md +443 -0
- package/.cursor/skills/deco-apps-architecture/SKILL.md +255 -0
- package/.cursor/skills/deco-apps-architecture/app-pattern.md +288 -0
- package/.cursor/skills/deco-apps-architecture/commerce-types.md +239 -0
- package/.cursor/skills/deco-apps-architecture/new-app-guide.md +268 -0
- package/.cursor/skills/deco-apps-architecture/scripts-codegen.md +148 -0
- package/.cursor/skills/deco-apps-architecture/shared-utils.md +181 -0
- package/.cursor/skills/deco-apps-architecture/vtex-deep-structure.md +253 -0
- package/.cursor/skills/deco-apps-architecture/website-app.md +169 -0
- package/.cursor/skills/deco-apps-vtex-porting/SKILL.md +189 -0
- package/.cursor/skills/deco-apps-vtex-porting/adaptation-patterns.md +335 -0
- package/.cursor/skills/deco-apps-vtex-porting/commerce-porting.md +155 -0
- package/.cursor/skills/deco-apps-vtex-porting/cookie-auth-patterns.md +148 -0
- package/.cursor/skills/deco-apps-vtex-porting/structure-map.md +234 -0
- package/.cursor/skills/deco-apps-vtex-porting/transform-mapping.md +99 -0
- package/.cursor/skills/deco-apps-vtex-porting/website-porting.md +194 -0
- package/.cursor/skills/deco-apps-vtex-review/SKILL.md +234 -0
- package/.cursor/skills/deco-async-rendering-architecture/SKILL.md +270 -0
- package/.cursor/skills/deco-async-rendering-site-guide/SKILL.md +417 -0
- package/.cursor/skills/deco-cms-layout-caching/SKILL.md +293 -0
- package/.cursor/skills/deco-cms-route-config/SKILL.md +388 -0
- package/.cursor/skills/deco-core-architecture/SKILL.md +185 -0
- package/.cursor/skills/deco-core-architecture/blocks.md +196 -0
- package/.cursor/skills/deco-core-architecture/deco-vs-deco-start.md +191 -0
- package/.cursor/skills/deco-core-architecture/engine.md +220 -0
- package/.cursor/skills/deco-core-architecture/hooks-components.md +157 -0
- package/.cursor/skills/deco-core-architecture/plugins-clients.md +136 -0
- package/.cursor/skills/deco-core-architecture/runtime.md +116 -0
- package/.cursor/skills/deco-core-architecture/site-usage.md +165 -0
- package/.cursor/skills/deco-e2e-testing/SKILL.md +372 -0
- package/.cursor/skills/deco-e2e-testing/discovery.md +337 -0
- package/.cursor/skills/deco-e2e-testing/scripts/scaffold.sh +81 -0
- package/.cursor/skills/deco-e2e-testing/selectors.md +175 -0
- package/.cursor/skills/deco-e2e-testing/templates/package.json +18 -0
- package/.cursor/skills/deco-e2e-testing/templates/playwright.config.ts +65 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/baseline.ts +279 -0
- package/.cursor/skills/deco-e2e-testing/templates/scripts/run-e2e.ts +194 -0
- package/.cursor/skills/deco-e2e-testing/templates/specs/ecommerce-flow.spec.ts +612 -0
- package/.cursor/skills/deco-e2e-testing/templates/tsconfig.json +12 -0
- package/.cursor/skills/deco-e2e-testing/templates/utils/metrics-collector.ts +918 -0
- package/.cursor/skills/deco-e2e-testing/troubleshooting.md +602 -0
- package/.cursor/skills/deco-edge-caching/SKILL.md +316 -0
- package/.cursor/skills/deco-full-analysis/SKILL.md +898 -0
- package/.cursor/skills/deco-full-analysis/checklists/asset-optimization.md +251 -0
- package/.cursor/skills/deco-full-analysis/checklists/bug-fix.md +189 -0
- package/.cursor/skills/deco-full-analysis/checklists/cache-strategy.md +144 -0
- package/.cursor/skills/deco-full-analysis/checklists/dependency-update.md +150 -0
- package/.cursor/skills/deco-full-analysis/checklists/hydration-fix.md +191 -0
- package/.cursor/skills/deco-full-analysis/checklists/image-optimization.md +180 -0
- package/.cursor/skills/deco-full-analysis/checklists/loader-optimization.md +165 -0
- package/.cursor/skills/deco-full-analysis/checklists/seo-fix.md +183 -0
- package/.cursor/skills/deco-full-analysis/checklists/site-cleanup.md +281 -0
- package/.cursor/skills/deco-full-analysis/discovery.md +548 -0
- package/.cursor/skills/deco-incident-debugging/SKILL.md +378 -0
- package/.cursor/skills/deco-incident-debugging/headless-mode.md +510 -0
- package/.cursor/skills/deco-incident-debugging/learnings-index.md +227 -0
- package/.cursor/skills/deco-incident-debugging/triage-workflow.md +312 -0
- package/.cursor/skills/deco-islands-migration/SKILL.md +251 -0
- package/.cursor/skills/deco-loader-n-plus-1-detector/SKILL.md +275 -0
- package/.cursor/skills/deco-performance-audit/SKILL.md +530 -0
- package/.cursor/skills/deco-performance-audit/tools-reference.md +428 -0
- package/.cursor/skills/deco-performance-audit/workflow.md +457 -0
- package/.cursor/skills/deco-server-functions-invoke/SKILL.md +92 -0
- package/.cursor/skills/deco-server-functions-invoke/architecture.md +166 -0
- package/.cursor/skills/deco-server-functions-invoke/generator.md +122 -0
- package/.cursor/skills/deco-server-functions-invoke/problem.md +98 -0
- package/.cursor/skills/deco-server-functions-invoke/troubleshooting.md +110 -0
- package/.cursor/skills/deco-site-deployment/SKILL.md +396 -0
- package/.cursor/skills/deco-site-memory-debugging/SKILL.md +121 -0
- package/.cursor/skills/deco-site-memory-debugging/cdp-connection.md +222 -0
- package/.cursor/skills/deco-site-memory-debugging/memory-analysis.md +362 -0
- package/.cursor/skills/deco-site-patterns/SKILL.md +124 -0
- package/.cursor/skills/deco-site-patterns/app-composition.md +337 -0
- package/.cursor/skills/deco-site-patterns/client-patterns.md +341 -0
- package/.cursor/skills/deco-site-patterns/cms-wiring.md +230 -0
- package/.cursor/skills/deco-site-patterns/section-patterns.md +340 -0
- package/.cursor/skills/deco-site-scaling-tuning/SKILL.md +240 -0
- package/.cursor/skills/deco-site-scaling-tuning/analysis-scripts.md +267 -0
- package/.cursor/skills/deco-start-architecture/SKILL.md +218 -0
- package/.cursor/skills/deco-start-architecture/admin-protocol.md +156 -0
- package/.cursor/skills/deco-start-architecture/cms-resolution.md +201 -0
- package/.cursor/skills/deco-start-architecture/code-quality.md +158 -0
- package/.cursor/skills/deco-start-architecture/gap-analysis.md +129 -0
- package/.cursor/skills/deco-start-architecture/sdk-utilities.md +197 -0
- package/.cursor/skills/deco-start-architecture/worker-entry-caching.md +154 -0
- package/.cursor/skills/deco-startup-analysis/SKILL.md +248 -0
- package/.cursor/skills/deco-storefront-test-checklist/SKILL.md +369 -0
- package/.cursor/skills/deco-tanstack-hydration-fixes/SKILL.md +468 -0
- package/.cursor/skills/deco-tanstack-navigation/SKILL.md +681 -0
- package/.cursor/skills/deco-tanstack-search/SKILL.md +411 -0
- package/.cursor/skills/deco-tanstack-storefront-patterns/SKILL.md +1013 -0
- package/.cursor/skills/deco-to-tanstack-migration/SKILL.md +518 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/codemod-commands.md +174 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/commerce/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/deco-framework/README.md +128 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/gotchas.md +719 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/imports/README.md +70 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/platform-hooks/README.md +154 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/signals/README.md +220 -0
- package/.cursor/skills/deco-to-tanstack-migration/references/vite-config/README.md +78 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/package-json.md +55 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/root-route.md +110 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/router.md +96 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/setup-ts.md +167 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/vite-config.md +122 -0
- package/.cursor/skills/deco-to-tanstack-migration/templates/worker-entry.md +67 -0
- package/.cursor/skills/deco-typescript-fixes/SKILL.md +178 -0
- package/.cursor/skills/deco-typescript-fixes/common-fixes.md +330 -0
- package/.cursor/skills/deco-typescript-fixes/strategy.md +148 -0
- package/.cursor/skills/deco-variant-selection-perf/SKILL.md +272 -0
- package/.cursor/skills/deco-vtex-fetch-cache/SKILL.md +225 -0
- package/.cursor/skills/find-skills/SKILL.md +133 -0
- package/.cursor/skills/incident-report/SKILL.md +179 -0
- package/.cursor/skills/incident-report/references/5-whys.md +75 -0
- package/.cursor/skills/incident-report/templates/client-report.md +187 -0
- package/.cursor/skills/incident-report/templates/internal-report.md +206 -0
- package/.cursor/skills/template-skill/SKILL.md +38 -0
- package/.github/workflows/release.yml +32 -0
- package/.releaserc.json +25 -0
- package/CLAUDE.md +135 -0
- package/GAP_ANALYSIS.md +224 -0
- package/GAP_ANALYSIS_V2.md +1013 -0
- package/biome.json +39 -0
- package/knip.json +5 -0
- package/package.json +87 -0
- package/scripts/generate-blocks.ts +69 -0
- package/scripts/generate-invoke.ts +378 -0
- package/scripts/generate-schema.ts +657 -0
- package/src/admin/cors.ts +29 -0
- package/src/admin/decofile.ts +72 -0
- package/src/admin/index.ts +24 -0
- package/src/admin/invoke.ts +163 -0
- package/src/admin/liveControls.ts +29 -0
- package/src/admin/meta.ts +70 -0
- package/src/admin/render.ts +205 -0
- package/src/admin/schema.ts +686 -0
- package/src/admin/setup.ts +44 -0
- package/src/cms/index.ts +59 -0
- package/src/cms/loader.ts +180 -0
- package/src/cms/registry.ts +162 -0
- package/src/cms/resolve.ts +1005 -0
- package/src/cms/sectionLoaders.ts +294 -0
- package/src/hooks/DecoPageRenderer.tsx +444 -0
- package/src/hooks/LazySection.tsx +109 -0
- package/src/hooks/LiveControls.tsx +108 -0
- package/src/hooks/SectionErrorFallback.tsx +85 -0
- package/src/hooks/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/matchers/builtins.ts +184 -0
- package/src/matchers/posthog.ts +154 -0
- package/src/middleware/decoState.ts +55 -0
- package/src/middleware/healthMetrics.ts +131 -0
- package/src/middleware/index.ts +80 -0
- package/src/middleware/liveness.ts +21 -0
- package/src/middleware/observability.ts +205 -0
- package/src/routes/adminRoutes.ts +83 -0
- package/src/routes/cmsRoute.ts +302 -0
- package/src/routes/components.tsx +34 -0
- package/src/routes/index.ts +15 -0
- package/src/sdk/analytics.ts +72 -0
- package/src/sdk/cacheHeaders.ts +268 -0
- package/src/sdk/cachedLoader.ts +206 -0
- package/src/sdk/clx.ts +3 -0
- package/src/sdk/cookie.ts +39 -0
- package/src/sdk/createInvoke.ts +57 -0
- package/src/sdk/csp.ts +59 -0
- package/src/sdk/env.ts +27 -0
- package/src/sdk/index.ts +63 -0
- package/src/sdk/instrumentedFetch.ts +137 -0
- package/src/sdk/invoke.ts +133 -0
- package/src/sdk/mergeCacheControl.ts +150 -0
- package/src/sdk/redirects.ts +217 -0
- package/src/sdk/requestContext.ts +184 -0
- package/src/sdk/serverTimings.ts +68 -0
- package/src/sdk/signal.ts +41 -0
- package/src/sdk/sitemap.ts +143 -0
- package/src/sdk/urlUtils.ts +117 -0
- package/src/sdk/useDevice.ts +82 -0
- package/src/sdk/useId.ts +7 -0
- package/src/sdk/useScript.ts +101 -0
- package/src/sdk/workerEntry.ts +703 -0
- package/src/sdk/wrapCaughtErrors.ts +107 -0
- package/src/types/index.ts +39 -0
- package/src/types/widgets.ts +13 -0
- package/tsconfig.json +13 -0
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
# Headless Mode - Autonomous Incident Investigation
|
|
2
|
+
|
|
3
|
+
This mode is designed for **automated triggering** from incident management systems. The agent receives minimal context and must autonomously discover, investigate, and propose solutions without human interaction.
|
|
4
|
+
|
|
5
|
+
## Trigger Input Format
|
|
6
|
+
|
|
7
|
+
The incident management system should provide a structured input:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"site": "storename",
|
|
12
|
+
"hostname": "www.storename.com.br",
|
|
13
|
+
"alert_type": "error_spike | latency | availability | rate_limit | custom",
|
|
14
|
+
"alert_message": "Error rate exceeded 5% threshold",
|
|
15
|
+
"alert_source": "hyperdx | cloudflare | uptime | custom",
|
|
16
|
+
"started_at": "2026-02-03T22:30:00Z",
|
|
17
|
+
"severity": "critical | high | medium | low",
|
|
18
|
+
"metadata": {
|
|
19
|
+
"error_sample": "TypeError: Cannot read property 'x' of undefined",
|
|
20
|
+
"affected_path": "/product/123/p",
|
|
21
|
+
"error_count": 150,
|
|
22
|
+
"timeframe_minutes": 5
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Minimum required fields**: `site`, `alert_type`, `alert_message`
|
|
28
|
+
|
|
29
|
+
## Autonomous Investigation Workflow
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
33
|
+
│ PHASE 1: CONTEXT GATHERING (autonomous) │
|
|
34
|
+
│ - Parse alert input │
|
|
35
|
+
│ - Extract keywords from alert_message │
|
|
36
|
+
│ - Determine investigation scope │
|
|
37
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
38
|
+
│
|
|
39
|
+
▼
|
|
40
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
41
|
+
│ PHASE 2: LEARNINGS SCAN (parallel) │
|
|
42
|
+
│ - Search learnings/ by extracted keywords │
|
|
43
|
+
│ - Match alert_type to learning categories │
|
|
44
|
+
│ - Score matches by symptom similarity │
|
|
45
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
46
|
+
│
|
|
47
|
+
▼
|
|
48
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
49
|
+
│ PHASE 3: LIVE DATA COLLECTION (parallel) │
|
|
50
|
+
│ - Pull error logs from HyperDX │
|
|
51
|
+
│ - Pull CDN metrics from monitoring │
|
|
52
|
+
│ - Check recent deployments │
|
|
53
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
54
|
+
│
|
|
55
|
+
▼
|
|
56
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
57
|
+
│ PHASE 4: CORRELATION & DIAGNOSIS │
|
|
58
|
+
│ - Match live data patterns to learnings │
|
|
59
|
+
│ - Identify root cause hypothesis │
|
|
60
|
+
│ - Determine confidence level │
|
|
61
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
62
|
+
│
|
|
63
|
+
▼
|
|
64
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
65
|
+
│ PHASE 5: OUTPUT REPORT │
|
|
66
|
+
│ - Generate structured findings │
|
|
67
|
+
│ - Propose solutions with confidence │
|
|
68
|
+
│ - Suggest next actions │
|
|
69
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Phase 1: Context Gathering
|
|
73
|
+
|
|
74
|
+
**Extract investigation parameters from alert:**
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
# Pseudo-code for context extraction
|
|
78
|
+
def extract_context(alert):
|
|
79
|
+
context = {
|
|
80
|
+
"site": alert.site,
|
|
81
|
+
"hostname": alert.hostname or f"{alert.site}.deco.site",
|
|
82
|
+
"timeframe": {
|
|
83
|
+
"start": alert.started_at - 30min, # Look back 30min before alert
|
|
84
|
+
"end": "now"
|
|
85
|
+
},
|
|
86
|
+
"keywords": extract_keywords(alert.alert_message),
|
|
87
|
+
"alert_category": map_alert_to_category(alert.alert_type)
|
|
88
|
+
}
|
|
89
|
+
return context
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Alert type to category mapping:**
|
|
93
|
+
|
|
94
|
+
| Alert Type | Investigation Focus | Primary Learnings Category |
|
|
95
|
+
|------------|--------------------|-----------------------------|
|
|
96
|
+
| `error_spike` | Error logs, stack traces | `block-config`, `loader-optimization` |
|
|
97
|
+
| `latency` | CDN metrics, cache rates | `cache-strategy`, `loader-optimization` |
|
|
98
|
+
| `availability` | Health checks, deployments | `migration`, `block-config` |
|
|
99
|
+
| `rate_limit` | API call volume, cache | `cache-strategy`, `loader-optimization` |
|
|
100
|
+
| `custom` | Keyword extraction from message | All categories |
|
|
101
|
+
|
|
102
|
+
**Keyword extraction patterns:**
|
|
103
|
+
|
|
104
|
+
```javascript
|
|
105
|
+
// Extract actionable keywords from error messages
|
|
106
|
+
const KEYWORD_PATTERNS = [
|
|
107
|
+
/(\d{3})\s*(error|response)/i, // HTTP status codes
|
|
108
|
+
/(timeout|timed out)/i, // Timeouts
|
|
109
|
+
/(cannot read|undefined|null)/i, // JS errors
|
|
110
|
+
/(vtex|shopify|wake)/i, // Platform names
|
|
111
|
+
/(cache|cached)/i, // Cache issues
|
|
112
|
+
/(loader|section|action)/i, // Deco components
|
|
113
|
+
/(rate limit|too many|429)/i, // Rate limiting
|
|
114
|
+
/\/([a-z-]+)\.(ts|tsx)/i, // File paths
|
|
115
|
+
];
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Phase 2: Learnings Scan
|
|
119
|
+
|
|
120
|
+
**Parallel search strategy:**
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Run these searches in parallel
|
|
124
|
+
SEARCHES=(
|
|
125
|
+
"grep -ri '${KEYWORD_1}' learnings/"
|
|
126
|
+
"grep -ri '${KEYWORD_2}' learnings/"
|
|
127
|
+
"grep -ri '${ALERT_CATEGORY}' learnings/"
|
|
128
|
+
"grep -ri '${ERROR_CODE}' learnings/"
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# Execute all and collect results
|
|
132
|
+
parallel ::: "${SEARCHES[@]}"
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Scoring algorithm:**
|
|
136
|
+
|
|
137
|
+
| Match Type | Score | Example |
|
|
138
|
+
|------------|-------|---------|
|
|
139
|
+
| Exact error message match | +10 | "429" in alert matches "429" in learning |
|
|
140
|
+
| Category match | +5 | `rate_limit` alert matches `cache-strategy` learning |
|
|
141
|
+
| Keyword in symptoms section | +3 | "slow" in alert, "slow" in learning symptoms |
|
|
142
|
+
| Keyword anywhere in learning | +1 | General term match |
|
|
143
|
+
|
|
144
|
+
**Select top 3 learnings by score for detailed review.**
|
|
145
|
+
|
|
146
|
+
## Phase 3: Live Data Collection
|
|
147
|
+
|
|
148
|
+
**Execute these data gathering operations in parallel:**
|
|
149
|
+
|
|
150
|
+
### 3a. Error Logs (HyperDX)
|
|
151
|
+
|
|
152
|
+
```javascript
|
|
153
|
+
// Search recent errors for this site
|
|
154
|
+
SEARCH_LOGS({
|
|
155
|
+
query: `level:error site:${site}`,
|
|
156
|
+
startTime: timeframe.start,
|
|
157
|
+
endTime: timeframe.end,
|
|
158
|
+
limit: 100
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
// Group errors by message
|
|
162
|
+
GET_LOG_DETAILS({
|
|
163
|
+
query: `level:error site:${site}`,
|
|
164
|
+
groupBy: ["body", "service"],
|
|
165
|
+
startTime: timeframe.start,
|
|
166
|
+
endTime: timeframe.end
|
|
167
|
+
})
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 3b. CDN Metrics
|
|
171
|
+
|
|
172
|
+
```javascript
|
|
173
|
+
// Overall health
|
|
174
|
+
MONITOR_SUMMARY({
|
|
175
|
+
sitename: site,
|
|
176
|
+
hostname: hostname,
|
|
177
|
+
startDate: timeframe.start.toDateString(),
|
|
178
|
+
endDate: timeframe.end.toDateString(),
|
|
179
|
+
granularity: "hourly"
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
// Error breakdown
|
|
183
|
+
MONITOR_STATUS_CODES({ ...baseParams })
|
|
184
|
+
|
|
185
|
+
// Cache effectiveness
|
|
186
|
+
MONITOR_CACHE_STATUS({ ...baseParams })
|
|
187
|
+
|
|
188
|
+
// Hot paths (if latency alert)
|
|
189
|
+
MONITOR_TOP_PATHS({ ...baseParams })
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### 3c. Recent Changes
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Check for recent deployments (if repo access available)
|
|
196
|
+
git log --oneline --since="${timeframe.start}" --until="${timeframe.end}"
|
|
197
|
+
|
|
198
|
+
# Check for config changes
|
|
199
|
+
git diff HEAD~10 -- .deco/blocks/
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Phase 4: Correlation & Diagnosis
|
|
203
|
+
|
|
204
|
+
**Pattern matching rules:**
|
|
205
|
+
|
|
206
|
+
```yaml
|
|
207
|
+
rules:
|
|
208
|
+
- name: "Rate Limit - Missing Cache"
|
|
209
|
+
conditions:
|
|
210
|
+
- alert_type: rate_limit
|
|
211
|
+
- cache_hit_rate: < 50%
|
|
212
|
+
- top_errors_contain: "429"
|
|
213
|
+
diagnosis: "Loaders missing cache configuration causing API overload"
|
|
214
|
+
confidence: high
|
|
215
|
+
learning_match: cache-strategy-standardization-loaders.md
|
|
216
|
+
|
|
217
|
+
- name: "Rate Limit - Overfetching"
|
|
218
|
+
conditions:
|
|
219
|
+
- alert_type: rate_limit
|
|
220
|
+
- error_logs_contain: "Too Many Requests"
|
|
221
|
+
- top_paths_contain: "/live/invoke"
|
|
222
|
+
diagnosis: "Loaders fetching more data than needed"
|
|
223
|
+
confidence: high
|
|
224
|
+
learning_match: loader-overfetching-n-plus-problem.md
|
|
225
|
+
|
|
226
|
+
- name: "Latency - Edge Cache Blocked"
|
|
227
|
+
conditions:
|
|
228
|
+
- alert_type: latency
|
|
229
|
+
- cache_hit_rate: < 30%
|
|
230
|
+
- paths_contain: "/deco/render"
|
|
231
|
+
- headers_contain: "set-cookie"
|
|
232
|
+
diagnosis: "VTEX cookies preventing edge caching of lazy sections"
|
|
233
|
+
confidence: high
|
|
234
|
+
learning_match: vtex-cookies-prevent-edge-caching.md
|
|
235
|
+
|
|
236
|
+
- name: "Error Spike - Dangling Reference"
|
|
237
|
+
conditions:
|
|
238
|
+
- alert_type: error_spike
|
|
239
|
+
- error_logs_contain: "dangling reference"
|
|
240
|
+
diagnosis: "Block configuration references deleted component"
|
|
241
|
+
confidence: very_high
|
|
242
|
+
learning_match: dangling-block-references.md
|
|
243
|
+
|
|
244
|
+
- name: "Error Spike - Type Error"
|
|
245
|
+
conditions:
|
|
246
|
+
- alert_type: error_spike
|
|
247
|
+
- error_logs_contain: "TypeError"
|
|
248
|
+
- error_logs_contain: "undefined"
|
|
249
|
+
diagnosis: "Runtime type error - possible null/undefined access"
|
|
250
|
+
confidence: medium
|
|
251
|
+
learning_match: null # May need code investigation
|
|
252
|
+
|
|
253
|
+
- name: "Latency - Slow Loaders"
|
|
254
|
+
conditions:
|
|
255
|
+
- alert_type: latency
|
|
256
|
+
- top_paths_latency: > 500ms
|
|
257
|
+
- paths_contain: "/live/invoke"
|
|
258
|
+
diagnosis: "Slow API responses or missing loader optimization"
|
|
259
|
+
confidence: medium
|
|
260
|
+
learning_match: loader-overfetching-n-plus-problem.md
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
**Confidence levels:**
|
|
264
|
+
|
|
265
|
+
| Level | Meaning | Action |
|
|
266
|
+
|-------|---------|--------|
|
|
267
|
+
| `very_high` | Exact match to known pattern | Auto-suggest fix |
|
|
268
|
+
| `high` | Strong correlation to learning | Recommend fix with verification |
|
|
269
|
+
| `medium` | Partial match, needs validation | Suggest investigation path |
|
|
270
|
+
| `low` | Weak signals, inconclusive | Escalate to human |
|
|
271
|
+
|
|
272
|
+
## Phase 5: Output Report
|
|
273
|
+
|
|
274
|
+
**Structured output format:**
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"investigation_id": "inc-2026-02-03-001",
|
|
279
|
+
"site": "storename",
|
|
280
|
+
"alert_received": "2026-02-03T22:30:00Z",
|
|
281
|
+
"investigation_completed": "2026-02-03T22:32:15Z",
|
|
282
|
+
"duration_seconds": 135,
|
|
283
|
+
|
|
284
|
+
"diagnosis": {
|
|
285
|
+
"root_cause": "Loaders missing cache configuration causing repeated API calls",
|
|
286
|
+
"confidence": "high",
|
|
287
|
+
"matched_learning": "cache-strategy-standardization-loaders.md",
|
|
288
|
+
"evidence": [
|
|
289
|
+
"Cache hit rate: 23% (target: >80%)",
|
|
290
|
+
"Top error: '429 Too Many Requests' (1,234 occurrences)",
|
|
291
|
+
"Uncached paths: /live/invoke/vtex/loaders/productList (45K requests)"
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
|
|
295
|
+
"proposed_solution": {
|
|
296
|
+
"summary": "Add stale-while-revalidate cache to high-volume loaders",
|
|
297
|
+
"steps": [
|
|
298
|
+
"Add `export const cache = 'stale-while-revalidate'` to loaders/productList.ts",
|
|
299
|
+
"Add cacheKey function with product ID",
|
|
300
|
+
"Deploy and monitor cache hit rate"
|
|
301
|
+
],
|
|
302
|
+
"code_changes": [
|
|
303
|
+
{
|
|
304
|
+
"file": "loaders/productList.ts",
|
|
305
|
+
"action": "add",
|
|
306
|
+
"content": "export const cache = 'stale-while-revalidate';\nexport const cacheKey = (props) => `productList:${props.collection}`;"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"estimated_impact": "Reduce API calls by 60-70%, eliminate 429 errors"
|
|
310
|
+
},
|
|
311
|
+
|
|
312
|
+
"metrics_snapshot": {
|
|
313
|
+
"total_requests": "2.1M",
|
|
314
|
+
"error_rate": "6.8%",
|
|
315
|
+
"cache_hit_rate": "23%",
|
|
316
|
+
"p95_latency_ms": 450,
|
|
317
|
+
"top_errors": [
|
|
318
|
+
{ "message": "429 Too Many Requests", "count": 1234 },
|
|
319
|
+
{ "message": "timeout", "count": 89 }
|
|
320
|
+
]
|
|
321
|
+
},
|
|
322
|
+
|
|
323
|
+
"next_actions": [
|
|
324
|
+
{
|
|
325
|
+
"action": "apply_fix",
|
|
326
|
+
"confidence": "high",
|
|
327
|
+
"requires_human": false
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"action": "monitor_post_deploy",
|
|
331
|
+
"check": "cache_hit_rate > 70%",
|
|
332
|
+
"timeout_minutes": 30
|
|
333
|
+
}
|
|
334
|
+
],
|
|
335
|
+
|
|
336
|
+
"escalation": {
|
|
337
|
+
"required": false,
|
|
338
|
+
"reason": null
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
## Escalation Triggers
|
|
344
|
+
|
|
345
|
+
**Auto-escalate to human when:**
|
|
346
|
+
|
|
347
|
+
```yaml
|
|
348
|
+
escalation_rules:
|
|
349
|
+
- condition: confidence < medium
|
|
350
|
+
reason: "Unable to determine root cause with confidence"
|
|
351
|
+
|
|
352
|
+
- condition: no_learning_match AND no_pattern_match
|
|
353
|
+
reason: "Novel issue - not in knowledge base"
|
|
354
|
+
|
|
355
|
+
- condition: severity == critical AND site_down
|
|
356
|
+
reason: "Critical outage requires human oversight"
|
|
357
|
+
|
|
358
|
+
- condition: fix_requires_platform_change
|
|
359
|
+
reason: "Fix cannot be applied to site code"
|
|
360
|
+
|
|
361
|
+
- condition: multiple_root_causes
|
|
362
|
+
reason: "Complex incident with multiple contributing factors"
|
|
363
|
+
|
|
364
|
+
- condition: data_collection_failed
|
|
365
|
+
reason: "Unable to gather sufficient diagnostic data"
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Integration Examples
|
|
369
|
+
|
|
370
|
+
### PagerDuty Webhook
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"event": {
|
|
375
|
+
"event_type": "incident.triggered",
|
|
376
|
+
"incident": {
|
|
377
|
+
"title": "High error rate on www.storename.com.br",
|
|
378
|
+
"urgency": "high",
|
|
379
|
+
"custom_details": {
|
|
380
|
+
"site": "storename",
|
|
381
|
+
"hostname": "www.storename.com.br",
|
|
382
|
+
"alert_type": "error_spike",
|
|
383
|
+
"error_rate": "8.5%"
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### Opsgenie Alert
|
|
391
|
+
|
|
392
|
+
```json
|
|
393
|
+
{
|
|
394
|
+
"alert": {
|
|
395
|
+
"message": "Error rate threshold exceeded",
|
|
396
|
+
"priority": "P1",
|
|
397
|
+
"details": {
|
|
398
|
+
"site": "storename",
|
|
399
|
+
"metric": "error_rate",
|
|
400
|
+
"value": "8.5%",
|
|
401
|
+
"threshold": "5%"
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### Slack Workflow Trigger
|
|
408
|
+
|
|
409
|
+
```
|
|
410
|
+
/debug-incident site:storename type:latency message:"Pages loading slowly"
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## Output Destinations
|
|
414
|
+
|
|
415
|
+
The investigation report can be sent to:
|
|
416
|
+
|
|
417
|
+
| Destination | Format | Use Case |
|
|
418
|
+
|-------------|--------|----------|
|
|
419
|
+
| Slack | Formatted message | Real-time team notification |
|
|
420
|
+
| PagerDuty | Note on incident | Incident timeline |
|
|
421
|
+
| GitHub | Issue/PR | Automated fix proposal |
|
|
422
|
+
| Webhook | JSON | Custom integrations |
|
|
423
|
+
| File | Markdown | Audit trail |
|
|
424
|
+
|
|
425
|
+
### Slack Output Format
|
|
426
|
+
|
|
427
|
+
```
|
|
428
|
+
🔴 *Incident Investigation Complete*
|
|
429
|
+
|
|
430
|
+
*Site:* storename
|
|
431
|
+
*Duration:* 2m 15s
|
|
432
|
+
*Confidence:* HIGH
|
|
433
|
+
|
|
434
|
+
*Root Cause:*
|
|
435
|
+
Loaders missing cache configuration causing repeated API calls
|
|
436
|
+
|
|
437
|
+
*Evidence:*
|
|
438
|
+
• Cache hit rate: 23% (target: >80%)
|
|
439
|
+
• 429 errors: 1,234 in last 30min
|
|
440
|
+
• Top uncached: /live/invoke/vtex/loaders/productList
|
|
441
|
+
|
|
442
|
+
*Matched Learning:*
|
|
443
|
+
`cache-strategy-standardization-loaders.md`
|
|
444
|
+
|
|
445
|
+
*Proposed Fix:*
|
|
446
|
+
Add `export const cache = 'stale-while-revalidate'` to productList.ts
|
|
447
|
+
|
|
448
|
+
*Next Action:* Ready to apply fix (no human required)
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
## Autonomous Fix Application
|
|
452
|
+
|
|
453
|
+
**For high-confidence matches with code changes:**
|
|
454
|
+
|
|
455
|
+
```yaml
|
|
456
|
+
auto_fix_criteria:
|
|
457
|
+
- confidence: very_high OR high
|
|
458
|
+
- learning_match: exists
|
|
459
|
+
- code_change: defined
|
|
460
|
+
- risk_level: low # No DB changes, no auth changes
|
|
461
|
+
- rollback: possible # Git-based deployment
|
|
462
|
+
|
|
463
|
+
auto_fix_workflow:
|
|
464
|
+
1. Create branch: fix/incident-{id}
|
|
465
|
+
2. Apply code changes from solution
|
|
466
|
+
3. Run type check: deno check --unstable-tsgo
|
|
467
|
+
4. Run block validation: deno run -A https://deco.cx/validate
|
|
468
|
+
5. If checks pass:
|
|
469
|
+
- Create PR with investigation report
|
|
470
|
+
- Request auto-merge if enabled
|
|
471
|
+
6. If checks fail:
|
|
472
|
+
- Report failure reason
|
|
473
|
+
- Escalate to human
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
## Monitoring & Feedback Loop
|
|
477
|
+
|
|
478
|
+
**Post-fix verification:**
|
|
479
|
+
|
|
480
|
+
```yaml
|
|
481
|
+
verification:
|
|
482
|
+
wait: 10 minutes after deploy
|
|
483
|
+
checks:
|
|
484
|
+
- metric: error_rate
|
|
485
|
+
condition: < alert_threshold
|
|
486
|
+
action: mark_resolved
|
|
487
|
+
|
|
488
|
+
- metric: cache_hit_rate
|
|
489
|
+
condition: increased by 20%+
|
|
490
|
+
action: confirm_fix_effective
|
|
491
|
+
|
|
492
|
+
- metric: same_error_recurring
|
|
493
|
+
condition: true
|
|
494
|
+
action: escalate - fix ineffective
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
**Learning feedback:**
|
|
498
|
+
|
|
499
|
+
```yaml
|
|
500
|
+
feedback_loop:
|
|
501
|
+
- if fix_effective:
|
|
502
|
+
action: increment learning confidence score
|
|
503
|
+
|
|
504
|
+
- if fix_ineffective:
|
|
505
|
+
action: flag learning for review
|
|
506
|
+
action: create follow-up investigation
|
|
507
|
+
|
|
508
|
+
- if novel_issue_resolved:
|
|
509
|
+
action: prompt for new learning creation
|
|
510
|
+
```
|