feat(captain-memory): add ContradictionCheckerJob
This commit is contained in:
parent
dc366433bb
commit
350a420ee0
@ -1,14 +1,10 @@
|
|||||||
class Captain::ContactMemories::ContradictionCheckerJob < ApplicationJob
|
class Captain::ContactMemories::ContradictionCheckerJob < ApplicationJob
|
||||||
queue_as :low
|
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)
|
def perform(memory_id)
|
||||||
memory = Captain::ContactMemory.find_by(id: memory_id)
|
memory = Captain::ContactMemory.find_by(id: memory_id)
|
||||||
return if memory.blank?
|
return if memory.blank?
|
||||||
|
|
||||||
# no-op until task 3.2
|
Captain::ContactMemories::ContradictionCheckerService.new(memory: memory).call
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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
|
||||||
Loading…
Reference in New Issue
Block a user