fix(gate): seleção e2e contendo apenas o spec setup vira none (setup é dev-only; OPS39)

This commit is contained in:
Francisco Solla 2026-08-11 15:23:50 -03:00
parent 2fec6a407e
commit 21b4b4d0c6
3 changed files with 43 additions and 1 deletions

View file

@ -64,8 +64,20 @@ webServer `waitOn` prewarm
- Medição sob load ≥40 é cara: mitigação — verificação local direcionada
(workers ≥2, setup primeiro), sem CI novo.
## Desvio da intenção (aprovado 2026-08-11)
A intenção dizia "sem mudança de asserções ou de CI", mas o gate:ci falhou com
"No tests found" — **falha pré-existente do classificador** (OPS39 é a primeira
PR setup-only): o `setup` só existe em dev mode (projeto dropado sob `CI=1`,
playwright.config.ts OPS34), e `selectE2eSpecs` o selecionava sozinho para o
e2e prod-mode. Fix no dono (`scripts/lib/test-affected-core.mjs`): seleção
contendo **apenas** `setup` → `mode: 'none'` (spec dev-only; sets mistos seguem
inalterados — o spec simplesmente não casa projeto). 2 testes de unidade novos
em `tests/unit/testAffected.unit.spec.ts`.
## Aceite de engenharia
- [x] Aceite de produto da intenção ainda coberto
- [x] Invariantes AGENTS/engineering-standards (nenhum código runtime tocado)
- [x] Testes de domínio previstos (unit/int): não se aplica — mudança só em spec e2e
- [x] Testes de domínio previstos (unit/int): 2 unit novos no classificador
(`testAffected.unit.spec.ts`); runtime intocado

View file

@ -232,6 +232,20 @@ export function selectE2eSpecs(files, manifest) {
unmapped,
}
}
// The `setup` spec is dev-mode-only: the setup project is dropped under
// CI/prod (playwright.config.ts), so a selection containing ONLY it would
// run `playwright test -- tests/e2e/setup.e2e.spec.ts` against zero projects
// and fail with "No tests found" (OPS39 — first setup-only PR hit it). In a
// mixed set the spec is harmless (it just matches no project), so only the
// setup-only case drops out.
if (specs.size === 1 && specs.has('setup')) {
return {
mode: 'none',
specs: [],
reason: 'setup spec is dev-mode-only; prod-mode e2e cannot run it',
unmapped,
}
}
return {
mode: 'selected',
specs: [...specs].sort(),

View file

@ -136,6 +136,22 @@ describe('selectE2eSpecs (OPS5)', () => {
const result = selectE2eSpecs([changed('docs/AGENT-OPS.md')], manifest)
expect(result).toMatchObject({ mode: 'none', specs: [], unmapped: [] })
})
it('drops a setup-only selection (setup runs only in dev mode, OPS39)', () => {
const result = selectE2eSpecs([changed('tests/e2e/setup.e2e.spec.ts')], manifest)
expect(result).toMatchObject({ mode: 'none', specs: [], unmapped: [] })
expect(result.reason).toContain('dev-mode-only')
})
it('keeps setup in a mixed selection (it matches no project, harmless)', () => {
const result = selectE2eSpecs(
[changed('tests/e2e/setup.e2e.spec.ts'), changed('src/app/(payload)/api/x.ts')],
manifest,
)
expect(result.mode).toBe('selected')
expect(result.specs).toContain('setup')
expect(result.specs).toContain('admin')
})
})
describe('e2eShardConfig (OPS34)', () => {