@luanpdd/kit-mcp 1.35.0 → 1.36.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.
Files changed (117) hide show
  1. package/bin/cli.js +2 -2
  2. package/bin/mcp.js +6 -6
  3. package/bin/ui.js +74 -74
  4. package/gates/ai-prompt-stability.md +120 -120
  5. package/gates/budget-description.md +68 -68
  6. package/gates/confidence.md +29 -29
  7. package/gates/dependency-check.md +33 -33
  8. package/gates/dept-cycle-prevention.md +179 -179
  9. package/gates/golden-signals-coverage.md +133 -133
  10. package/gates/legacy-refactor-safety.md +178 -178
  11. package/gates/multi-tenant-rls-coverage.md +102 -102
  12. package/gates/no-personal-uuid.md +72 -72
  13. package/gates/obs-agents-mcp-supabase.md +86 -86
  14. package/gates/obs-skills-frontmatter.md +76 -76
  15. package/gates/observability-coverage.md +151 -151
  16. package/gates/omm-no-regression.md +83 -83
  17. package/gates/postmortem-template-required.md +127 -127
  18. package/gates/prr-checklist-coverage.md +128 -128
  19. package/gates/regression.md +32 -32
  20. package/gates/release-pipeline-policy.md +132 -132
  21. package/gates/secrets-scan.md +33 -33
  22. package/gates/service-role-not-in-user-facing.md +113 -113
  23. package/gates/skill-must-include.md +71 -71
  24. package/gates/sync-idempotent.md +62 -62
  25. package/gates/verify-phase-goal.md +34 -34
  26. package/kit/agents/designer-ui.md +216 -216
  27. package/kit/agents/workflow-generator.md +537 -167
  28. package/kit/commands/adicionar-backlog.md +1 -1
  29. package/kit/commands/adicionar-fase.md +1 -1
  30. package/kit/commands/adicionar-tarefa.md +1 -1
  31. package/kit/commands/auditar-observabilidade.md +103 -103
  32. package/kit/commands/auditar-toil.md +129 -129
  33. package/kit/commands/caracterizar-prompt.md +195 -195
  34. package/kit/commands/criar-workflow.md +158 -158
  35. package/kit/commands/definir-perfil.md +1 -1
  36. package/kit/commands/definir-slo.md +108 -108
  37. package/kit/commands/fio.md +1 -1
  38. package/kit/commands/golden-signals.md +142 -142
  39. package/kit/commands/instrumentar-fase.md +200 -200
  40. package/kit/commands/investigar-producao.md +162 -162
  41. package/kit/commands/observabilidade.md +118 -118
  42. package/kit/commands/postmortem.md +179 -179
  43. package/kit/commands/prr.md +205 -205
  44. package/kit/commands/publicar-rapido.md +207 -207
  45. package/kit/commands/risk-budget.md +220 -220
  46. package/kit/commands/sre.md +230 -230
  47. package/kit/file-manifest.json +424 -424
  48. package/kit/framework/references/output-style.md +22 -22
  49. package/kit/hooks/post-apply-migration.js +199 -199
  50. package/kit/hooks/sidecar-tool-publisher.js +210 -210
  51. package/kit/skills/_shared-dados-distribuidos/glossary.md +224 -224
  52. package/kit/skills/_shared-legacy/glossary.md +389 -389
  53. package/kit/skills/_shared-multi-tenant/glossary.md +186 -186
  54. package/kit/skills/_shared-observability/glossary.md +396 -396
  55. package/kit/skills/_shared-sre/glossary.md +712 -712
  56. package/kit/skills/_shared-supabase/glossary.md +234 -234
  57. package/kit/skills/blameless-postmortems/SKILL.md +340 -340
  58. package/kit/skills/burn-rate-alerting/SKILL.md +258 -258
  59. package/kit/skills/cascading-failures/SKILL.md +311 -311
  60. package/kit/skills/core-analysis-loop/SKILL.md +352 -352
  61. package/kit/skills/distributed-tracing/SKILL.md +362 -362
  62. package/kit/skills/dynamic-workflow-authoring/SKILL.md +327 -223
  63. package/kit/skills/eliminating-toil/SKILL.md +243 -243
  64. package/kit/skills/event-based-slos/SKILL.md +296 -296
  65. package/kit/skills/four-golden-signals/SKILL.md +314 -314
  66. package/kit/skills/hermetic-builds/SKILL.md +323 -323
  67. package/kit/skills/legacy-monster-methods/SKILL.md +444 -444
  68. package/kit/skills/llm-as-dependency/SKILL.md +436 -436
  69. package/kit/skills/load-shedding-graceful-degradation/SKILL.md +396 -396
  70. package/kit/skills/observability-driven-development/SKILL.md +315 -315
  71. package/kit/skills/observability-maturity-model/SKILL.md +222 -222
  72. package/kit/skills/opentelemetry-standard/SKILL.md +351 -351
  73. package/kit/skills/production-readiness-review/SKILL.md +305 -305
  74. package/kit/skills/release-engineering/SKILL.md +367 -367
  75. package/kit/skills/retry-strategies/SKILL.md +372 -372
  76. package/kit/skills/sre-risk-management/SKILL.md +221 -221
  77. package/kit/skills/structured-events/SKILL.md +265 -265
  78. package/kit/skills/supabase-cron-queues/SKILL.md +275 -275
  79. package/kit/skills/supabase-database-functions/SKILL.md +332 -332
  80. package/kit/skills/supabase-declarative-schema/SKILL.md +183 -183
  81. package/kit/skills/supabase-pgvector-rag/SKILL.md +253 -253
  82. package/kit/skills/supabase-postgres-style/SKILL.md +138 -138
  83. package/kit/skills/supabase-storage/SKILL.md +234 -234
  84. package/kit/skills/telemetry-pipelines/SKILL.md +259 -259
  85. package/kit/skills/telemetry-sampling/SKILL.md +256 -256
  86. package/kit/skills/ui-anti-padroes-ia/SKILL.md +261 -261
  87. package/kit/skills/ui-contexto-produto/SKILL.md +248 -248
  88. package/kit/skills/ui-cor-estrategia/SKILL.md +213 -213
  89. package/kit/skills/ui-critica-auditoria/SKILL.md +260 -260
  90. package/kit/skills/ui-motion-funcional/SKILL.md +264 -264
  91. package/kit/skills/ui-ritmo-espacial/SKILL.md +259 -259
  92. package/kit/skills/ui-tipografia/SKILL.md +211 -211
  93. package/package.json +1 -1
  94. package/src/cli/index.js +1114 -1114
  95. package/src/cli/render.js +194 -194
  96. package/src/cli/upgrade-check.js +135 -135
  97. package/src/core/error-redaction.js +76 -76
  98. package/src/core/failures.js +153 -153
  99. package/src/core/gate-runner.js +205 -205
  100. package/src/core/gates.js +82 -82
  101. package/src/core/logger.js +170 -170
  102. package/src/core/manifest-verify.js +174 -174
  103. package/src/core/metrics.js +268 -268
  104. package/src/core/notify.js +60 -60
  105. package/src/core/path-safety.js +141 -141
  106. package/src/core/replays.js +120 -120
  107. package/src/core/ui.js +185 -185
  108. package/src/mcp-server/install.js +149 -149
  109. package/src/mcp-server/roots.js +124 -124
  110. package/src/ui/auto-spawn.js +113 -113
  111. package/src/ui/browser.js +78 -78
  112. package/src/ui/client.js +130 -130
  113. package/src/ui/events.js +65 -65
  114. package/src/ui/lockfile.js +191 -191
  115. package/src/ui/port.js +67 -67
  116. package/src/ui/server.js +547 -547
  117. package/src/ui/wrapper.js +129 -129
