Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.

Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
2026-08-25 07:58:47 +02:00
parent f52879edbb
commit 8a80aae21e
114 changed files with 9293 additions and 284 deletions
@@ -396,6 +396,59 @@ it('passes type query param from API endpoint', function () {
->assertJsonCount(1, 'data');
});
it('keeps other rec types and other artworks visible when one row is rebuilt', function () {
$source = createPublicArtwork();
$other = createPublicArtwork();
$hybridA = createPublicArtwork();
$hybridB = createPublicArtwork();
$tagsA = createPublicArtwork();
$behaviorNew = createPublicArtwork();
RecArtworkRec::create([
'artwork_id' => $source->id,
'rec_type' => 'similar_hybrid',
'model_version' => 'sim_v1',
'recs' => [$hybridA->id],
'computed_at' => now()->subDay(),
]);
RecArtworkRec::create([
'artwork_id' => $source->id,
'rec_type' => 'similar_tags',
'model_version' => 'sim_v1',
'recs' => [$tagsA->id],
'computed_at' => now()->subDay(),
]);
RecArtworkRec::create([
'artwork_id' => $other->id,
'rec_type' => 'similar_hybrid',
'model_version' => 'sim_v1',
'recs' => [$hybridB->id],
'computed_at' => now()->subDay(),
]);
RecArtworkRec::query()->updateOrCreate(
[
'artwork_id' => $source->id,
'rec_type' => 'similar_behavior',
'model_version' => 'sim_v1',
],
[
'recs' => [$behaviorNew->id],
'computed_at' => now(),
],
);
expect(RecArtworkRec::query()->where('artwork_id', $source->id)->where('rec_type', 'similar_hybrid')->value('recs'))
->toEqual([$hybridA->id]);
expect(RecArtworkRec::query()->where('artwork_id', $source->id)->where('rec_type', 'similar_tags')->value('recs'))
->toEqual([$tagsA->id]);
expect(RecArtworkRec::query()->where('artwork_id', $other->id)->where('rec_type', 'similar_hybrid')->value('recs'))
->toEqual([$hybridB->id]);
$service = app(HybridSimilarArtworksService::class);
expect($service->forArtwork($source->id, 12)->pluck('id')->all())->toEqual([$hybridA->id]);
});
// ─── Cosine normalized pair weights ────────────────────────────────────────────
it('produces cosine-normalized weights in pair builder', function () {