{"record":{"id":"8bf6d4c078ae5674","repo":"we-promise/sure","slug":"class-name-account-activitiesprocessor-un","errorCode":null,"errorMessage":"<%= class_name %>Account::ActivitiesProcessor - Unmapped activity type '#{normalized_type}' for account #{@<%= file_name %>_account.id}. Consider adding to ACTIVITY_TYPE_TO_LABEL mapping.","messagePattern":"<%= class_name %>Account::ActivitiesProcessor - Unmapped activity type '#(.+?)' for account #(.+?)\\. Consider adding to ACTIVITY_TYPE_TO_LABEL mapping\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"lib/generators/provider/family/templates/activities_processor.rb.tt","lineNumber":221,"sourceCode":"        amount\n      end\n    end\n\n    def build_description(activity_type, symbol)\n      type_label = label_from_type(activity_type)\n      if symbol.present?\n        \"#{type_label} - #{symbol}\"\n      else\n        type_label\n      end\n    end\n\n    def label_from_type(activity_type)\n      normalized_type = activity_type&.upcase\n      label = ACTIVITY_TYPE_TO_LABEL[normalized_type]\n\n      if label.nil? && normalized_type.present?\n        Rails.logger.warn(\n          \"<%= class_name %>Account::ActivitiesProcessor - Unmapped activity type '#{normalized_type}' \" \\\n          \"for account #{@<%= file_name %>_account.id}. Consider adding to ACTIVITY_TYPE_TO_LABEL mapping.\"\n        )\n      end\n\n      label || \"Other\"\n    end\nend\n","sourceCodeStart":203,"sourceCodeEnd":230,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/lib/generators/provider/family/templates/activities_processor.rb.tt#L203-L230","documentation":"In the generated ActivitiesProcessor, label_from_type upcases the provider's activity type and looks it up in the ACTIVITY_TYPE_TO_LABEL constant. When the normalized type is present but has no entry, it logs this warning (recommending a mapping addition) and returns \"Other\" as the label. This is cosmetic: activity import, amounts, and symbol rendering are unaffected — only the human-readable label falls back.","triggerScenarios":"Provider returns an activity type string that is not a key of ACTIVITY_TYPE_TO_LABEL after upcasing — e.g. a newly introduced type like \"REINVEST_DIVIDEND\" or \"STOCK_SPLIT\" when the generated constant only covers common types (BUY/SELL/DIVIDEND/...). Casing differences do NOT trigger it because the lookup is upcased first.","commonSituations":"The provider API adds a new activity type after the integration was generated; the generator's default mapping was never customized to the provider's real taxonomy; multi-word or prefixed codes (e.g. \"TRANSFER_OUT\") missing from the constant.","solutions":["Take the exact normalized_type from the warning and add it to ACTIVITY_TYPE_TO_LABEL in the generated app/models/<provider>/activities_processor.rb with a sensible label","Mirror the addition in lib/generators/provider/family/templates/activities_processor.rb.tt so regenerating the provider keeps the mapping","If the type is noise for your users, map it to \"Other\" explicitly to silence the warning","After the next sync, verify the activities list shows the new label"],"exampleFix":"# generated activities_processor.rb - before\nACTIVITY_TYPE_TO_LABEL = {\n  \"BUY\" => \"Buy\", \"SELL\" => \"Sell\", \"DIVIDEND\" => \"Dividend\"\n}.freeze\n\n# after\nACTIVITY_TYPE_TO_LABEL = {\n  \"BUY\" => \"Buy\", \"SELL\" => \"Sell\", \"DIVIDEND\" => \"Dividend\",\n  \"REINVEST_DIVIDEND\" => \"Dividend Reinvestment\", \"STOCK_SPLIT\" => \"Stock Split\"\n}.freeze","handlingStrategy":"fallback","validationCode":"# Normalize provider types against the mapping during import; flag unmapped ones\ndef known_activity_type?(raw)\n  ACTIVITY_TYPE_TO_LABEL.key?(raw.to_s.upcase)\nend\n\nunmapped = activities.reject { |a| known_activity_type?(a[:type]) }\nRails.logger.info(\"Unmapped types incoming: #{unmapped.map { |a| a[:type] }.uniq.inspect}\") if unmapped.any?","typeGuard":"def known_activity_type?(raw)\n  ACTIVITY_TYPE_TO_LABEL.key?(raw.to_s.upcase)\nend","tryCatchPattern":null,"preventionTips":["Audit the provider's documented activity-type enum when generating the integration and fill ACTIVITY_TYPE_TO_LABEL up front","Add a periodic check for distinct raw types in stored activities that map to \"Other\" and extend the constant","Keep the mapping in the .tt template in sync with provider API changelog"],"tags":["activity-types","enum-mapping","provider-data","generator-template","ui-label"],"backgroundTag":"unmapped-provider-enum","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}