feat: EOD 23:15 seal + midnight seed shell for video/fans

Move daily snapshot/fans to 23:15 and add 00:01 seed that clones
last_completed ok=1 rows into today without advancing completed.
Evening runs force through seed markers; growth previous is per-aid
adjacent. Home shows short-update clock + 全站数据 date, and 收录视频
counts.
This commit is contained in:
bot-ci committed 2026-11-02 12:38:55 +08:00
1 parent 374b138041
commit 8a9cb21408
17 files changed
+520 -39

No files matched your search

+56
View File
@@ -626,6 +626,61 @@ def test_snapshot_recent_next_run_follows_completion():
db.close()
def test_overview_adjacent_previous_with_seed_and_dual_fields():
"""seed 当日行存在时,播放增量按片相邻成功日;overview 暴露更新时刻与总数。"""
import json
with tempfile.TemporaryDirectory() as tmp:
db, q = setup(tmp)
try:
repo = Repository(db)
today = "2026-11-01"
# 克隆上一完成日到今天(不推进 last_completed)
for aid in (101, 102):
prev = repo.get_snapshot(DATES[-1], aid)
metrics = {
k: int(prev[k]) for k in (
"view", "like", "coin", "favorite", "share", "reply", "danmaku"
)
}
repo.upsert_snapshot(
today, aid, metrics=metrics, ok=True, err=None,
captured_at=FIXED_NOW, src="seed",
)
repo.kv_set("snapshot:seeded:" + today, "1")
# 小时短更新任务记录
repo.kv_set(
"task:last:snapshot_recent",
json.dumps({
"name": "snapshot_recent", "ok": True,
"started_at": FIXED_NOW - 60, "finished_at": FIXED_NOW - 30,
"error": None, "summary": {},
}),
)
DASHBOARD_CACHE.clear()
overview = q.overview()
assert overview["data_date"] == DATES[-1]
assert overview["updated_at"] == FIXED_NOW - 30
assert overview["counts"]["total"] == (
overview["counts"]["active"]
+ overview["counts"]["unfaved"]
+ overview["counts"]["removed"]
)
# 当前=seed(=完成日数值),相邻 previous=完成日本身 → 增量 0
assert overview["view_delta_available"] is True
assert overview["view_delta"] == 0
growth = q.list_videos(sort="growth", growth_days=1)
assert growth["available"] is True
for item in growth["items"]:
if item["aid"] in (101, 102):
assert item["growth"]["available"] is True
assert item["growth"]["delta"] == 0
assert item["growth"]["gap_days"] == 1
finally:
db.close()
def main_test():
test_overview()
test_video_listing_filters_and_sorting()
@@ -643,6 +698,7 @@ def main_test():
test_system_next_runs_follow_last_completion_not_wall_clock()
test_growth_auto_falls_back_to_one_day()
test_snapshot_recent_next_run_follows_completion()
test_overview_adjacent_previous_with_seed_and_dual_fields()
print("OK: Web 查询层总览/榜单/详情/UP/时长效率/粉丝/候选/系统/访问统计测试全部通过")