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

オープン
#1,946 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
HTML
スター
33
フォーク
107
平均マージ
14時間 6分
マージ済み PR(30日)
19

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

USRSE/usrse.github.io のほかの issue

USRSE/usrse.github.io の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。