Repository navigation
feat(cache): historical backfill queue, fast CDN pacing & force redownload (based on #107) - #108
Merged
Merged
Conversation
Keep Weibo primary images strictly at official full-resolution originals (/large/ or /mw2000/) and save the /oslarge/ watermark-free maximum tier as an optional companion file (images/NN_nowm.<ext>, role image_nowm) with SHA-256 deduplication, silent skip on unavailable /oslarge/, old cached item backfill, library lifecycle support, anti-duplication in media library/feed, and an Original/Watermark-free toggle pill in the image viewer. Record DEC-078 and minimally adapt ACT-023 dual-save tests. Closes #103 Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
…e stem When resolving conflict deletions/reorders where a surviving page shifts to an earlier index, derive the fallback companion stem from reusableLP.Image instead of the new page index so a deleted page's NN_nowm file is never misbound to a different surviving image. Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
…e redownload Implements Issue #104 and records DEC-079: - Add WeiboCacheStandardVersion = 3 (keeping CurrentCacheStandardVersion = 2) and zero-network BackfillSummary offline detection. - Link manual and 7-day fullCache sweeps (inspectWeiboCachedPost) to detect missing Weibo /oslarge/ companions and silently migrate pre-DEC-073 inline URLs. - Add persistent 3-tier historical Weibo backfill queue in cache-queue.json (v3, optional omitempty fields): offline links (0 network), pure CDN 2-5s fast pacing (0 API calls, 0 hourly quota, no 10-25m long rest), subscribed mymblog batch match, and statuses/show fallback under strict Weibo API quota/pacing. - Add manual-only ForceOverwrite (⋯ -> 强制重新下载) with confirmation modal across all 4 sites, skipping local reuse while preserving strict ErrRemoteDegradedRefused protection and atomic .trace-prev-* swap. - Add Settings › 存储 and Tasks › 缓存队列 UI entrypoints, update DEC-079 and docs, and add unit tests across library/download/service/ui. Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已完成 PR #108(Closes #104,HEAD 审查结论:先修复(发现 4 项 P1 阻塞问题)已审查范围
阻塞问题(需修复并补充回归测试后复核)1. [P1] Tier C1
|
…taging, storage pause, and lock safety Fixes all 4 P1 findings and 3 non-blocking items from independent review: 1. Enforce slow API pacing (40-150s, non-CDN phase) before every Weibo JSON API step (mymblog miss pages, post-drain transitions, and non-backoff timeline errors). 2. Stage all Weibo /oslarge/ companions inside .trace-stage-* until every slot finishes, then atomically move and SaveItem with rollback so mid-item 429/cancel never leaves orphan files or causes INV-09 permanent skip on retry. 3. Classify *os.PathError, *os.LinkError, site.ErrKindStorage, and bilibili storage errors consistently and wrap storage failures as site.ErrKindStorage so backfill pauses with PauseReason=storage without skipping pending items. 4. Defer legacy inline-URL metadata writes and synchronous EventLibraryChanged publication out of cacheQueueManager.mu into post-unlock callbacks to eliminate self-deadlock risk. 5. Also reuse GetVideo response in ForceRecacheItem (rejecting unavailable HostPost), deduplicate Tasks queue backfill banner copy, and record missing danmaku on ForceOverwrite. Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已按独立审查意见在提交 4 项 P1 修复
3 项非阻塞优化
本机验证
|
…on Linux and Windows Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:已完成 PR #108(Closes #104,HEAD 审查结论:可合并(低风险,待 PR #107 合并后改基
|
…ash-merged main (#107) Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
This was referenced Nov 26, 2026
Owner
Author
|
Agent:已完成 PR #108(Closes #104,HEAD 审查结论:可合并(低风险,0 阻塞项)复核证据
未运行项(
|
This was referenced Nov 26, 2026
Merged
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #104
做了什么
实现 Issue #104 全部目标并回写
DEC-079(docs/decisions.md、docs/requirements.md、docs/design/data-and-cache.md、docs/design/subscriptions.md、docs/ui.md):internal/library/schema.go新增WeiboCacheStandardVersion = 3(保持CurrentCacheStandardVersion = 2不变,避免触发哔哩哔哩门限 B 无谓的 PlayURL 重探),并新增纯离线判定函数(WeiboNeedsNoWMBackfill、WeiboHasAllFastCDNPicIDs、WeiboIsForwardItem)与ListItemsMetaOnlyBySite(绕开 200 条上限且零磁盘系统调用)。BackfillSummary() (BackfillSummaryDTO, error)(0 网络请求),离线统计WeiboMissingNoWM、WeiboLegacyLinks、WeiboFastCDNCandidates、WeiboSubscribedCount、WeiboFallbackDetailCount、TotalItems(排除archivedOf归档快照与纯 GIF)。internal/service/cache_conflicts.go)inspectWeiboCachedPost同时覆盖手动「⋯ → 全部缓存」与 7 天定期fullCache:weiboRemoveWatermark且本地静态主图缺images/NN_nowm.*且CacheStandardVersion < 3时,直接复用列表页post返回inspectEnqueue(0 额外statuses/show请求,保留本地原图只补伴侣图并写入 v3);SaveItemMetadataOnly清洗并写入规范Text+Links[](不动媒体文件)。cache-queue.json(保持version: 3,所有新增字段为可选omitempty且严格脱敏),新增weibo_backfill队列并支持重启续跑、暂停/继续/取消/移除与风控/限流退避。pic_id的条目直连无 Cookiesinaimg.cn/oslarge/<pic_id>.<ext>仅补缺失NN_nowm并做占位图/魔数/SHA-256 去重与 v3 标记;队列间隔 2~5 秒,0 微博 JSON API 请求、不占微博 100 次/小时额度、不触发 10~25 分钟长歇;pic_id历史条目):优先按已订阅博主 UID 批量翻mymblog匹配并立刻转 2~5 秒纯 CDN 补齐,列表未覆盖项(转发/非订阅/可见范围外)再兜底逐条调statuses/show,严格遵守微博原 API 节流、100 次/小时额度与风控退避。⋯ → 强制重新下载⋯菜单中增加 「强制重新下载」(排除离线/library/item与archivedOf归档快照),弹出二次确认对话框("将从源站重新完整下载并覆盖本机已有文件;若源站已删除或失效,仍会保留本机原文件不覆盖。")。download.WithForceOverwrite(ctx)/ForceRecacheItem(auto/queue/自动请求路径严格禁用),跳过本地媒体复用在.trace-stage-*从源站完整重拉,但仍严格执行ErrRemoteDegradedRefused硬拦截保护(源站 404/已删/占位图/试看/受限/降级时中止并保留原文件),校验全部通过后经.trace-prev-*原子替换(Windows 文件锁失败自动回滚)。验证
go test -v ./internal/library -run 'TestWeiboCacheStandardVersionAndOfflineHelpers|TestListItemsMetaOnlyBySiteNo200Cap'— PASSgo test -v ./internal/download -run 'TestEffectiveForceOverwriteManualOnlyContract|TestBackfillWeiboNoWMCompanionsDirectCDNAndRateLimitStop|TestForceOverwriteAcrossSitesAndDegradedRefusal|TestForceOverwriteBilibiliVideoAndDegradedRefusal'— PASSgo test -v ./internal/service -run 'TestBackfillSummaryZeroNetworkAndCounts|TestFullCacheLinkageWeiboNoWMAndLegacyLinks|TestWeiboBackfillQueueThreeTierFastCDNQuotaAndRestartRecovery|TestServiceForceRecacheItemOverwriteAndGuards'— PASSgo test -v ./internal/ui -run 'TestSettingsStorageAndTasksQueueBackfillUI|TestDetailMenusForceRecacheConfirmModalAllFourSites'— PASSgo run ./tools/uishots— PASS(312 张合成截图全部通过)go run ./tools/check— PASS(gofmt、go vet、go test ./...、dependency direction、trace-server linux build、tools/checkdocs、git diff --check HEAD全部通过)not-run(全部使用合成样本与本地回环桩,0 真实外网请求)。风险
无任何数据文件结构版本升级:
item.json保持 v1、cache-queue.json保持 v3、settings.json保持 v1、library.db保持 v2,全部新增字段均为可选omitempty向后兼容。未触碰
internal/credential、tools/package、tools/internal/build、tools/actcheck、internal/sitecheck、.github/等高风险路径。ForceOverwrite仅限显式手动触发,且受ErrRemoteDegradedRefused与.trace-prev-*原子交换回滚保护。低风险
高风险(已加
risk:high,等用户合并)每个提交都带
Signed-off-by(git commit -s)。