{"record":{"id":"bb7eb20e4c0d050e","repo":"we-promise/sure","slug":"class-name-connectioncleanupjob-api-delete","errorCode":null,"errorMessage":"<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message}","messagePattern":"<%= class_name %>ConnectionCleanupJob - API delete failed: #(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/generators/provider/family/templates/connection_cleanup_job.rb.tt","lineNumber":52,"sourceCode":"\n  private\n\n    def delete_connection(<%= file_name %>_item, authorization_id)\n      provider = <%= file_name %>_item.<%= file_name %>_provider\n      return unless provider\n\n      credentials = <%= file_name %>_item.<%= file_name %>_credentials\n      return unless credentials\n\n      # TODO: Implement API call to delete connection\n      # Example:\n      # provider.delete_connection(\n      #   authorization_id: authorization_id,\n      #   **credentials\n      # )\n      nil # Placeholder until provider.delete_connection is implemented\n    rescue => e\n      Rails.logger.warn(\n        \"<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message}\"\n      )\n    end\n<% else -%>\n\n  def perform(<%= file_name %>_item_id:, account_id:)\n    Rails.logger.info(\n      \"<%= class_name %>ConnectionCleanupJob - Cleaning up for former account #{account_id}\"\n    )\n\n    <%= file_name %>_item = <%= class_name %>Item.find_by(id: <%= file_name %>_item_id)\n    return unless <%= file_name %>_item\n\n    # For banking providers, cleanup is typically simpler since there's no\n    # separate authorization concept - the item itself holds the credentials.\n    # Override this method if your provider needs specific cleanup logic.\n\n    Rails.logger.info(\"<%= class_name %>ConnectionCleanupJob - Cleanup complete for account #{account_id}\")","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/lib/generators/provider/family/templates/connection_cleanup_job.rb.tt#L34-L70","documentation":"Generated delete_connection currently resolves the item's provider and credentials and then returns nil — the actual provider API call is a commented TODO example. The rescue only catches errors raised while resolving provider/credentials or by partially enabling the example call (e.g. NoMethodError because provider.delete_connection is not implemented on the SDK). Logged as a warning and swallowed, so the job completes with no remote deletion performed.","triggerScenarios":"Uncommenting the example provider.delete_connection(authorization_id:, **credentials) call before that method exists on the provider SDK class; credentials record present but raising on attribute access; provider resolution returning an object without the expected interface (connection_cleanup_job.rb.tt:52 region).","commonSituations":"Developers scaffolding a new provider with the generator and wiring the TODO incrementally; SDK method renamed or signature changed so **credentials splat raises ArgumentError.","solutions":["Implement delete_connection(authorization_id:, **credentials) on the provider SDK, or leave the placeholder and accept that connections are only removed locally","Match the call site to the real SDK signature — the example expects keyword args authorization_id plus splatted credentials","Verify <%= file_name %>_item.<%= file_name %>_credentials actually returns the credential hash expected by the SDK","Re-enqueue the cleanup job after fixing to remove the orphaned provider connection"],"exampleFix":"# generated connection_cleanup_job.rb - before (TODO placeholder)\n# provider.delete_connection(\n#   authorization_id: authorization_id,\n#   **credentials\n# )\nnil # Placeholder\n\n# after\ndef delete_connection(<%= file_name %>_item, authorization_id)\n  provider = <%= file_name %>_item.<%= file_name %>_provider\n  return unless provider\n\n  credentials = <%= file_name %>_item.<%= file_name %>_credentials\n  return unless credentials\n\n  provider.delete_connection(\n    authorization_id: authorization_id,\n    **credentials\n  )\nrescue => e\n  Rails.logger.warn(\"<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.message}\")\nend","handlingStrategy":"try-catch","validationCode":"# Resolve SDK pieces explicitly and verify the method exists before calling\nprovider = <%= file_name %>_item.<%= file_name %>_provider\ncredentials = <%= file_name %>_item.<%= file_name %>_credentials\nif provider.nil? || credentials.nil?\n  Rails.logger.info(\"<%= class_name %>ConnectionCleanupJob - nothing to delete (provider or credentials missing)\")\n  return\nend\nunless provider.respond_to?(:delete_connection)\n  Rails.logger.warn(\"<%= class_name %>ConnectionCleanupJob - SDK lacks delete_connection; skipping API delete\")\n  return\nend","typeGuard":null,"tryCatchPattern":"rescue NoMethodError => e\n  Rails.logger.warn(\"<%= class_name %>ConnectionCleanupJob - SDK interface missing: #{e.message} - implement delete_connection\")\nrescue => e\n  Rails.logger.warn(\"<%= class_name %>ConnectionCleanupJob - API delete failed: #{e.class} #{e.message}\")\nend","preventionTips":["Implement provider.delete_connection in the SDK before uncommenting the TODO call in the generated job","Use respond_to? checks against the SDK so placeholders degrade gracefully instead of raising","Track provider-side connection orphans separately from local deletes when the placeholder is left in place"],"tags":["background-jobs","cleanup","todo-placeholder","generator-template","provider-api"],"backgroundTag":"background-job-swallowed-error","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}