fix(dns): a lista dizia PENDING, nunca verificado, com tudo verificado
O crocha na lista de dominios lia-se da coluna dns_status, e nada lhe escrevia depois do onboarding. A verificacao corre no servico de protocolos, que tem o resolvedor, e a resposta ia directa para o browser sem ficar registada -- por isso um dominio com 13 de 13 registos publicados e a resolver continuava listado como PENDING, ultima verificacao "Nunca", ao lado da pagina que dizia o contrario. Quem verificou passa a escrever o que encontrou. Falhar a gravar nao transforma uma verificacao boa num erro para o operador: fica no log. A coluna aceita apenas PENDING, VERIFIED, PARTIAL, DRIFT e ERROR, e o verificador tambem diz MISSING e UNKNOWN. Escrever qualquer uma dessas violava a check constraint, a actualizacao era rejeitada e o crocha ficava velo na mesma -- exactamente o sintoma que isto vem corrigir. Ha um teste so para essa traducao. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
47c3700380
commit
9689f26dda
6 files changed
+139
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package postgres
|
||||
|
||||
import "testing"
|
||||
|
||||
// dns_status is constrained by the schema to a fixed set. The verifier answers
|
||||
// with a wider vocabulary, and writing one of the extra words fails the check
|
||||
// constraint - the update is rejected and the console goes on showing the
|
||||
// stale badge this was written to fix.
|
||||
func TestColumnStatus_OnlyEverProducesAcceptedValues(t *testing.T) {
|
||||
allowed := map[string]bool{
|
||||
"PENDING": true, "VERIFIED": true, "PARTIAL": true, "DRIFT": true, "ERROR": true,
|
||||
}
|
||||
|
||||
for _, in := range []string{"VERIFIED", "PARTIAL", "MISSING", "UNKNOWN", "", "something new"} {
|
||||
got := columnStatus(in)
|
||||
if !allowed[got] {
|
||||
t.Errorf("columnStatus(%q) = %q, which the check constraint rejects", in, got)
|
||||
}
|
||||
}
|
||||
|
||||
if got := columnStatus("MISSING"); got != "ERROR" {
|
||||
t.Errorf("MISSING became %q; nothing resolved, so it is an error, not a pending check", got)
|
||||
}
|
||||
if got := columnStatus("VERIFIED"); got != "VERIFIED" {
|
||||
t.Errorf("VERIFIED became %q", got)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user