Pular para o conteúdo
EN · PT

Gate: mock-detect-covers-dialect

The project declares derived.mock_detect — the regex that recognises a test double in this ecosystem.

Propriedade Valor
Julgamento uma IA ou uma pessoa responde a pergunta abaixo, via anchors judge
Confronta test
Bloqueante por padrão — projeto novo sim
Bloqueante por padrão — projeto existente não — informa
Pressupõe derived.mock_detect — enquanto não forem declarados no anchors.yaml, o gate fica pendente e não cobra nada

The project declares derived.mock_detect — the regex that recognises a test double in this ecosystem. Read this test file and answer: does the declared pattern reach EVERY form of double it uses? Fail it if there is a double the regex does not match (another function, another dialect, a decorator instead of a call, a whole-module double vs a member double). A regex that matches nothing makes the mock-stamped gate report green without having checked anything. When failing it, PROPOSE the corrected pattern as a patch of anchors.yaml. BEFORE ANSWERING, check whether this unit declares @TBD for the piece this question asks about (@TBD: code, @TBD: code,test, …). If it does, the test does NOT exist yet by a recorded decision, and there is nothing to confront: answer waived, naming the absence (“the spec declares @TBD for this piece and it does not exist in the repository”). Do NOT answer pass — pass is a statement ABOUT the test, and without the test it states what nobody verified; the stamp stays in the map looking like real verification. Also check that the @TBD is TRUE: if the piece already exists in the repository, the marker is stale, the judgment is due as usual, and the stale declaration is a finding — while it stays there, every gate that reads it waives what it should demand.

gates:
- name: mock-detect-covers-dialect
on: [test]
measures: judgment

Avalia se a regex declarada para detectar dublês alcança todas as formas que o projeto usa.

Em termos simples: este gate garante que o seu software não cometa erros por descuido ou falta de sincronização. Se você ou uma inteligência artificial alterar um arquivo coberto por este gate, ele inspeciona o trabalho imediatamente.


Se a regex de mock-detect falhar, dublês passam sem validação de contrato.

Sem este gate ativo, esse tipo de defeito passa despercebido pelos testes comuns e só estoura em produção ou durante refatorações dolorosas semanas depois.


Pergunta ao modelo se existem padrões de mock no repositório que escaparam da regex configurada.

  • ✓ Pass (Aprovado): Veredito pass emitido por julgamento.
  • ✗ Fail (Reprovado): Veredito fail acusando padrões de mock não cobertos.
  • ~ Indeterminado/Pending: Julgamento não registrado.
  • Skip (Dispensado): Não se aplica.

Para ativar este gate no seu projeto, adicione o bloco abaixo na seção gates: do seu anchors.yaml:

gates:
- name: mock-detect-cobre-o-dialeto
on: [test]
ask: "o padrão de detecção de mocks alcança todas as formas usadas no repositório?"
blocking: false

  • Quando ativar: Informativo; avalie periodicamente com anchors judge.
  • Fase de execução: Configure em when: [pre-commit, ci] para verificações rápidas, ou when: [pre-push, ci] para gates que rodam ferramentas mais pesadas.
  • Transição de maturidade: Comece com blocking: false para avaliar o estado atual do repositório com anchors check. Quando zerar as ocorrências, altere para blocking: true.

Se o anchors check acusar falha (✗) neste gate:

  1. Ajuste o regex mock_detect no anchors.yaml e emita novo veredito.
  2. Reexecute a verificação no terminal:
    Terminal window
    anchors check
  3. Se o gate suportar correção automática, você pode tentar o comando:
    Terminal window
    anchors check --fix