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
« 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.
4FAISS indexes should never be manually modified, making them ideal
5candidates for strict integrity verification.
6"""
8from pathlib import Path
10from ..base_verifier import BaseFileVerifier, FileType
13class FAISSIndexVerifier(BaseFileVerifier):
14 """
15 Verifier for FAISS index files.
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 """
23 def should_verify(self, file_path: Path) -> bool:
24 """
25 Check if this is a FAISS index file.
27 Args:
28 file_path: Path to check
30 Returns:
31 True if file has .faiss extension
32 """
33 return file_path.suffix.lower() == ".faiss"
35 def get_file_type(self) -> FileType:
36 """
37 Get file type identifier.
39 Returns:
40 FileType.FAISS_INDEX
41 """
42 return FileType.FAISS_INDEX
44 def allows_modifications(self) -> bool:
45 """
46 FAISS indexes should never be manually modified.
48 Returns:
49 False - FAISS indexes are binary and should only be generated programmatically
50 """
51 return False