bench/load: B/P phase mismatch reasons come out in map order, so accounting reasons and error text vary between runs

Aperta Adatta ai principianti
#1,643 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
79/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Leggi bench/load/edit_probe_evidence.go e segui come i motivi delle discrepanze vengono uniti nel testo dell'errore in edit_probe_run.go. Aggiungi un test usando una ricevuta con almeno tre giri P diversi; ripeti il controllo e verifica i motivi delle discrepanze ordinati e il testo dell'errore risultante dall'unione. Il lavoro è completato quando il test passa in modo costante e i golden file dei report restano invariati.

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

Descrizione

bug ci-tests

Follow-up from the review of #1633 (closes #1632). The behaviour predates that PR and is on main. It does not block a release.

Symptom

checkEditProbeAccountingWithWaitDisposition (bench/load/edit_probe_evidence.go) compares every measured P lap with the same lap in B:

for name, value := range pPhases {
	if value != nil && fmt.Sprint(value) != fmt.Sprint(bPhases[name]) {
		fail("B/P phase mismatch: " + name)
	}
}

pPhases is a map[string]any. When more than one lap differs, the B/P phase mismatch: <lap> reasons come out in Go's randomized map iteration order. On identical input this changes:

  • the order of the edit record's accounting.reasons;
  • the A/P/B accounting unavailable: ... error text. That text is strings.Join(reasons, "; "), built in edit_probe_run.go and in the coalesced, native no-op and functional-unavailable receipt paths.

Unaffected: verdicts and counts. The accounting state depends on whether any reason exists, not on the order of the reasons.

Affected:

  • byte-level comparison of two reports;
  • replay diffs;
  • any test that compares a whole reasons slice with DeepEqual.

Observed: we replayed one set of captured receipts twice through the same commit. The two sets of records differed only in the order of these reasons, on two polls. The tests added in #1633 are not exposed today, because their receipt fixtures carry null P laps and so never produce this reason.

Fix

Iterate the lap names in sorted order (for example slices.Sorted(maps.Keys(pPhases))), so the reasons and the joined error text are deterministic.

Optional, in the same function: the shared_owner_accounting_v* scan (for name := range status, which returns on the first match) names an arbitrary key when a status carries more than one such key. Sorting the keys there too would make that reason deterministic as well.

Done when
  • A test feeds a receipt in which at least three P laps differ from B. It asserts the exact sorted B/P phase mismatch: reasons and the joined A/P/B accounting unavailable: text. It repeats the check enough times (for example 20 iterations) that map order would show.
  • Report goldens are unchanged.

Refs #1005, #1632, #1633

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.