Skip to content

Proof committed but verification enqueue fails can leave an orphaned PENDING proof with no recovery #79

Description

@cybermax4200

Why this matters now: Another path to permanently-stuck proofs (see also #5), this one from the success-path's own rollback.

Problem / What: In submitProof (proofController.ts:197-228), after the proof is committed (201), enqueueVerification is called. If it throws, the controller tries to delete the proof+photos in a transaction; if that rollback also fails (logged, line 219-225), the proof remains PENDING forever with no worker and no sweeper to recover it. There is no periodic "PENDING proofs older than N with no verification job" sweeper.

Key Challenges: Adding a recovery sweeper (or making the proof creation itself enqueue-via-outbox atomic), and defining the max age after which a PENDING proof is auto-escalated/rejected.

Acceptance Criteria:

  • A PENDING proof with no corresponding verification job is detected and routed to resolution within a bounded time (test).
  • The rollback-failure path is covered so no proof is silently orphaned.

Relevant files/functions: src/controllers/proofController.ts:197-236, src/workers/verificationWorker.ts:enqueueVerification, src/services/taskService.ts (sweeper home).

Out of scope: Re-architecting submitProof into saga.

Labels: advanced, reliability, bug

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions