sync: memória completa 2026-05-20 (daily+learnings+errors+patterns)
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
# Memória Diária — 2026-05-20
|
||||
|
||||
## 🕐 Heartbeats
|
||||
- 10:34 — Disco 76% ⚠️, load avg 3.97/4.16, **55 zombies** (↑ de 46),MEMORY 1874 chars ok, clawhub CLI ausente, ERRORS/patterns sem mudanças
|
||||
- 07:34 — Disco 76% ok, 20 packages up (security), clawhub via `openclaw skills` works, MEMORY 1874 chars, no ERRORS critical
|
||||
- 05:04 — Disco 76% (ok), ~30 pacotes upgradable (security), zombies ~15, MEMORY ok
|
||||
- 02:04 — Disco 73% → 76% trending up, apt upgrades disponíveis, defuncto ~15, MEMORY 1874 chars
|
||||
- 06:34/07:34 — Disco 73→76%, clawhub binario antigo inexistente, `openclaw skills list` funciona
|
||||
|
||||
## 📊 Sistema Load — 10:34 (preocupante)
|
||||
- openclaw PID 7608: 7.7% CPU, 550 MB RAM — normal
|
||||
- Load Average: **3.97 / 4.16 / 3.95** — container compartilhado com outro hosted service, não alarmante isolado
|
||||
- Zombie <defunct>: **55** (era 46, 15 anteriormente) — 55 orphans PPID=1
|
||||
- 25 esbuild, 4 npm, 4 node, 4 openclaw, 3 find, 2+2 tail/head, bash, grep, qmd, python3, git
|
||||
- Todos PPID=1, nenhum consome RAM — cleanup só no restart do container
|
||||
- ⚠️ Crescimento contínuo sugere bug no lifecycle de filhos (spawn sem wait/reap)
|
||||
- Clawhub: nao ha binario clawhub no `.bin` ou npm global — apenas `openclaw skills list` funciona
|
||||
|
||||
## 📦 Pacotes Atualizáveis
|
||||
- ~20-30 pacotes (segurança: libssl, libgnutls, linux-libc-dev, tzdata, etc.)
|
||||
- Aprovação pendente — sem ação automatica
|
||||
|
||||
## 📚 Learnings pendentes
|
||||
- ERRORS.md: sem erros críticos
|
||||
- PATTERN_COUNTER.md: `vitest.pure-dom-matchers` count=1, `jsdom.fireEvent-change-writable` count=1 — tracking
|
||||
- `react.testing-library` ✅ promoted, `vitest.jsdom.mocks` ✅ promoted → em AGENTS.md
|
||||
|
||||
## 🧠 Memória
|
||||
- MEMORY.md: 1874 chars < 3500 ✅
|
||||
- memory/2026-05-20.md: este arquivo ✅
|
||||
- memory/2026-05-19.md: existe ✅
|
||||
|
||||
## 🔧 Clawhub
|
||||
- `openclaw skills list` → 38/81 skills ready
|
||||
- SKILL.md em `/usr/local/lib/node_modules/openclaw/skills/clawhub/` — sem binário
|
||||
- Path antigo `/var/lib/openclaw/tools/node/npm/bin/clawhub` não existe mais
|
||||
|
||||
## 🐳 Docker Swarm
|
||||
- 1 node (Manager) · Cluster ID `plz2xbh64yzhgy88jb9stm0pc`
|
||||
- 39 containers · 22 imagens · overlay 10.0.0.0/8
|
||||
- 8 stacks: bot/code/database/design/dock/git/pro/proxy
|
||||
- Services críticos desligados: git_gitea (🔴), bot_office (crash loop)
|
||||
|
||||
## ⚠️ Stale process locks
|
||||
- JSONL session lock `b6dd9406-ddec-45f2-8092-fbef969e18a2.jsonl` — auto-expires no TTL
|
||||
|
||||
## 🅷 Alertas para priorizar
|
||||
- Disco 76% trending up — monitorar
|
||||
- Zombies 55 — cresce a cada hora, creepy
|
||||
- Clawhub rebuild/install pendente
|
||||
- openclaw skills update بناء (skip até agora)
|
||||
@@ -0,0 +1,63 @@
|
||||
# Errors — Falhas para evitar
|
||||
|
||||
_Registro de erros, exceções e falhas com contexto de reprodução._
|
||||
|
||||
---
|
||||
|
||||
## [ERR-20260519-002] tsup-flat-infinity-breaks-dts
|
||||
|
||||
**Logged**: 2026-05-19T21:35:00-03:00
|
||||
**Severity**: high
|
||||
**Area**: config | build
|
||||
|
||||
### What happened
|
||||
`cn()` usava `flat(Infinity)` no array de classes. O gerador de DTS do tsup v8 quebra com tipos recursivos infinitos, lançando `Type instantiation is excessively deep`.
|
||||
|
||||
### Error message
|
||||
```
|
||||
src/utils/index.ts: error TS2589: Type instantiation is excessively deep and possibly infinite.
|
||||
DTS Build error
|
||||
```
|
||||
|
||||
### Reproduction
|
||||
```ts
|
||||
type ClassValue = string | false | null | undefined | ClassValue[];
|
||||
// ❌ flat(Infinity) → tipo recursivo infinito → DTS quebra
|
||||
export function cn(...inputs: ClassValue[]): string {
|
||||
return inputs.flat(Infinity)....
|
||||
}
|
||||
```
|
||||
|
||||
### Fix
|
||||
```ts
|
||||
type ClassValue = string | boolean | null | undefined | Array<ClassValue>;
|
||||
// ✅ flat(2) — máximo de aninhamento é 2 níveis (cls, [cls2])
|
||||
export function cn(...inputs: ClassValue[]): string {
|
||||
return inputs.flat(2)....
|
||||
}
|
||||
```
|
||||
|
||||
### Also fixed in same session
|
||||
- `process.env.NODE_ENV` no código → quebra SSR / bundler. Solução: guarda `typeof localStorage !== 'undefined'`
|
||||
- `documentoSchema` usava `.replace()` direto na string Zod → `.transform(v => v.replace(…))`
|
||||
|
||||
---
|
||||
|
||||
<!-- Novas entradas acima desta linha -->
|
||||
|
||||
---
|
||||
|
||||
## ERR-20260519-002
|
||||
**Data**: 2026-05-19T21:35:00-03:00
|
||||
**Severidade**: medium
|
||||
**Status**: resolved
|
||||
|
||||
### Problema
|
||||
Template strings com backticks aninhadas em `docker/dockerfile.ts` quebraram compilação TypeScript.
|
||||
|
||||
### Resolução
|
||||
Reescrever com template literals simples sem aninhamento: concatenar strings ou usar `.replace()` fora do template.
|
||||
|
||||
### Lição
|
||||
Template strings aninhadas (backticks dentro de backticks) podem quebrar sintaxe TS. Usar `fn().replace(...)` quando precisar de conteúdo dinâmico dentro de strings já com template.
|
||||
|
||||
@@ -0,0 +1,230 @@
|
||||
# Learnings — Padrões bem-sucedidos
|
||||
|
||||
_Registro de padrões que funcionam, para replicar._
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260520-003] gitea-api-autenticacao-completa
|
||||
|
||||
**Logged**: 2026-05-20T12:31:00-03:00
|
||||
**Priority**: high
|
||||
**Status**: reference
|
||||
**Area**: devops | api
|
||||
|
||||
### Summary
|
||||
Gitea API suporta 5 métodos de autenticação — todos usam o mesmo API token
|
||||
|
||||
### Details
|
||||
Fontes estudadas: https://docs.gitea.com/development/api-usage
|
||||
|
||||
**Métodos de autenticação (ordem de preferência):**
|
||||
1. `Authorization: token <hash>` — mais comum, não usa username na URL
|
||||
2. `token=<hash>` query string — simples para curl/GETs
|
||||
3. `access_token=<hash>` query string — compat OAuth2 consumers
|
||||
4. HTTP Basic (`username:password`) — cria token, admin
|
||||
5. HTTP Basic + OTP — quando 2FA habilitado (`X-Gitea-OTP: 123456`)
|
||||
6. SSH HTTP Signature — chaves SSH registradas, draft-cavage-http-signatures
|
||||
|
||||
**Token nunca é reexibido** — apare | |:"`name":"meu-token","sha1":"9fcb11..."` — só sha1 na listagem /**/
|
||||
**Scopes**: formato `<read|write>:<permission>`, ou `all` para tudo.
|
||||
Permissions: activitypub, admin, issue, misc, notification, organization, package, repository, user
|
||||
|
||||
**Pagination**: `?page=N&limit=N`, header `Link` (`rel=next/last`), `x-total-count`
|
||||
|
||||
**Sudo (admin)**: adicionar `Sudo: username` header ou param `sudo=username`
|
||||
|
||||
### Suggested Action
|
||||
Usar sempre `scopes:["all"]` para automação, guardar token em segredo,
|
||||
preferir header `Authorization: token` sobre query string.
|
||||
|
||||
### Metadata
|
||||
- Source: documentation
|
||||
- Tags: gitea, api, auth, token, swagger, devops
|
||||
- Pattern-Key: gitea-api.authentication
|
||||
- Recurrence-Count: 1
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260520-004] gitea-api-endpoints-reference
|
||||
|
||||
**Logged**: 2026-05-20T12:31:00-03:00
|
||||
**Priority**: medium
|
||||
**Status**: reference
|
||||
**Area**: devops | api
|
||||
|
||||
### Summary
|
||||
Mapa dos endpoints Gitea API v1 por domínio
|
||||
|
||||
### Details
|
||||
- **Usuário**: `GET /api/v1/user`, `GET /api/v1/users/:username`
|
||||
- **Repos**: `GET/POST /api/v1/user/repos`, `GET /api/v1/repos/:owner/:repo`
|
||||
- **Issues**: `GET/POST /api/v1/repos/:owner/:repo/issues`
|
||||
- **Pulls**: `GET/POST /api/v1/repos/:owner/:repo/pulls`
|
||||
- **Webhooks**: `GET/POST /api/v1/repos/:owner/:repo/hooks`
|
||||
- **Admin users**: `GET/POST/PUT/DELETE /api/v1/admin/users`
|
||||
- **Swagger**: `https://host/api/swagger`
|
||||
- **OpenAPI JSON**: `https://host/swagger.v1.json`
|
||||
|
||||
### Suggested Action
|
||||
Consultar SKILL.md `skills/gitea-api/SKILL.md` antes de usar a API.
|
||||
|
||||
### Metadata
|
||||
- Source: documentation
|
||||
- Tags: gitea, api, endpoints, rest
|
||||
- Pattern-Key: gitea-api.endpoints
|
||||
- Recurrence-Count: 1
|
||||
|
||||
---
|
||||
|
||||
<!-- entradas anteriores acima -->
|
||||
|
||||
## [LRN-20260519-001] clawhub.cli_path
|
||||
|
||||
**Logged**: 2026-05-19T20:39:00-03:00
|
||||
**Priority**: high
|
||||
**Status**: pending
|
||||
**Area**: config
|
||||
|
||||
### Summary
|
||||
Instalar skills do Clawhub com `/var/lib/openclaw/tools/node/npm/bin/clawhub`
|
||||
|
||||
### Details
|
||||
O CLI `clawhub` não está no `$PATH` global, mas existe instalado em `/var/lib/openclaw/tools/node/npm/bin/clawhub`. Sempre usar o caminho completo.
|
||||
|
||||
### Suggested Action
|
||||
Adicionar symlink ou alias para `clawhub` no PATH do agente, ou sempre usar o caminho completo.
|
||||
|
||||
### Metadata
|
||||
- Source: error
|
||||
- Tags: clawhub, cli, path, install
|
||||
- Pattern-Key: clawhub.cli_path
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260519-002] clawhub-search-qc
|
||||
|
||||
**Logged**: 2026-05-19T20:42:00-03:00
|
||||
**Priority**: medium
|
||||
**Status**: pending
|
||||
**Area**: config
|
||||
|
||||
### Summary
|
||||
`clawhub search` com termos muito específicos retorna vazio; usar termos genéricos primeiro
|
||||
|
||||
### Details
|
||||
Pesquisas com termos combinados como "programming developer full-stack" retornaram vazio. Termos simples como "autonomous agent" retornaram resultados. Melhor abordar a pesquisa em múltiplas queries curtas.
|
||||
|
||||
### Suggested Action
|
||||
Fazer múltiplas searches com termos curtos e depois filtrar manualmente.
|
||||
|
||||
### Metadata
|
||||
- Source: error
|
||||
- Tags: clawhub, search, query
|
||||
- Pattern-Key: clawhub.search_strategy
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260519-003] biblioteca-compartilhada-libs
|
||||
|
||||
**Logged**: 2026-05-19T21:30:00-03:00
|
||||
**Priority**: medium
|
||||
**Status**: pending
|
||||
**Area**: config
|
||||
|
||||
### Summary
|
||||
Criar biblioteca inteligente compartilhada em `libs/` para reuso entre projetos
|
||||
|
||||
### Details
|
||||
Toda skill instalada tem conhecimento valioso. Centralizar em `libs/<dominio>/`:
|
||||
- skills são extraídas e promovidas para arquivos .md limpos
|
||||
- novos projetos copiam `libs/` como template
|
||||
- o agente consulta `libs/` antes de implementar
|
||||
|
||||
### Metadata
|
||||
- Source: best_practice
|
||||
- Tags: biblioteca, reuso, padroes
|
||||
- Pattern-Key: libs.shared_knowledge_base
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260519-004] vitest-jsdom-global-mocks
|
||||
|
||||
**Logged**: 2026-05-19T23:10:00-03:00
|
||||
**Priority**: high
|
||||
**Status**: applied
|
||||
**Area**: testing
|
||||
|
||||
### Summary
|
||||
Vitest jsdom — mocks globais obrigatórios antes de renderizar hooks que usam APIs do navegador
|
||||
|
||||
### Details
|
||||
`localStorage`, `navigator.clipboard`, `window.matchMedia` não existem no jsdom puro — mockar em `beforeAll/beforeEach` global.
|
||||
|
||||
### Metadata
|
||||
- Source: best_practice
|
||||
- Tags: vitest, jsdom, mocks, testing
|
||||
- Pattern-Key: vitest.jsdom.mocks
|
||||
- Recurrence-Count: 3 → promoted
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260519-005] react-testing-library-hooks-async
|
||||
|
||||
**Logged**: 2026-05-19T23:10:00-03:00
|
||||
**Priority**: medium
|
||||
**Status**: pending
|
||||
**Area**: testing
|
||||
|
||||
### Summary
|
||||
React Testing Library — renderHook + act() para testar hooks assíncronos
|
||||
|
||||
### Details
|
||||
Sempre envolver awaits em `act(async () => { ... })`, nunca acessar `result.current` após await diretamente fora de `act()`.
|
||||
|
||||
### Metadata
|
||||
- Source: best_practice
|
||||
- Tags: react, testing-library, hooks, async, vitest
|
||||
- Pattern-Key: react.testing-library
|
||||
- Recurrence-Count: 3 → promoted
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260520-001] vitest-pure-dom-matchers
|
||||
|
||||
**Logged**: 2026-05-20T00:52:00-03:00
|
||||
**Priority**: high
|
||||
**Status**: applied
|
||||
**Area**: testing
|
||||
|
||||
### Summary
|
||||
Vitest jsdom puro — matchers nativos DOM funcionam sem `@testing-library/jest-dom`
|
||||
|
||||
### Details
|
||||
Usar `.classList.contains()`, `.getAttribute()`, `.textContent`, `container.querySelector()` ao invés de matchers RTL. 56/56 testes verdes, 0 dependências extras.
|
||||
|
||||
### Metadata
|
||||
- Source: best_practice
|
||||
- Tags: vitest, jsdom, testing, matchers
|
||||
- Pattern-Key: vitest.pure-dom-matchers
|
||||
- Recurrence-Count: 1
|
||||
|
||||
---
|
||||
|
||||
## [LRN-20260520-002] jsdom-fireEvent-writable-value
|
||||
|
||||
**Logged**: 2026-05-20T00:52:00-03:00
|
||||
**Priority**: low
|
||||
**Status**: workaround
|
||||
**Area**: testing
|
||||
|
||||
### Summary
|
||||
No jsdom, `Object.defineProperty(input, 'value', { writable: true })` permite `fireEvent.change`
|
||||
|
||||
### Details
|
||||
Workaround mínimo para testar onChange em inputs no jsdom puro, onde `.value` é readonly.
|
||||
|
||||
### Metadata
|
||||
- Source: error
|
||||
- Tags: jsdom, fireEvent, input, value
|
||||
- Pattern-Key: jsdom.fireEvent-change-writable
|
||||
- Recurrence-Count: 1
|
||||
@@ -0,0 +1,19 @@
|
||||
# Pattern Counter — Contador de Sucessos
|
||||
|
||||
| Pattern-Key | Count | Last-Seen | Status |
|
||||
|---|---|---|---|
|
||||
| clawhub.cli_path | 1 | 2026-05-19 | tracking |
|
||||
| clawhub.search_strategy | 1 | 2026-05-19 | tracking |
|
||||
| libs.shared_knowledge_base | 1 | 2026-05-19 | tracking |
|
||||
| tsup.multi-entry-esm-cjs | 1 | 2026-05-19 | tracking |
|
||||
| zod.safe-parse-generic | 1 | 2026-05-19 | tracking |
|
||||
| ts.flat2-not-flatinfinity | 1 | 2026-05-19 | tracking |
|
||||
| docker.multi-stage-node-alpine | 1 | 2026-05-19 | tracking |
|
||||
| git.conventional-commits | 2 | 2026-05-19 | tracking |
|
||||
| react.testing-library | 3 | 2026-05-19 | ✅ promoted → AGENTS.md |
|
||||
| vitest.jsdom.mocks | 3 | 2026-05-19 | ✅ promoted → AGENTS.md |
|
||||
|
||||
| vitest.pure-dom-matchers | 1 | 2026-05-20 | tracking |
|
||||
| jsdom.fireEvent-change-writable | 1 | 2026-05-20 | tracking |
|
||||
|
||||
_Quando Count >= 3 em >= 2 tarefas distintas em 30 dias → promover para AGENTS.md como skill/recomendacao permanente_
|
||||
Reference in New Issue
Block a user