test(thumbnail): [PKG-TOOL-THUMB-02] reproduce extraction and resource lifecycle gaps

This commit is contained in:
Harvey Zhao committed 2026-09-13 03:33:22 +08:00
1 parent 0338e0b8b1
commit 1cb7779192
14 files changed
+3907 -11

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,79 @@
# PKG-TOOL-THUMB-02 extraction and lifecycle baseline
Started from 0338e0b8b1d9814ebe1628c7b55d08003ffa6347. No production runtime or
distribution changes. This task reproduces behavior before the resource/module
work in 03 and TS migration in 04. The old default-semantics conflict remains open.
## Repeatable controlled tests
`yarn test:thumbnail` runs the 26 frozen contract assertions and 36 extraction
assertions against recovered CDN 3.5.31 and frozen workspace main/legacy.
The new behavior file also runs in the normal unit/CI command.
Controlled timers and deferred Blob callbacks allow assertions without arbitrary
waiting: serial frames, interval clamps/density guards, progress/done ordering,
repeat generation, duplicate start/download, pending callback gating, null Blob,
late callback after destroy, replacement URLs, missing metadata, changed input,
seek setter failure, throwing done/update listeners. These are baseline tests,
not assertions that the defects are fixed. Future candidate regression tests
must assert corrected resource ownership separately while preserving old evidence.
The old and current implementations leak the first source URL on replacement,
retain changed-input listeners and generated wrapper inputs, permit late update
after destroy, and leave several callback-failure promises unsettled. Missing
metadata rejects with an unbound receiver in 3.5.31; workspace keeps polling even
after destruction. Seek-assignment failure rejects correctly in both; a throwing
done listener emits error twice in 3.5.31 and once in workspace. Normal progress
and PNG URL replacement remain ordered. These distinctions guide 03 fixes.
## Actual browser evidence and limitations
Run `yarn test:browser test/browser/thumbnail-tool.spec.js test/browser/thumbnail-native.spec.js`.
The final 39 rows have zero retries/skips: **24 actual tool scenarios** in
Chromium/Firefox, **12 Windows WebKit Blob-unavailable controls**, and **3 native
media comparison tests**. The 12 controls do not establish successful extraction.
Every control proves that the same file loads in native HTTP video but fails in
native Blob video with media error 4, then reproduces the tool's corresponding
failure and cleanup. If native Blob starts working, the full scenario runs.
Actual scenarios use native file selection, metadata/seek, real canvas.toBlob,
PNG decode and non-black opaque pixels. They verify ten updates, two complete
generations and normal final URL cleanup. DOM drop dispatch with a real File
reproduces the missing listener; calling the existing ondrop method does load.
Corrupt media raises a native error without a tool error event; replacement leaks
the first URL and a second destroy throws NotFoundError. A captured **native PNG
callback**, delivered after destroy, still emits update and creates an unreleased
URL. Only callback delivery is controlled; encoding and media are native.
Initial docs sample testing passed 24 Chromium/Firefox cases and failed all 12
WebKit cases. A second 24-second video-only MP4 probe still failed WebKit. The
independent native control then demonstrated HTTP success and Blob failure for
the original pattern, looped pattern and docs sample. An exploratory WebM HTTP
control did not settle within its 1.5-second observation and is not used to claim
codec support. All failed reports and trace directories remain archived. No
production media workaround or claimed physical Safari result was introduced.
`test/browser/media/thumbnail-pattern.mp4` is a 24-second stream-copy loop of the
existing generated 8-second pattern, needed for the tool's minimum ten samples
and maximum one-sample-per-second density. Reproduce with FFmpeg:
```sh
ffmpeg -stream_loop 2 -i test/browser/media/pattern.mp4 -t 24 -an -c:v copy -movflags +faststart test/browser/media/thumbnail-pattern.mp4
```
The local test server exposes this fixture; no dist or compiled docs files were
edited. Hashes, individual outcomes, measurements, browser versions and CI counts
are in `refactor/baselines/thumbnail-behavior-validation.json`. The ordinary
browser job discovers the new spec files automatically. No hosted CI run,
coverage improvement, successful WebKit Blob extraction or npm publication is claimed.
## Handoff and rollback
03 should own source URLs, generated inputs/listeners, metadata waiting and
extraction callbacks; settle pending work on cancellation/error and stop late
effects. Keep historical public methods/events and use a documented compatibility
policy for delay/height defaults. 04 covers emitter provenance and strict TS;
05 keeps actual Safari/WebKit Blob extraction and old/new core sheet integration
open; 06 owns complete installed-package/demo checks. Reverting this task's
dedicated commit removes only tests, fixture/server registration, scripts and
refactor evidence; it does not roll back production code.
+3 -2
View File
@@ -4,7 +4,7 @@
基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 222 项,范围 22 个包及工作区/示例。
状态:todo 102 / doing 10 / blocked 0 / done 110 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
状态:todo 101 / doing 10 / blocked 0 / done 111 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。
@@ -356,7 +356,7 @@
| ID | 范围 / 步骤 | 前置依赖 | 交付物 | 验收条件 | 风险 | 状态 |
| --- | --- | --- | --- | --- | --- | --- |
| PKG-TOOL-THUMB-01 | artplayer-tool-thumbnail<br>核对包契约与历史用法 | BASE-05 | 构造/defaults/事件/方法/历史拼写、.esm.js 入口和缺失 types | 源码/声明/README/demo/可恢复发布内容差异已登记;公开形状和版本范围冻结;区分旧 npm 的 main/CSS 与当前工作区无 main、.esm.js/类型缺失,不把工作区状态冒称旧 npm 发布事实 | H | done |
| PKG-TOOL-THUMB-02 | artplayer-tool-thumbnail<br>建立特有行为与错误测试 | PKG-TOOL-THUMB-01, ENG-03, ENG-05 | 文件输入/拖放、抽帧网格、begin/end、进度/失败/重复任务 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | todo |
| PKG-TOOL-THUMB-02 | artplayer-tool-thumbnail<br>建立特有行为与错误测试 | PKG-TOOL-THUMB-01, ENG-03, ENG-05 | 文件输入/拖放、抽帧网格、begin/end、进度/失败/重复任务 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | done |
| PKG-TOOL-THUMB-03 | artplayer-tool-thumbnail<br>整理内部职责与资源 | PKG-TOOL-THUMB-02, CORE-01 | 输入、抽帧队列、网格导出、URL/监听清理分离 | 结构变化和缺陷修复分开记录;原 API/事件/资源生命周期通过 | H | todo |
| PKG-TOOL-THUMB-04 | artplayer-tool-thumbnail<br>迁移自有源码和公开类型 | PKG-TOOL-THUMB-03, ENG-04, ENG-06, CORE-07 | 补齐真实 API 声明,自有 emitter/utils TS 化 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容;为 BASE-DIST-01 提供兼容入口/声明及消费者验证 | H | todo |
| PKG-TOOL-THUMB-05 | artplayer-tool-thumbnail<br>验证新旧核心和组合 | PKG-TOOL-THUMB-04, CORE-22 | 工具独立浏览器使用,生成缩略图在核心中显示 | 最终核心与原支持范围核心分别通过;设备/SDK 缺证据不能标完成 | H | todo |
@@ -536,4 +536,5 @@
- PKG-IFRAME-04: [记录](changes/2026-09-13-PKG-IFRAME-04-types.md) [记录](baselines/iframe-types-validation.json)
- PKG-IFRAME-05: [记录](changes/2026-09-13-PKG-IFRAME-05-integration.md) [记录](baselines/iframe-integration-validation.json) [记录](changes/2026-09-13-PKG-IFRAME-05-history.md) [记录](baselines/iframe-history-validation.json)
- PKG-TOOL-THUMB-01: [记录](baselines/thumbnail-release.json) [记录](baselines/thumbnail-contract.md) [记录](changes/2026-09-13-PKG-TOOL-THUMB-01-contract.md) [记录](baselines/thumbnail-contract-validation.json)
- PKG-TOOL-THUMB-02: [记录](baselines/thumbnail-behavior-validation.json) [记录](changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md)
- PKG-FACTORY-01: [记录](baselines/factory-assignment-gaps.json) [记录](baselines/factory-compatibility-proposals.json) [记录](factory-compatibility-decision.md) [记录](changes/2026-09-12-PKG-FACTORY-01-decision.md)
+12
View File
@@ -1,5 +1,17 @@
# 进度与证据
## PKG-TOOL-THUMB-02 完成:抽帧、失败与资源基线
新增36项历史抽帧/生命周期测试,与26项契约共同通过;普通CI已接入新测试。
真实浏览器39项记录分为24个Chromium/Firefox工具场景、12个Windows WebKit
Blob不可用对照、3个原生媒体对照。验证实际PNG像素/重复生成/正常URL清理,并复现
迟到原生Blob回调在destroy后继续update和泄漏、替换文件URL泄漏、drop监听缺失。
原生HTTP能播放而Blob失败,未将WebKit对照冒称抽帧成功;原始失败报告完整保留。
完整CI1606、330生产TS检查通过。生产源码未改,03负责资源修复/拆分,04负责TS,
05/06保留WebKit/Safari实际文件抽帧和分发验收。见[变更](changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md)
与[验证](baselines/thumbnail-behavior-validation.json)。222项:111 done、10 doing、101 todo。
## PKG-TOOL-THUMB-01 完成:历史契约与发布证据
冻结11条HTTP观察、12个工作区及8个历史Git输入;恢复3.5.31 CDN主文件并逐字节
+1
View File
@@ -180,3 +180,4 @@
| THUMB-COMPAT-01 | open / 已复现 | Thumbnail recovered 3.5.31 and workspace 4.4.0 have conflicting height and event timing defaults | PKG-TOOL-THUMB-02, PKG-TOOL-THUMB-03, PKG-TOOL-THUMB-04 |
| THUMB-LIFE-01 | open / 已复现 | Thumbnail drop binding and repeated destroy fail; pending work and replacement resource ownership need repair | PKG-TOOL-THUMB-02, PKG-TOOL-THUMB-03, PKG-TOOL-THUMB-05 |
| THUMB-PROVENANCE-01 | open / 源码/产物事实 | Thumbnail local emitter attribution and historical distribution completeness remain unverified | PKG-TOOL-THUMB-04, PKG-TOOL-THUMB-06 |
| THUMB-MEDIA-01 | open / 已复现 | Windows WebKit native Blob URLs cannot load tested MP4 media despite successful HTTP controls | PKG-TOOL-THUMB-05, PKG-TOOL-THUMB-06 |
+29 -3
View File
@@ -3863,7 +3863,11 @@
"evidence": [
"refactor/baselines/thumbnail-contract.md",
"refactor/baselines/thumbnail-release.json",
"refactor/scripts/thumbnail-contract.test.mjs"
"refactor/scripts/thumbnail-contract.test.mjs",
"refactor/baselines/thumbnail-behavior-validation.json",
"refactor/changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md",
"test/thumbnail.test.js",
"test/browser/thumbnail-tool.spec.js"
]
},
{
@@ -3875,13 +3879,17 @@
"PKG-TOOL-THUMB-03",
"PKG-TOOL-THUMB-05"
],
"compatibleResolution": "Drop and duplicate-destroy defects are reproduced; reproduce source-observed extraction/timer/blob/input ownership gaps before fixes, then introduce owned cleanup without changing public shape.",
"compatibleResolution": "36 frozen behavior tests reproduce timer/input/source/callback ownership gaps and historical error ordering. Actual Chromium/Firefox native Blob callbacks prove late update and URL leaks after destroy. Task 03 must add corrected candidate regressions and owned cleanup; 05 retains real integration acceptance.",
"closureCriteria": "Deterministic old failure/candidate success for replacement, error and destruction plus real media/browser resource validation.",
"status": "open",
"evidence": [
"refactor/baselines/thumbnail-contract.md",
"refactor/baselines/thumbnail-release.json",
"refactor/scripts/thumbnail-contract.test.mjs"
"refactor/scripts/thumbnail-contract.test.mjs",
"refactor/baselines/thumbnail-behavior-validation.json",
"refactor/changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md",
"test/thumbnail.test.js",
"test/browser/thumbnail-tool.spec.js"
]
},
{
@@ -3900,6 +3908,24 @@
"refactor/baselines/thumbnail-release.json",
"refactor/scripts/thumbnail-contract.test.mjs"
]
},
{
"id": "THUMB-MEDIA-01",
"title": "Windows WebKit native Blob URLs cannot load tested MP4 media despite successful HTTP controls",
"status": "open",
"confirmation": "reproduced",
"owners": [
"PKG-TOOL-THUMB-05",
"PKG-TOOL-THUMB-06"
],
"evidence": [
"refactor/baselines/thumbnail-behavior-validation.json",
"refactor/changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md",
"test/thumbnail.test.js",
"test/browser/thumbnail-tool.spec.js"
],
"compatibleResolution": "Preserve independent HTTP/Blob capability controls; obtain actual supported WebKit/Safari file extraction evidence before release acceptance. Do not count the 12 unavailable controls as successful thumbnail generation or silently replace local files with HTTP media.",
"closureCriteria": "Actual generated PNG/extraction and lifecycle proof in supported Safari/WebKit environments, or explicit supported-environment decision with migration documentation; Windows limitation stays identifiable."
}
]
}
+5 -2
View File
@@ -3765,11 +3765,14 @@
"ENG-03",
"ENG-05"
],
"status": "todo",
"status": "done",
"risk": "H",
"deliverable": "文件输入/拖放、抽帧网格、begin/end、进度/失败/重复任务",
"acceptance": "旧版本行为可重跑,成功/失败/切源/销毁有必要断言",
"evidence": []
"evidence": [
"baselines/thumbnail-behavior-validation.json",
"changes/2026-09-13-PKG-TOOL-THUMB-02-behavior.md"
]
},
{
"id": "PKG-TOOL-THUMB-03",