• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / storage / 25786999328

13 May 2026 08:15AM UTC coverage: 39.71% (-34.7%) from 74.375%
25786999328

Pull #1102

github

web-flow
Merge 7e6801cdd into cf8181cd0
Pull Request #1102: fix: add more acceptance test coverage

2130 of 5920 branches covered (35.98%)

Branch coverage included in aggregate %.

4247 of 10139 relevant lines covered (41.89%)

35.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

10.34
/src/http/plugins/vector.ts
1
import { getTenantConfig, multitenantKnex } from '@internal/database'
2
import { ERRORS } from '@internal/errors'
3
import { KnexShardStoreFactory, ShardCatalog, SingleShard } from '@internal/sharding'
4
import {
5
  createS3VectorClient,
6
  KnexVectorMetadataDB,
7
  S3Vector,
8
  VectorStoreManager,
9
} from '@storage/protocols/vector'
10
import { FastifyInstance } from 'fastify'
11
import fastifyPlugin from 'fastify-plugin'
12
import { getConfig } from '../../config'
13

14
declare module 'fastify' {
15
  interface FastifyRequest {
16
    s3Vector: VectorStoreManager
17
  }
18
}
19

20
const s3VectorClient = createS3VectorClient()
3✔
21
const s3VectorAdapter = new S3Vector(s3VectorClient)
3✔
22

23
export const s3vector = fastifyPlugin(async function (fastify: FastifyInstance) {
3✔
24
  fastify.addHook('preHandler', async (req) => {
×
25
    const { isMultitenant, vectorS3Buckets, vectorMaxBucketsCount, vectorMaxIndexesCount } =
×
26
      getConfig()
27

28
    if (!vectorS3Buckets || vectorS3Buckets.length === 0) {
×
29
      throw ERRORS.FeatureNotEnabled('vector', 'Vector service not configured')
×
30
    }
31

32
    let maxBucketCount = vectorMaxBucketsCount
×
33
    let maxIndexCount = vectorMaxIndexesCount
×
34

35
    if (isMultitenant) {
×
36
      const { features } = await getTenantConfig(req.tenantId)
×
37
      maxBucketCount = features?.vectorBuckets?.maxBuckets || vectorMaxBucketsCount
×
38
      maxIndexCount = features?.vectorBuckets?.maxIndexes || vectorMaxIndexesCount
×
39
    }
40

41
    const db = req.db.pool.acquire()
×
42
    const store = new KnexVectorMetadataDB(db)
×
43
    const shard = isMultitenant
×
44
      ? new ShardCatalog(new KnexShardStoreFactory(multitenantKnex))
45
      : new SingleShard({
46
          shardKey: vectorS3Buckets[0],
47
          capacity: 10000,
48
        })
49

50
    req.s3Vector = new VectorStoreManager(s3VectorAdapter, store, shard, {
×
51
      tenantId: req.tenantId,
52
      maxBucketCount,
53
      maxIndexCount,
54
    })
55
  })
56
})
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc