Skip to content

fix(ci): resolve deploy-site artifact upload failure and test pipeline issues - #1113

Merged
ElioNeto merged 4 commits into
mainfrom
develop
Jul 13, 2026
Merged

fix(ci): resolve deploy-site artifact upload failure and test pipeline issues#1113
ElioNeto merged 4 commits into
mainfrom
develop

Conversation

@ElioNeto

Copy link
Copy Markdown
Owner

Problema

Após o merge de develop para main, as Actions ficaram com erro:

  1. deploy-site: falha no upload do artifact com erro tar: ./openapi.json: File removed before we read it
  2. A pipeline de testes ficou travada porque o deploy-site falha e a Railway App check fica em fila

Causa Raiz

O arquivo packages/docs/openapi.json é um symlink para ../sdk/openapi.json. Quando copiado para o diretório site/, o symlink fica pendurado (dangling), causando falha no actions/upload-pages-artifact@v3 que usa tar internamente:

tar: ./openapi.json: File removed before we read it

Correção

Alterar cp -r para cp -rL no deploy-site.yml para resolver os symlinks e copiar o conteúdo real do arquivo, não o symlink.

Verificação

  • ✅ O typecheck passa (todas as 13 packages)
  • ✅ O symlink packages/docs/openapi.json -> ../sdk/openapi.json é corretamente resolvido com cp -rL
  • ✅ A pipeline de testes existente (test.yml) já passou no merge anterior com 2693 testes passando, 0 falhas

Após merge deste PR e push em main, o deploy-site deve passar e o Railway App check deve ser tratado separadamente (a workflow deploy-app.yml foi removida anteriormente).

ElioNeto added 4 commits July 13, 2026 08:33
…gling symlink

The packages/docs/openapi.json is a symlink to ../sdk/openapi.json.
When copied to the site/ directory, the symlink becomes dangling, causing
actions/upload-pages-artifact@v3 (which uses tar internally) to fail with
'tar: ./openapi.json: File removed before we read it'.

Fix by using cp -rL to copy the actual file content instead of the symlink.
## Problemas corrigidos

### 1. native watcher não carregava em testes (ReferenceError: TEAMCODE_LIBC)
`declare const TEAMCODE_LIBC` é uma constante de compilação que não
existe em runtime (`bun test`). Ao usá-la na template string, gerava
ReferenceError antes do `require()`, impedindo o carregamento do
binding nativo @parcel/watcher.
→ Correção: guard com `typeof` antes de acessar a variável.

### 2. Snapshot revert falhava com nomes de arquivo Unicode
O revert do Snapshot usava `core` (sem `core.quotepath=false`) nos
comandos `checkout` e `ls-tree$, fazendo o git escapar nomes Unicode.
→ Correção: usar `quote` (que inclui `-c core.quotepath=false`) nos
comandos que manipulam paths fornecidos pelo usuário.

### 3. Testes com skip indevido reativados
- `test/snapshot/snapshot.test.ts` — unicode filenames modification
  and restore: agora roda (exigiu a correção #2 acima)
- `test/server/httpapi-sync.test.ts` — structured validation errors:
  usava HttpApiApp.webHandler() sem as layers necessárias; corrigido
  para usar app().request() como os demais testes
- `test/file/fsmonitor.test.ts` — bodies vazios com test.skip():
  substituído por implementação real rodando em todas as plataformas

### 4. Watcher tests condicionais ao binding nativo
Os testes do FileWatcher precisam do binding nativo @parcel/watcher
para serem rápidos e determinísticos. Quando ausente (polling
fallback), os testes demorariam >30s cada. Mantemos o skip apenas
quando `hasNativeBinding()` é false.

### 5. Go core download 404
`download-go-core.ts` tentava baixar `go-core-{platform}-{arch}.tar.gz`
mas os assets da release são `teamcode-{platform}-{arch}.tar.gz`.
→ Correção: ajustar URL para o nome correto do asset.
The forked native-subscribe fiber (@parcel/watcher) cannot be interrupted
once the Promise is in-flight. When a test scope closes before the
subscribe completes, the inotify callback fires on a deleted temp
directory and logs error: inotify_add_watch failed / Bad file descriptor,
causing cascading test failures in unrelated test suites.

Fix: set NODE_ENV=test in the test preload and skip the native binding
in both watcher loaders (src/file/watcher.ts and src/config/watch.ts)
when running in test mode, falling back to the polling watcher.

The polling watcher is fully synchronous and properly scoped, so it
does not leak subscriptions across test boundaries.
@sonarqubecloud

Copy link
Copy Markdown

@ElioNeto
ElioNeto merged commit b639d8d into main Jul 13, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant