11"""Pydantic schemas for sync report responses."""
22
3- from typing import TYPE_CHECKING , Dict , Set
3+ from datetime import datetime
4+ from typing import TYPE_CHECKING , Dict , List , Set
45
56from pydantic import BaseModel , Field
67
910 from basic_memory .sync .sync_service import SyncReport
1011
1112
13+ class SkippedFileResponse (BaseModel ):
14+ """Information about a file that was skipped due to repeated failures."""
15+
16+ path : str = Field (description = "File path relative to project root" )
17+ reason : str = Field (description = "Error message from last failure" )
18+ failure_count : int = Field (description = "Number of consecutive failures" )
19+ first_failed : datetime = Field (description = "Timestamp of first failure" )
20+
21+ model_config = {"from_attributes" : True }
22+
23+
1224class SyncReportResponse (BaseModel ):
1325 """Report of file changes found compared to database state.
1426
@@ -24,6 +36,9 @@ class SyncReportResponse(BaseModel):
2436 checksums : Dict [str , str ] = Field (
2537 default_factory = dict , description = "Current file checksums (path -> checksum)"
2638 )
39+ skipped_files : List [SkippedFileResponse ] = Field (
40+ default_factory = list , description = "Files skipped due to repeated failures"
41+ )
2742 total : int = Field (description = "Total number of changes" )
2843
2944 @classmethod
@@ -42,6 +57,15 @@ def from_sync_report(cls, report: "SyncReport") -> "SyncReportResponse":
4257 deleted = report .deleted ,
4358 moves = report .moves ,
4459 checksums = report .checksums ,
60+ skipped_files = [
61+ SkippedFileResponse (
62+ path = skipped .path ,
63+ reason = skipped .reason ,
64+ failure_count = skipped .failure_count ,
65+ first_failed = skipped .first_failed ,
66+ )
67+ for skipped in report .skipped_files
68+ ],
4569 total = report .total ,
4670 )
4771
0 commit comments