@@ -1,221 +1,221 @@
1
- ---
2
- name: sre-risk-management
3
- description: Use ao escolher SLO target — risk continuum, error budget como balanço explícito risk × innovation, "as reliable as needs to be, no more", sabedoria 99.99%.
4
- ---
5
-
6
- # SRE — Risk Management
7
-
8
- ## Quando usar
9
-
10
- LLM carrega esta skill ao definir SLO target, debater "qual disponibilidade precisamos?", ou justificar trade-off entre velocidade de release e estabilidade. Trigger phrases:
11
-
12
- - "SLO target", "qual disponibilidade?"
13
- - "99.9% vs 99.99%", "quantos noves?"
14
- - "error budget", "risk budget"
15
- - "risk continuum"
16
- - "as reliable as needs to be"
17
- - "sabedoria 99.99%", "smartphone dilui SLO"
18
- - "embracing risk", "Google SRE cap 3"
19
-
20
- ## Regras absolutas
21
-
22
- - **100% disponibilidade NÃO é o objetivo** — custo cresce não-linearmente acima de 99.95%; benefício marginal cai a zero porque outros componentes (ISP do usuário, smartphone, ar do ambiente) já têm < 99.99% de disponibilidade. Esforço além disso é desperdício.
23
- - **"As reliable as needs to be, no more"** — disponibilidade é decisão de produto, não de engenharia. Pergunta: "qual nível o usuário percebe como aceitável e está disposto a pagar?" — não "qual o máximo que conseguimos?".
24
- - **Sabedoria 99.99%** — smartphone tem ~99% de disponibilidade (sinal cai, bateria acaba, app trava). Usuário em 99% smartphone NÃO distingue serviço 99.99% vs 99.999% — ambos parecem "sempre funcionando" no contexto dele.
25
- - **Error budget é balanço explícito risk × innovation** — `(1 - SLO_target) × total_events` é orçamento de "bad" que pode ser gasto em deploys arriscados, experimentos, refactors. Se budget esgota, freeze releases até regenerar.
26
- - **Target ≤ 99.95% para SLO real** — 99.99% = 4.3 min de tolerância em 30d; sem tempo de reagir antes do budget esgotar; alerts viram zero-level. Para 99.99%+, use métricas/dashboards informativos, NÃO SLO acionável.
27
- - **SLI deve refletir customer perception** — meça o que o usuário sente ("checkout completou em < 800ms"), não estado interno ("threads ativas"). Risk é sobre consequência do customer, não engenharia.
28
- - **Diferentes tiers, diferentes targets** — `customer.tier='enterprise'` pode ter SLO 99.95%; `tier='free'` pode ter 99.5%. Risk é gradual; tratar todos clientes como tier-1 desperdiça budget.
29
-
30
- ## Patterns canônicos
31
-
32
- ### Pattern: risk continuum como decisão explícita
33
-
34
- | Target | Tolerância 30d | User-perceptible? | Recomendação | Custo relativo |
35
- |---|---|---|---|---|
36
- | 99% | 7.2 h | Sim (notável) | Tier free, beta features, internal tools | 1× |
37
- | 99.5% | 3.6 h | Notável em paths críticos | Tier free de produção | 2× |
38
- | 99.9% | 43.2 min | Aceitável para maior parte de UX | Tier paid default | 5× |
39
- | 99.95% | 21.6 min | Quase imperceptível | Tier enterprise / mission-critical | 10× |
40
- | 99.99% | 4.3 min | Imperceptível em smartphone | Apenas se justificado por user perception (raro) | 50×+ |
41
- | 99.999% | 26 s | NÃO perceptível | NUNCA para serviço user-facing | 100×+ |
42
-
43
- Cada nove adicional **multiplica custo** mas **divide benefício marginal**. Cliente final (humano em smartphone com ISP residencial ~99%) tem disponibilidade no canal de comunicação inferior à do seu serviço 99.99%. Essa é a sabedoria 99.99%.
44
-
45
- ### Pattern: error budget como decisão de release
46
-
47
- ```yaml
48
- # PT-BR: SLO documenta target + política de budget
49
- slo:
50
- name: checkout_success
51
- target: 0.999 # 99.9% — escolha explícita no risk continuum
52
- window: 30d_sliding
53
-
54
- # PT-BR: política de budget — o que fazer quando queima
55
- budget_policy:
56
- green: # > 50% restante
57
- action: "Releases livres; experimentos OK"
58
- yellow: # 10-50% restante
59
- action: "Aumentar canary % menor; review extra de PRs riscados"
60
- red: # < 10% restante
61
- action: "Freeze de features; foco em stability; postmortems revisitados"
62
- exhausted: # 0%
63
- action: "Freeze total; rollback de releases recentes; SEV1 incident review"
64
- ```
65
-
66
- Budget esgotado **não é punição** — é sinal de que o time gastou risk em demais releases arriscadas e precisa pausar para investir em stability. Restaurar budget = entregar trabalho que reduz erro, não pular o reset.
67
-
68
- ### Pattern: target diferenciado por customer.tier
69
-
70
- ```sql
71
- -- PT-BR: SLO compliance por tier — diferentes targets, diferentes alarmes
72
- select
73
- customer_tier,
74
- count(*) as total,
75
- count(*) filter (where result_success = true and duration_ms < 800) as good,
76
- count(*) filter (where result_success = true and duration_ms < 800)::float / count(*) as compliance,
77
- case customer_tier
78
- when 'enterprise' then 0.9995 -- PT-BR: 99.95% — paga por SLO rigoroso
79
- when 'pro' then 0.999 -- PT-BR: 99.9%
80
- when 'free' then 0.995 -- PT-BR: 99.5% — best effort
81
- end as target,
82
- case
83
- when count(*) filter (where result_success = true and duration_ms < 800)::float / count(*) >= (
84
- case customer_tier
85
- when 'enterprise' then 0.9995
86
- when 'pro' then 0.999
87
- when 'free' then 0.995
88
- end
89
- ) then 'IN_BUDGET'
90
- else 'OUT_OF_BUDGET'
91
- end as status
92
- from observability.events
93
- where service = 'orders-api' and timestamp > now() - interval '30 days'
94
- group by customer_tier;
95
- ```
96
-
97
- ### Pattern: justificar 99.99%+ excepcional
98
-
99
- ```text
100
- Para SLO ≥ 99.99%, o time DEVE responder afirmativamente a TODAS as perguntas:
101
-
102
- 1. User percebe diretamente a falha? (não apenas erro 500 — UX colapsa, dados perdidos)
103
- Ex: trading platform de high-frequency, controle de fluxo industrial, healthcare critical
104
-
105
- 2. Custo de outage > 10× custo de engineering p/ atingir target?
106
- (calcular: 4.3 min outage por mês × revenue/min impactado)
107
-
108
- 3. Sistema componentes downstream também são ≥ 99.99%?
109
- (cliente em ISP 99% — investir aqui é desperdício; trocar de ISP/CDN primeiro)
110
-
111
- 4. Time tem cultura para sustentar (canary obrigatório, rollback < 60s, on-call < 30s page)?
112
- (sem isso, 99.99% é aspiracional — real será 99.5%)
113
-
114
- Se QUALQUER resposta = NÃO → use 99.95% ou menos. Justificar em SLO.md comentário inline.
115
- ```
116
-
117
- ## Anti-patterns
118
-
119
- ### ANTI: pursuit of 100% availability
120
-
121
- ```text
122
- ANTI: perseguir 100% como meta de disponibilidade — rejeitar qualquer outage como
123
- falha de engenharia; medir sucesso por "zero downtime"
124
-
125
- PROBLEMA: custo cresce assintoticamente perto de 100%; benefício marginal cai a zero
126
- porque downstream (ISP do usuário, smartphone, ar do ambiente) já tem
127
- < 99.99%; time burns out perseguindo target inalcançável; budget de
128
- inovação some — toda capacidade vai para reliability sem ganho real.
129
-
130
- CERTO: aceitar imperfeição como design — error budget existe PARA SER GASTO em
131
- deploys arriscados, experimentos, refactors. Reliability é trade-off
132
- contra velocity, não absoluto.
133
- ```
134
-
135
- ### ANTI: SLO 99.99% sem justificativa
136
-
137
- ```text
138
- ANTI: definir 99.99% como target por default — "queremos o melhor possível";
139
- copiar número do AWS SLA; impor 99.99% sem checklist de justificação
140
-
141
- PROBLEMA: 4.3 min de tolerância em 30d é zero margem de manobra; alerts disparam
142
- após budget esgotar (zero-level — tarde demais para ação preventiva);
143
- comportamentos perversos (esconder outages para preservar number);
144
- time-pressure compulsiva; aspiração ≠ realidade — real será 99.5%
145
- por falta de cultura para sustentar.
146
-
147
- CERTO: ≤ 99.95% por default; 99.99%+ exige passar checklist de 4 perguntas
148
- (ver Pattern: justificar 99.99%+ excepcional). Documentar racional em
149
- SLO.md como comentário inline auditável.
150
- ```
151
-
152
- ### ANTI: SLO global "site availability"
153
-
154
- ```text
155
- ANTI: 1 SLO genérico "site availability 99.9%" cobrindo tudo — /admin, /api,
156
- /checkout, /search, /docs com mesmo target
157
-
158
- PROBLEMA: falha em /admin (uso 1×/dia por staff) não importa para customer;
159
- falha em /checkout (uso 100×/min com revenue impact) é catastrófico;
160
- mistura tudo no mesmo budget — alerts confusos, ações vagas; quando
161
- burn dispara, time não sabe o que priorizar.
162
-
163
- CERTO: 1 SLO por jornada crítica do user (`checkout_success: 99.9%`,
164
- `login_success: 99.95%`, `search_p95: 99% < 200ms`); cada um com target
165
- apropriado ao seu risk; admin/docs SEM SLO formal (só metric informativo).
166
- ```
167
-
168
- ### ANTI: budget como score de "performance"
169
-
170
- ```text
171
- ANTI: celebrar "atingimos SLO 99.99% este mês!" como vitória; KPIs comparam
172
- times por % budget intacto; pressão de leadership para subir target
173
-
174
- PROBLEMA: budget vira métrica de vaidade; budget intacto significa SUBUTILIZAÇÃO
175
- (não shippamos suficientes deploys arriscados/experimentos); leadership
176
- pressiona por mais features sem reconhecer trade-off; quando budget
177
- esgota uma vez, vira "fracasso" — time esconde problemas no próximo mês.
178
-
179
- CERTO: budget é orçamento — gastá-lo é OK e esperado. KPI é "shippamos N deploys
180
- de valor sem queimar budget", não "budget alto". Budget esgotado = sinal
181
- de aprender (quais releases custaram caro?), não punição.
182
- ```
183
-
184
- ### ANTI: SLA == SLO
185
-
186
- ```text
187
- ANTI: usar SLA do contrato (99.9%) como SLO interno — "se prometemos 99.9% no
188
- contrato, basta atingir 99.9% internamente"
189
-
190
- PROBLEMA: 0 margem de segurança entre compromisso comercial e meta interna;
191
- primeira anomalia operacional quebra contrato; sem buffer para reagir;
192
- SEV1 vira liability legal; cliente perde confiança no primeiro burn.
193
-
194
- CERTO: SLO interno mais rígido que SLA externo — fator de margem 5×.
195
- SLA externo: 99.9% (compromisso ao cliente);
196
- SLO interno: 99.95% (meta de engenharia com folga para reagir).
197
- ```
198
-
199
- ## Verificação
200
-
201
- Antes de marcar SLO target como decidido:
202
-
203
- 1. **Target justificado por customer perception** — não "queremos 99.99%" mas "usuário em smartphone percebe falha acima de X%"
204
- 2. **Target ≤ 99.95%** OU passou checklist de 99.99%+ (ver Pattern: justificar 99.99%+ excepcional)
205
- 3. **Tier-aware** — diferentes targets para `customer.tier` quando aplicável (enterprise/pro/free)
206
- 4. **Budget policy documentada** — 4 estados (green/yellow/red/exhausted) com ações claras
207
- 5. **Owner nomeado** — SLO sem dono = sem ação = sem valor
208
- 6. **SLI customer-facing** — mede o que cliente sente, não estado interno
209
- 7. **SLA externo > SLO interno** — margem entre compromisso comercial e meta interna
210
-
211
- ## Ver também
212
-
213
- - [`_shared-sre/glossary.md`](../_shared-sre/glossary.md) — termos canônicos risk continuum, error budget, MTTR/MTBF
214
- - [`event-based-slos`](../event-based-slos/SKILL.md) (v1.9) — definir SLO event-based com sliding window
215
- - [`burn-rate-alerting`](../burn-rate-alerting/SKILL.md) (v1.9) — alertas predictive sobre error budget
216
- - [`production-readiness-review`](../production-readiness-review/SKILL.md) — PRR axis "Performance" usa risk continuum
217
- - [`blameless-postmortems`](../blameless-postmortems/SKILL.md) — postmortem documenta budget consumido
218
-
219
- ---
220
-
221
- *Material-fonte: Site Reliability Engineering — Beyer, Jones, Petoff, Murphy (Google/O'Reilly, 2016) — Cap 3: "Embracing Risk".*
1
+ ---
2
+ name: sre-risk-management
3
+ description: Use ao escolher SLO target — risk continuum, error budget como balanço explícito risk × innovation, "as reliable as needs to be, no more", sabedoria 99.99%.
4
+ ---
5
+
6
+ # SRE — Risk Management
7
+
8
+ ## Quando usar
9
+
10
+ LLM carrega esta skill ao definir SLO target, debater "qual disponibilidade precisamos?", ou justificar trade-off entre velocidade de release e estabilidade. Trigger phrases:
11
+
12
+ - "SLO target", "qual disponibilidade?"
13
+ - "99.9% vs 99.99%", "quantos noves?"
14
+ - "error budget", "risk budget"
15
+ - "risk continuum"
16
+ - "as reliable as needs to be"
17
+ - "sabedoria 99.99%", "smartphone dilui SLO"
18
+ - "embracing risk", "Google SRE cap 3"
19
+
20
+ ## Regras absolutas
21
+
22
+ - **100% disponibilidade NÃO é o objetivo** — custo cresce não-linearmente acima de 99.95%; benefício marginal cai a zero porque outros componentes (ISP do usuário, smartphone, ar do ambiente) já têm < 99.99% de disponibilidade. Esforço além disso é desperdício.
23
+ - **"As reliable as needs to be, no more"** — disponibilidade é decisão de produto, não de engenharia. Pergunta: "qual nível o usuário percebe como aceitável e está disposto a pagar?" — não "qual o máximo que conseguimos?".
24
+ - **Sabedoria 99.99%** — smartphone tem ~99% de disponibilidade (sinal cai, bateria acaba, app trava). Usuário em 99% smartphone NÃO distingue serviço 99.99% vs 99.999% — ambos parecem "sempre funcionando" no contexto dele.
25
+ - **Error budget é balanço explícito risk × innovation** — `(1 - SLO_target) × total_events` é orçamento de "bad" que pode ser gasto em deploys arriscados, experimentos, refactors. Se budget esgota, freeze releases até regenerar.
26
+ - **Target ≤ 99.95% para SLO real** — 99.99% = 4.3 min de tolerância em 30d; sem tempo de reagir antes do budget esgotar; alerts viram zero-level. Para 99.99%+, use métricas/dashboards informativos, NÃO SLO acionável.
27
+ - **SLI deve refletir customer perception** — meça o que o usuário sente ("checkout completou em < 800ms"), não estado interno ("threads ativas"). Risk é sobre consequência do customer, não engenharia.
28
+ - **Diferentes tiers, diferentes targets** — `customer.tier='enterprise'` pode ter SLO 99.95%; `tier='free'` pode ter 99.5%. Risk é gradual; tratar todos clientes como tier-1 desperdiça budget.
29
+
30
+ ## Patterns canônicos
31
+
32
+ ### Pattern: risk continuum como decisão explícita
33
+
34
+ | Target | Tolerância 30d | User-perceptible? | Recomendação | Custo relativo |
35
+ |---|---|---|---|---|
36
+ | 99% | 7.2 h | Sim (notável) | Tier free, beta features, internal tools | 1× |
37
+ | 99.5% | 3.6 h | Notável em paths críticos | Tier free de produção | 2× |
38
+ | 99.9% | 43.2 min | Aceitável para maior parte de UX | Tier paid default | 5× |
39
+ | 99.95% | 21.6 min | Quase imperceptível | Tier enterprise / mission-critical | 10× |
40
+ | 99.99% | 4.3 min | Imperceptível em smartphone | Apenas se justificado por user perception (raro) | 50×+ |
41
+ | 99.999% | 26 s | NÃO perceptível | NUNCA para serviço user-facing | 100×+ |
42
+
43
+ Cada nove adicional **multiplica custo** mas **divide benefício marginal**. Cliente final (humano em smartphone com ISP residencial ~99%) tem disponibilidade no canal de comunicação inferior à do seu serviço 99.99%. Essa é a sabedoria 99.99%.
44
+
45
+ ### Pattern: error budget como decisão de release
46
+
47
+ ```yaml
48
+ # PT-BR: SLO documenta target + política de budget
49
+ slo:
50
+ name: checkout_success
51
+ target: 0.999 # 99.9% — escolha explícita no risk continuum
52
+ window: 30d_sliding
53
+
54
+ # PT-BR: política de budget — o que fazer quando queima
55
+ budget_policy:
56
+ green: # > 50% restante
57
+ action: "Releases livres; experimentos OK"
58
+ yellow: # 10-50% restante
59
+ action: "Aumentar canary % menor; review extra de PRs riscados"
60
+ red: # < 10% restante
61
+ action: "Freeze de features; foco em stability; postmortems revisitados"
62
+ exhausted: # 0%
63
+ action: "Freeze total; rollback de releases recentes; SEV1 incident review"
64
+ ```
65
+
66
+ Budget esgotado **não é punição** — é sinal de que o time gastou risk em demais releases arriscadas e precisa pausar para investir em stability. Restaurar budget = entregar trabalho que reduz erro, não pular o reset.
67
+
68
+ ### Pattern: target diferenciado por customer.tier
69
+
70
+ ```sql
71
+ -- PT-BR: SLO compliance por tier — diferentes targets, diferentes alarmes
72
+ select
73
+ customer_tier,
74
+ count(*) as total,
75
+ count(*) filter (where result_success = true and duration_ms < 800) as good,
76
+ count(*) filter (where result_success = true and duration_ms < 800)::float / count(*) as compliance,
77
+ case customer_tier
78
+ when 'enterprise' then 0.9995 -- PT-BR: 99.95% — paga por SLO rigoroso
79
+ when 'pro' then 0.999 -- PT-BR: 99.9%
80
+ when 'free' then 0.995 -- PT-BR: 99.5% — best effort
81
+ end as target,
82
+ case
83
+ when count(*) filter (where result_success = true and duration_ms < 800)::float / count(*) >= (
84
+ case customer_tier
85
+ when 'enterprise' then 0.9995
86
+ when 'pro' then 0.999
87
+ when 'free' then 0.995
88
+ end
89
+ ) then 'IN_BUDGET'
90
+ else 'OUT_OF_BUDGET'
91
+ end as status
92
+ from observability.events
93
+ where service = 'orders-api' and timestamp > now() - interval '30 days'
94
+ group by customer_tier;
95
+ ```
96
+
97
+ ### Pattern: justificar 99.99%+ excepcional
98
+
99
+ ```text
100
+ Para SLO ≥ 99.99%, o time DEVE responder afirmativamente a TODAS as perguntas:
101
+
102
+ 1. User percebe diretamente a falha? (não apenas erro 500 — UX colapsa, dados perdidos)
103
+ Ex: trading platform de high-frequency, controle de fluxo industrial, healthcare critical
104
+
105
+ 2. Custo de outage > 10× custo de engineering p/ atingir target?
106
+ (calcular: 4.3 min outage por mês × revenue/min impactado)
107
+
108
+ 3. Sistema componentes downstream também são ≥ 99.99%?
109
+ (cliente em ISP 99% — investir aqui é desperdício; trocar de ISP/CDN primeiro)
110
+
111
+ 4. Time tem cultura para sustentar (canary obrigatório, rollback < 60s, on-call < 30s page)?
112
+ (sem isso, 99.99% é aspiracional — real será 99.5%)
113
+
114
+ Se QUALQUER resposta = NÃO → use 99.95% ou menos. Justificar em SLO.md comentário inline.
115
+ ```
116
+
117
+ ## Anti-patterns
118
+
119
+ ### ANTI: pursuit of 100% availability
120
+
121
+ ```text
122
+ ANTI: perseguir 100% como meta de disponibilidade — rejeitar qualquer outage como
123
+ falha de engenharia; medir sucesso por "zero downtime"
124
+
125
+ PROBLEMA: custo cresce assintoticamente perto de 100%; benefício marginal cai a zero
126
+ porque downstream (ISP do usuário, smartphone, ar do ambiente) já tem
127
+ < 99.99%; time burns out perseguindo target inalcançável; budget de
128
+ inovação some — toda capacidade vai para reliability sem ganho real.
129
+
130
+ CERTO: aceitar imperfeição como design — error budget existe PARA SER GASTO em
131
+ deploys arriscados, experimentos, refactors. Reliability é trade-off
132
+ contra velocity, não absoluto.
133
+ ```
134
+
135
+ ### ANTI: SLO 99.99% sem justificativa
136
+
137
+ ```text
138
+ ANTI: definir 99.99% como target por default — "queremos o melhor possível";
139
+ copiar número do AWS SLA; impor 99.99% sem checklist de justificação
140
+
141
+ PROBLEMA: 4.3 min de tolerância em 30d é zero margem de manobra; alerts disparam
142
+ após budget esgotar (zero-level — tarde demais para ação preventiva);
143
+ comportamentos perversos (esconder outages para preservar number);
144
+ time-pressure compulsiva; aspiração ≠ realidade — real será 99.5%
145
+ por falta de cultura para sustentar.
146
+
147
+ CERTO: ≤ 99.95% por default; 99.99%+ exige passar checklist de 4 perguntas
148
+ (ver Pattern: justificar 99.99%+ excepcional). Documentar racional em
149
+ SLO.md como comentário inline auditável.
150
+ ```
151
+
152
+ ### ANTI: SLO global "site availability"
153
+
154
+ ```text
155
+ ANTI: 1 SLO genérico "site availability 99.9%" cobrindo tudo — /admin, /api,
156
+ /checkout, /search, /docs com mesmo target
157
+
158
+ PROBLEMA: falha em /admin (uso 1×/dia por staff) não importa para customer;
159
+ falha em /checkout (uso 100×/min com revenue impact) é catastrófico;
160
+ mistura tudo no mesmo budget — alerts confusos, ações vagas; quando
161
+ burn dispara, time não sabe o que priorizar.
162
+
163
+ CERTO: 1 SLO por jornada crítica do user (`checkout_success: 99.9%`,
164
+ `login_success: 99.95%`, `search_p95: 99% < 200ms`); cada um com target
165
+ apropriado ao seu risk; admin/docs SEM SLO formal (só metric informativo).
166
+ ```
167
+
168
+ ### ANTI: budget como score de "performance"
169
+
170
+ ```text
171
+ ANTI: celebrar "atingimos SLO 99.99% este mês!" como vitória; KPIs comparam
172
+ times por % budget intacto; pressão de leadership para subir target
173
+
174
+ PROBLEMA: budget vira métrica de vaidade; budget intacto significa SUBUTILIZAÇÃO
175
+ (não shippamos suficientes deploys arriscados/experimentos); leadership
176
+ pressiona por mais features sem reconhecer trade-off; quando budget
177
+ esgota uma vez, vira "fracasso" — time esconde problemas no próximo mês.
178
+
179
+ CERTO: budget é orçamento — gastá-lo é OK e esperado. KPI é "shippamos N deploys
180
+ de valor sem queimar budget", não "budget alto". Budget esgotado = sinal
181
+ de aprender (quais releases custaram caro?), não punição.
182
+ ```
183
+
184
+ ### ANTI: SLA == SLO
185
+
186
+ ```text
187
+ ANTI: usar SLA do contrato (99.9%) como SLO interno — "se prometemos 99.9% no
188
+ contrato, basta atingir 99.9% internamente"
189
+
190
+ PROBLEMA: 0 margem de segurança entre compromisso comercial e meta interna;
191
+ primeira anomalia operacional quebra contrato; sem buffer para reagir;
192
+ SEV1 vira liability legal; cliente perde confiança no primeiro burn.
193
+
194
+ CERTO: SLO interno mais rígido que SLA externo — fator de margem 5×.
195
+ SLA externo: 99.9% (compromisso ao cliente);
196
+ SLO interno: 99.95% (meta de engenharia com folga para reagir).
197
+ ```
198
+
199
+ ## Verificação
200
+
201
+ Antes de marcar SLO target como decidido:
202
+
203
+ 1. **Target justificado por customer perception** — não "queremos 99.99%" mas "usuário em smartphone percebe falha acima de X%"
204
+ 2. **Target ≤ 99.95%** OU passou checklist de 99.99%+ (ver Pattern: justificar 99.99%+ excepcional)
205
+ 3. **Tier-aware** — diferentes targets para `customer.tier` quando aplicável (enterprise/pro/free)
206
+ 4. **Budget policy documentada** — 4 estados (green/yellow/red/exhausted) com ações claras
207
+ 5. **Owner nomeado** — SLO sem dono = sem ação = sem valor
208
+ 6. **SLI customer-facing** — mede o que cliente sente, não estado interno
209
+ 7. **SLA externo > SLO interno** — margem entre compromisso comercial e meta interna
210
+
211
+ ## Ver também
212
+
213
+ - [`_shared-sre/glossary.md`](../_shared-sre/glossary.md) — termos canônicos risk continuum, error budget, MTTR/MTBF
214
+ - [`event-based-slos`](../event-based-slos/SKILL.md) (v1.9) — definir SLO event-based com sliding window
215
+ - [`burn-rate-alerting`](../burn-rate-alerting/SKILL.md) (v1.9) — alertas predictive sobre error budget
216
+ - [`production-readiness-review`](../production-readiness-review/SKILL.md) — PRR axis "Performance" usa risk continuum
217
+ - [`blameless-postmortems`](../blameless-postmortems/SKILL.md) — postmortem documenta budget consumido
218
+
219
+ ---
220
+
221
+ *Material-fonte: Site Reliability Engineering — Beyer, Jones, Petoff, Murphy (Google/O'Reilly, 2016) — Cap 3: "Embracing Risk".*