diff --git a/app/Commands/KnowledgeAddCommand.php b/app/Commands/KnowledgeAddCommand.php index 66c5a67..063df04 100644 --- a/app/Commands/KnowledgeAddCommand.php +++ b/app/Commands/KnowledgeAddCommand.php @@ -192,7 +192,7 @@ public function handle(GitContextService $gitService, QdrantService $qdrant, Wri // Queue for Ollama enhancement unless skipped if (! $skipEnhance && (bool) config('search.ollama.enabled', true)) { - $enhancementQueue->queue($data); + $enhancementQueue->queue($data, $this->resolveProject()); } info('Knowledge entry created!'); diff --git a/tests/Feature/Commands/KnowledgeAddCommandTest.php b/tests/Feature/Commands/KnowledgeAddCommandTest.php index e5d3ed1..3d62fa8 100644 --- a/tests/Feature/Commands/KnowledgeAddCommandTest.php +++ b/tests/Feature/Commands/KnowledgeAddCommandTest.php @@ -376,3 +376,25 @@ '--content' => 'Content', ])->assertSuccessful(); }); + +it('queues enhancement under the resolved project namespace', function (): void { + mockProjectDetector('mesh-status'); + + $this->mockQdrant->shouldReceive('upsert') + ->once() + ->with(Mockery::any(), 'mesh-status', Mockery::any()) + ->andReturn(true); + + $mockQueue = Mockery::mock(\App\Services\EnhancementQueueService::class); + $mockQueue->shouldReceive('queue') + ->once() + ->with(Mockery::type('array'), 'mesh-status'); + $this->app->instance(\App\Services\EnhancementQueueService::class, $mockQueue); + + config(['search.ollama.enabled' => true]); + + $this->artisan('add', [ + 'title' => 'Project Scoped Entry', + '--content' => 'Enhancement must look in the same collection the entry was stored in', + ])->assertSuccessful(); +}); diff --git a/tests/Feature/KnowledgeAddCommandTest.php b/tests/Feature/KnowledgeAddCommandTest.php index 3c1b1e2..2d51c67 100644 --- a/tests/Feature/KnowledgeAddCommandTest.php +++ b/tests/Feature/KnowledgeAddCommandTest.php @@ -199,7 +199,7 @@ $this->enhancementQueue->shouldReceive('queue') ->once() - ->with(Mockery::on(fn ($data): bool => $data['title'] === 'Enhanced Entry')); + ->with(Mockery::on(fn ($data): bool => $data['title'] === 'Enhanced Entry'), 'default'); $this->artisan('add', [ 'title' => 'Enhanced Entry',