vote-tally: date_order_mismatches compares ISO dates as text, so UTC offsets are misread

Aperta Adatta ai principianti
#2,240 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@leninworld ci sta già lavorando.

Dal 23/11/2026.

  • #2241 di @leninworld — aperta

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
python
Ambito
tooling

Direzione di ricerca

Inizia in tools/release-management/src/release_management/vote_tally/tally.py, in tally(), al confronto str(after) < str(before), e leggi come parse_roster e i dict dei voti forniscono i valori date come stringhe. Esegui lo script di riproduzione indicato nell’issue con uv run --project tools/release-management python repro.py, poi analizza entrambe le date in istanti con fuso orario (ad es. datetime.fromisoformat) prima di confrontare. Applica la stessa correzione alla copia sotto plugins/magpie-security-tools/tools/release-management/ così che le due restino sincronizzate. Fatto significa che il primo campione è elencato in date_order_mismatches e il secondo no.

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

Descrizione

What's broken

vote-tally tally decides whether a changed vote's date "runs backwards" against thread order by comparing the two ISO-8601 date strings as text. When the dates carry different UTC offsets, date_order_mismatches misses a real backwards date and flags a date that is in order.

Which layer

tools/release-management/src/release_management/vote_tally/tally.py, in tally(): if before and after and str(after) < str(before): (plus the plugin copy under plugins/magpie-security-tools/tools/release-management/).

How to reproduce
from release_management.vote_tally.tally import parse_roster, tally

roster = parse_roster("| Apache ID | Primary email |\n|---|---|\n| alice | [email protected] |")

def mismatches(first, second):
    votes = [
        {"from": "[email protected]", "date": first, "value": "-1"},
        {"from": "[email protected]", "date": second, "value": "+1"},
    ]
    return tally(votes, roster, {}, False, "dev-list-vote")["date_order_mismatches"]

print(mismatches("2026-06-11T09:00:00Z", "2026-06-11T10:30:00+02:00"))  # 08:30Z, earlier: prints []
print(mismatches("2026-06-11T09:00:00+02:00", "2026-06-11T08:00:00Z"))  # 07:00Z then 08:00Z, in order: flagged

Run with uv run --project tools/release-management python repro.py.

Expected vs actual

superseded-votes.md says: "A vote whose date runs backwards against thread order is listed in date_order_mismatches". The vote-tally SKILL.md passes date as <ISO-8601>, and vote replies come from senders in different time zones.

Expected: the two dates are compared as instants, so the first case is listed and the second is not.
Actual: the first case returns [], and the second lists a mismatch whose later vote is 1 hour after the earlier one.

The counted vote is not affected (thread order decides it); only the RM-facing date_order_mismatches report is wrong.

Surface area (optional)

Only this comparison. pr_review_votes also compares submittedAt as text, but GitHub always returns UTC Z timestamps there, so it is not affected.

Lingua principale
Python
Stelle
152
Fork
133
Merge medio
12h 39m
PR unite (30g)
384

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 apache/magpie

Tutte le issue di apache/magpie

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.