~cytrogen/gstack

ref: 22ad3e5b6479b60f330df992d3c6ae18a97cffa2 gstack/test/fixtures/review-eval-enum-diff.rb -rw-r--r-- 986 bytes
22ad3e5b — Garry Tan fix: Codex filesystem boundary — prevent skill-file prompt injection (v0.12.10.0) (#570) 13 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Feature branch version: adds "returned" status but misses consumers
class Order < ApplicationRecord
  STATUSES = %w[pending processing shipped delivered returned].freeze

  validates :status, inclusion: { in: STATUSES }

  def display_status
    case status
    when 'pending'    then 'Awaiting processing'
    when 'processing' then 'Being prepared'
    when 'shipped'    then 'On the way'
    when 'delivered'  then 'Delivered'
    # BUG: 'returned' not handled — falls through to nil
    end
  end

  def can_cancel?
    # BUG: should 'returned' be cancellable? Not considered.
    %w[pending processing].include?(status)
  end

  def notify_customer
    case status
    when 'pending'    then OrderMailer.confirmation(self).deliver_later
    when 'shipped'    then OrderMailer.shipped(self).deliver_later
    when 'delivered'  then OrderMailer.delivered(self).deliver_later
    # BUG: 'returned' has no notification — customer won't know return was received
    end
  end
end