{"record":{"id":"7261965f4cc3add7","repo":"instructure/canvas-lms","slug":"progress-tracking-must-be-a-boolean","errorCode":null,"errorMessage":"progress_tracking must be a boolean","messagePattern":"progress_tracking must be a boolean","errorType":"validation","errorClass":"CanvasOperations::Errors::InvalidPropertyValue","httpStatus":null,"severity":"error","filePath":"lib/canvas_operations/base_concerns/progress_tracking.rb","lineNumber":44,"sourceCode":"      #\n      # @return [Boolean] true if progress tracking is enabled, false otherwise\n      def progress_tracking\n        return @progress_tracking if instance_variable_defined?(:@progress_tracking)\n\n        superclass.respond_to?(:progress_tracking) ? superclass.progress_tracking : false\n      end\n\n      # Enable or disable progress tracking for this operation.\n      #\n      # When enabled, a Progress object will be attached to the `context`\n      # to track progress of the operation.\n      #\n      # Operations are responsible for incrementing progress, but `BaseOperation`\n      # will automatically set the Progress state to completed or failed as appropriate.\n      #\n      # @param value [Boolean] true to enable progress tracking, false to disable\n      def progress_tracking=(value)\n        raise CanvasOperations::Errors::InvalidPropertyValue, \"progress_tracking must be a boolean\" unless [true, false].include?(value)\n\n        @progress_tracking = value\n      end\n\n      # Convenience instance methods for accessing the class-level progress_tracking property.\n      def self.extended(base)\n        base.class_eval do\n          protected\n\n          def progress_tracking?\n            self.class.progress_tracking\n          end\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/canvas_operations/base_concerns/progress_tracking.rb#L26-L62","documentation":"CanvasOperations::Errors::InvalidPropertyValue raised by the progress_tracking= setter on operations with the ProgressTracking concern. The class-level progress_tracking flag controls whether a Progress record is automatically created and updated; only literal true or false are accepted to avoid truthy/falsy confusion.","triggerScenarios":"Assigning a truthy-but-non-boolean value such as progress_tracking = 'true', 1, or nil at the class level of an operation.","commonSituations":"Reading the flag from ENV/config without converting it ('true'/'false' strings); YAML or JSON config that yields 1/0 or nil; copy-pasting boolean settings without coercion.","solutions":["Pass a real boolean: self.progress_tracking = true (or false)","Coerce string config values with e.g. value == 'true' or ActiveModel::Type::Boolean.new.cast(value)","Remove the assignment to fall back to the default instead of assigning nil"],"exampleFix":"// before\nself.progress_tracking = ENV['PROGRESS_TRACKING']\n// after\nself.progress_tracking = ENV['PROGRESS_TRACKING'] == 'true'","handlingStrategy":"validation","validationCode":"value = ActiveModel::Type::Boolean.new.cast(ENV['PROGRESS_TRACKING'])\nraise 'must be boolean' unless [true, false].include?(value)","typeGuard":null,"tryCatchPattern":"rescue CanvasOperations::Errors::InvalidPropertyValue\n  self.progress_tracking = false\nend","preventionTips":["Never assign strings/integers from env or YAML directly to boolean flags","Coerce with ActiveModel::Type::Boolean or == 'true'","Omit the assignment (use the default) instead of assigning nil"],"tags":["ruby","configuration","type-mismatch","canvas-operations"],"backgroundTag":"config-type-mismatch","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}