Skip to content

ChallengeAdminManager

Handles admin operations for challenges: reset, force pass, force fail, and audit logging.

Purpose

ChallengeAdminManager provides privileged operations for administrators to manage user challenges. All actions are logged with before/after state snapshots to the admin_actions table for audit purposes.

It delegates challenge state management to ChallengeManager (via reloadChallenge()) after modifying the SQLite rows directly, ensuring the in-memory state stays consistent.

Edge Cases & Error Handling

  • Cannot reset a PASSED challenge (passing is final).
  • Can reset FAILED challenges (admin second chance).
  • Force pass bypasses criteria -- no profit/consistency/days validation.
  • Failure reason prefixed with [ADMIN] to distinguish from system failures.
  • All actions capture before/after state for full audit trail.
  • Reset creates a completely new account (new accountId) with fresh balance.

See Also