indexer tests: no test pins recordCheckoutPublication's completion bound (cycle start after completion)

Aperta Adatta ai principianti
#1,657 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go
Ambito
testing

Direzione di ricerca

Leggi TestOwedEditCycleWindowOnACoarseClock e owedCycleWindowRefusal in internal/indexer/checkout_edit_path_test.go, quindi esamina recordCheckoutPublication in internal/indexer/checkout_receipt_accounting.go. Aggiungi una riga di test con inizio e disponibilità a 80 ms e completamento a 70 ms; dovrebbe essere rifiutata perché P non identifica il ciclo di aggiornamento del checkout. Conferma che il test fallisce se viene rimosso il limite di completamento.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ci-tests worktrees

Follow-up from the review of #1647 (for #1646). This is a test gap, not a product defect: the product enforces the bound today, but no test would notice if it stopped.

Symptom

PublicationPhaseRecord.recordCheckoutPublication records the P window only when origin <= cycleStarted <= completed. No test in the repo pins the upper bound, cycleStarted <= completed.

  • A mutation that drops !completed.Before(cycleStarted) from that condition passes every repo test: the checkout edit-path integration test, TestOwedEditCycleWindowOnACoarseClock, the receipt-accounting tests and the publication-tier test.
  • Under that mutation, the record accepts a checkout refresh cycle that starts after its ticket completed, and reports a P window that does not lie inside the ticket's life.
  • The test helper owedCycleWindowRefusal does not refuse cycle_started > ticket_completed itself either. It refuses only a cycle that starts before the enqueue, a missing mark, a P that does not name the checkout refresh cycle, and a wall time that does not match.
  • The predicate the test used before #1647 had the same gap.
Where
  • internal/indexer/checkout_receipt_accounting.go: PublicationPhaseRecord.recordCheckoutPublication.
  • internal/indexer/checkout_edit_path_test.go: TestOwedEditCycleWindowOnACoarseClock and owedCycleWindowRefusal (both added by #1647).
Evidence
  • A probe recorded a cycle start at 80 ms after a completion at 70 ms. With the product as it is, the record keeps no P and the helper refuses with "P does not name the checkout refresh cycle". With the mutation, the record accepts it.
  • So today the guarantee comes from the product's bound plus a monotonic clock, not from any test.
Fix direction

Either of these:

  1. Add one refused row to TestOwedEditCycleWindowOnACoarseClock: started: 80ms, served: 80ms, completed: 70ms, refused with "P does not name the checkout refresh cycle".
  2. Or add a completed < started refusal to owedCycleWindowRefusal, with its own reason, and a row that exercises it.

The first is enough to kill the mutation. It is one row in a test file that #1647 adds, so do it after #1647 merges, or in that PR if it gets another push.

Done when
  • Dropping the completion bound from recordCheckoutPublication fails a repo test.

Refs #1646, #1647

Lingua principale
Go
Stelle
1.9k
Fork
171
Merge medio
12h 43m
PR unite (30g)
347

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zzet/gortex

Tutte le issue di zzet/gortex

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.