fix: clarify backend status freshness and scoped copy evidence
This commit is contained in:
1 parent
b7baa24b5e
commit
e8a1714d95
13 files changed
+152
-58
No files matched your search
@@ -84,11 +84,30 @@ def test_scan_reuses_checkpoint_and_queries_only_missing(tmp_path):
|
||||
encoding="utf-8",
|
||||
)
|
||||
bridge = FakeBridge()
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint)
|
||||
records = BatchStatusSession(bridge).scan(["A", "B"], lmc, checkpoint, resume=True)
|
||||
assert bridge.requests == ["B"]
|
||||
assert {record.block_name for record in records} == {"A", "B"}
|
||||
|
||||
|
||||
def test_default_scan_refreshes_cached_ready_after_payload_change(tmp_path):
|
||||
lmc = tmp_path/'library.lmc'; lmc.write_bytes(b'library')
|
||||
checkpoint = tmp_path/'scan.jsonl'
|
||||
BatchStatusSession(FakeBridge()).scan(['A'], lmc, checkpoint)
|
||||
# The lightweight fingerprint cannot prove payload status is unchanged.
|
||||
fingerprint = fingerprint_library(lmc)
|
||||
(tmp_path/'payload.pcb').write_bytes(b'native edit without LMC change')
|
||||
assert fingerprint_library(lmc) == fingerprint
|
||||
class PendingBridge(FakeBridge):
|
||||
def query(self, *args, **kwargs):
|
||||
self.requests.append(args[1])
|
||||
return BridgeResult('PENDING', 'fake')
|
||||
bridge = PendingBridge()
|
||||
records = BatchStatusSession(bridge).scan(['A'], lmc, checkpoint)
|
||||
assert [record.status for record in records] == ['PENDING']
|
||||
assert bridge.requests == ['A']
|
||||
assert len(checkpoint.read_text('utf-8').splitlines()) == 1
|
||||
|
||||
|
||||
def test_timeout_isolated_and_later_item_continues(tmp_path):
|
||||
lmc = tmp_path / "mentor_lib.lmc"
|
||||
lmc.write_bytes(b"library")
|
||||
@@ -180,7 +199,7 @@ def test_retry_rechecks_failed_scan_without_library_changes(tmp_path):
|
||||
first = BatchStatusSession(FakeBridge(timeout_name='A')).scan(['A', 'B'], lmc, checkpoint)
|
||||
assert first[0].status == 'TIMEOUT'
|
||||
bridge = FakeBridge()
|
||||
second = BatchStatusSession(bridge).scan(['A', 'B'], lmc, checkpoint)
|
||||
second = BatchStatusSession(bridge).scan(['A', 'B'], lmc, checkpoint, resume=True)
|
||||
assert bridge.requests == ['A']
|
||||
assert second[0].status == 'READY'
|
||||
|
||||
|
||||
Reference in new issue
Block a user