feat(elections): audit log and election lifecycle state machine

Đang mở
#1,946 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
35/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi

Hướng nghiên cứu

Start by reviewing the dependent schema and admin UI issues, then read docs/elections/lifecycle.md. Map the requested lifecycle, guardrails, scheduled close, audit viewer, CSV export, and admin mutation coverage before implementation. Done means all listed transitions and audit requirements are covered, with lifecycle documentation updated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Summary

Formalize the election lifecycle (draft → open → closed → published) as an explicit state machine, and make every admin-originated state change visible in an immutable audit log.

Part of #1933.

Requirements

  • State transitions: `draft → open`, `open → closed`, `closed → published`; enforce in Convex mutations — no back-transitions
  • Guardrails on opening: no open if races are empty, if voter roll is empty, or if opensAt/closesAt are missing
  • Auto-transition `open → closed` via scheduled Convex job at `closesAt`
  • Audit-log viewer in admin UI: filter by election, actor, action type
  • Audit entries are append-only; no delete or edit mutation exists for `auditLog`
  • Every admin mutation (election create/edit, race edit, voter import, token regen, email send, status change) writes an audit row with actor email, action, metadata, timestamp
  • Export audit log to CSV for post-election records
  • Document the state machine in `docs/elections/lifecycle.md`

Context

  • Epic: #1933
  • Depends on schema issue and admin UI issue
  • This is the last piece of the trust story — with ballot secrecy on one side and a full audit trail on the other, the election is both private to voters and accountable to observers.

Implementation notes

  • Model state transitions with a small XState machine or a typed discriminated union of transitions — either is fine; prefer whichever is simpler to read
  • Scheduled close job: Convex cron or scheduled action; idempotent so it can safely re-run
Ngôn ngữ chính
HTML
Star
33
Fork
107
Merge trung bình
14 giờ 6 phút
Pull request đã merge (30 ngày)
19

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của USRSE/usrse.github.io

Tất cả issue của USRSE/usrse.github.io

Issue tương tự

Thêm issue về Backend & API Design

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.