feat(captain-memory): add ContradictionCheckerJob

This commit is contained in:
Rodribm10 2026-04-19 00:39:52 -03:00
parent dc366433bb
commit 350a420ee0
2 changed files with 16 additions and 5 deletions

View File

@ -1,14 +1,10 @@
class Captain::ContactMemories::ContradictionCheckerJob < ApplicationJob
queue_as :low
# TODO(phase3-task3.2): implement full contradiction detection logic.
# This skeleton exists so Captain::ContactMemories::UpdateEmbeddingJob can
# enqueue it when run_contradiction_check is true. Task 3.2 will replace
# the body with the real implementation.
def perform(memory_id)
memory = Captain::ContactMemory.find_by(id: memory_id)
return if memory.blank?
# no-op until task 3.2
Captain::ContactMemories::ContradictionCheckerService.new(memory: memory).call
end
end

View File

@ -0,0 +1,15 @@
require 'rails_helper'
RSpec.describe Captain::ContactMemories::ContradictionCheckerJob do
let(:memory) { create(:captain_contact_memory) }
it 'delegates to ContradictionCheckerService' do
service = instance_double(Captain::ContactMemories::ContradictionCheckerService, call: nil)
expect(Captain::ContactMemories::ContradictionCheckerService).to receive(:new).with(memory: memory).and_return(service)
described_class.perform_now(memory.id)
end
it 'no-ops on missing memory' do
expect { described_class.perform_now(99_999_999) }.not_to raise_error
end
end