Skip to content

fix(purchase): the fire sweep overwrites approved_by with "scheduler" #1589

Closed

Description

@IAmJSD

FireScheduledDelayedPurchases (internal/purchase/scheduled_fire.go) stamps ApprovedBy = "scheduler" when it fires a delayed purchase, replacing the email of the person who approved it. Every delayed approval (purchase_delay_hours > 0) loses its approver in purchase_executions and in what History shows. #1580 turned the sweep on by default, so this now happens on every install that sets a delay. The migrated default is 0, which executes approvals immediately and isn't affected.

Fix: keep the approver's identity in approved_by and record that the scheduler fired it in a separate field or audit event. Add a test that fires a delayed approval and checks the approver is kept.

Found in review of #1580. The behavior predates #1580.

Activity

  1. cristim commented on Nov 4, 2026

    @cristim
    Member

    Claimed by orchestrator run 2026-11-04 (platform-burndown). The plan has passed two adversarial review passes; implementation follows in a PR that closes this issue.

  2. cristim commented on Nov 4, 2026

    @cristim
    Member

    Fixed by #1669, merged as 76ca37e. Verified locally on real Postgres with the real fire sweep and a fake provider: a scheduled purchase approved by a user keeps that approver in approved_by after it fires, and a row with no approver stays NULL (main wrote "scheduler" in both cases). Independent Opus review and the gate record are on the PR. Known gap, by design: rows already stored as "scheduler" before this fix keep that value (no backfill).

  3. added a commit that references this issue on Nov 4, 2026
    76ca37e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions