fix: close data integrity and hot-reload review findings
Backfill same-day snapshots for newly added or restored videos, preserve successful fan snapshots on resume, persist incomplete state before forced re-runs, and split collection completion from backup completion so failed backups can retry without API calls. Reject missing data payloads instead of treating them as empty folders, guard against mass-unfav on suspicious empty remote folders, rebuild Bilibili clients when credentials change, recompute primary folder ownership from active relations with per-folder fav_time, preserve original titles for dropped invalid videos, poll config every 60 seconds, and fix favsort verify interval and mixed resource types.
This commit is contained in:
1 parent
178ab64b18
commit
6a21b5d905
21 files changed
+895
-82
No files matched your search
@@ -361,6 +361,42 @@ def test_check_login_without_cookie_makes_no_request():
|
||||
assert transport.calls == []
|
||||
|
||||
|
||||
def test_missing_data_is_protocol_error():
|
||||
for payload in (
|
||||
{"code": 0, "message": "OK"},
|
||||
{"code": 0, "message": "OK", "data": None},
|
||||
):
|
||||
transport = QueueTransport([http_json(payload)])
|
||||
client, _ = make_client(transport)
|
||||
try:
|
||||
client.fav_ids(1)
|
||||
except BilibiliProtocolError as exc:
|
||||
assert "data" in str(exc)
|
||||
else:
|
||||
raise AssertionError(f"ids 缺少 data 应报协议错误: {payload}")
|
||||
|
||||
transport = QueueTransport([http_json(payload)])
|
||||
client, _ = make_client(transport)
|
||||
try:
|
||||
client.fav_infos(1, [123])
|
||||
except BilibiliProtocolError as exc:
|
||||
assert "data" in str(exc)
|
||||
else:
|
||||
raise AssertionError(f"infos 缺少 data 应报协议错误: {payload}")
|
||||
|
||||
|
||||
def test_empty_data_list_is_valid():
|
||||
transport = QueueTransport([http_json({"code": 0, "message": "OK", "data": []})])
|
||||
client, _ = make_client(transport)
|
||||
assert client.fav_ids(4413147139) == []
|
||||
|
||||
transport = QueueTransport([http_json({"code": 0, "message": "OK", "data": []})])
|
||||
client, _ = make_client(transport)
|
||||
result = client.fav_infos(1, [123, 456])
|
||||
assert result.items == {}
|
||||
assert result.missing == (123, 456)
|
||||
|
||||
|
||||
def main():
|
||||
test_fav_ids_parse_and_anonymous_header()
|
||||
test_anonymous_failure_falls_back_to_full_cookie()
|
||||
@@ -380,6 +416,8 @@ def main():
|
||||
test_relation_stat()
|
||||
test_check_login()
|
||||
test_check_login_without_cookie_makes_no_request()
|
||||
test_missing_data_is_protocol_error()
|
||||
test_empty_data_list_is_valid()
|
||||
print("OK: B 站只读客户端契约与重试测试全部通过")
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user