Coverage for src / local_deep_research / security / file_integrity / verifiers / faiss_verifier.py: 67%

9 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2026-01-11 00:51 +0000

1""" 

2FAISS Index Verifier - Integrity verification for FAISS vector indexes. 

3 

4FAISS indexes should never be manually modified, making them ideal 

5candidates for strict integrity verification. 

6""" 

7 

8from pathlib import Path 

9 

10from ..base_verifier import BaseFileVerifier, FileType 

11 

12 

13class FAISSIndexVerifier(BaseFileVerifier): 

14 """ 

15 Verifier for FAISS index files. 

16 

17 Policy: 

18 - Verifies all .faiss files 

19 - Does not allow modifications (FAISS indexes are binary, should never be manually edited) 

20 - Uses default SHA256 checksum algorithm 

21 """ 

22 

23 def should_verify(self, file_path: Path) -> bool: 

24 """ 

25 Check if this is a FAISS index file. 

26 

27 Args: 

28 file_path: Path to check 

29 

30 Returns: 

31 True if file has .faiss extension 

32 """ 

33 return file_path.suffix.lower() == ".faiss" 

34 

35 def get_file_type(self) -> FileType: 

36 """ 

37 Get file type identifier. 

38 

39 Returns: 

40 FileType.FAISS_INDEX 

41 """ 

42 return FileType.FAISS_INDEX 

43 

44 def allows_modifications(self) -> bool: 

45 """ 

46 FAISS indexes should never be manually modified. 

47 

48 Returns: 

49 False - FAISS indexes are binary and should only be generated programmatically 

50 """ 

51 return False