File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2222
2323
2424class _QuarantineManifest (ContractModel ):
25- schema_version : int = 1
25+ schema_version : Literal [ 2 ] = 2
2626 quarantine_id : str
2727 operation : str
2828 detected_at : datetime
Original file line number Diff line number Diff line change @@ -194,6 +194,23 @@ def test_quarantine_rejects_recovery_options_that_disagree_with_state(
194194 assert error .value .code is ErrorCode .WORKSPACE_INVALID
195195
196196
197+ def test_quarantine_rejects_version_one_manifests (tmp_path : Path ) -> None :
198+ workspace = Workspace .initialize (tmp_path )
199+ source = workspace .paths .staging / "partial.bin"
200+ source .write_bytes (b"partial" )
201+ service = QuarantineService (workspace )
202+ quarantined = service .quarantine (source , reason = "fixture" , operation = "test" )
203+ manifest_path = workspace .paths .quarantine / quarantined .quarantine_id / "manifest.json"
204+ serialized = quarantined .model_dump (mode = "json" )
205+ serialized ["schema_version" ] = 1
206+ manifest_path .write_text (json .dumps (serialized ))
207+
208+ with pytest .raises (DomainError ) as error :
209+ service .restore (quarantined .quarantine_id )
210+
211+ assert error .value .code is ErrorCode .WORKSPACE_INVALID
212+
213+
197214def test_quarantine_rejects_symbolic_link_sources (tmp_path : Path ) -> None :
198215 workspace = Workspace .initialize (tmp_path )
199216 target = workspace .paths .staging / "target.bin"
You can’t perform that action at this time.
0 commit comments