mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-25 16:11:20 -08:00
test(multiple-subtitles): [PKG-MULTI-SUB-02] reproduce failures and native resource leaks
This commit is contained in:
1 parent
5a0d94cb89
commit
36cd151095
12 files changed
+5399
-19
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,62 @@
|
||||
# PKG-MULTI-SUB-02 错误与资源生命周期复现
|
||||
|
||||
在 01 的 9 份冻结实现上增加 18 类用例,共 162 项。测试读取真实 npm main/legacy
|
||||
及固定 Git 源码/产物,预期内容明确描述旧行为,不将这些通过结果解释成候选已修复。
|
||||
测试辅助宿主增加原始字节响应、独立 fetch/body 挂起、错误和真实活动 URL 计数;
|
||||
既有正常契约继续检查,未改生产源码、公开声明、parser 或构建产物。
|
||||
|
||||
## 已复现的正常与边界行为
|
||||
|
||||
- 使用当前核心的真实 getExt/srtToVtt/assToVtt 及原生 TextDecoder,验证 SRT/ASS、URL
|
||||
query、大写扩展名、Windows-1252 和 UTF-16LE。不是将 converter stub 当作解码验收。
|
||||
- 请求并行发出,返回先后不会改变轨序;名称等元数据在下载后读取,restart 不重复下载。
|
||||
- 同名轨选择第一个匹配;未知名称抛 TypeError,保留原活动 URL,随后 reset 可以恢复。
|
||||
- 各轨内部排序,但 1.1.0 起合并后不再全局排序;重叠 cue 保留各自时间。
|
||||
- 1.0.0 遇到较短后轨会抛异常,较长后轨的尾 cue 会丢失;后续版本连接所有 cue。
|
||||
- 空轨/未知格式产生空 VTT;parser 的诊断没有向外传递,坏 header 后仍可保留可用 cue。
|
||||
这是旧 parser 的容错观察,不能未经评估就统一改成严格拒绝。
|
||||
|
||||
## 已复现的问题
|
||||
|
||||
| 问题 | 旧行为 | 03 应处理的边界 |
|
||||
| --- | --- | --- |
|
||||
| 请求失败 | 原异常拒绝,但其他请求继续读取 body,没有共享取消 | 保留异常身份并回收同一注册的挂起请求 |
|
||||
| HTTP 状态 | 404 配合可解析 body 仍安装字幕 | 显式处理原生 HTTP 失败,避免错误页面成为字幕 |
|
||||
| destroy 中 fetch/body | Promise 不因 destroy 结束,响应到达后继续 init 和创建 URL | 区分两段异步边界与过期结果 |
|
||||
| destroy 后方法 | 最后 URL 不释放,tracks/reset 仍创建新 URL 和调用 init | 关闭后不再写入或分配资源 |
|
||||
| 同步 init 失败 | 原异常拒绝,但新 Blob URL 泄漏,escape 已修改 | 安装失败回滚和资源所有权 |
|
||||
| 异步 init 失败 | 插件忽略实际返回的 Promise,注册仍成功 | 观察内部拒绝,同时保护 tracks/reset 的旧 void 接口 |
|
||||
| URL 分配失败 | 先 revoke 旧 URL,随后分配失败,宿主仍指向失效资源 | 新旧资源的替换顺序与失败恢复 |
|
||||
|
||||
异步 init 失败用例由测试宿主观察真实 rejection,防止 Node 未处理拒绝结束测试;
|
||||
没有把假设的 future handler 当作旧插件已有能力。浏览器测试也仅记录真实 init 返回值和
|
||||
拒绝,不替换其实现;本次真实环境中的 init 错误数组为空。
|
||||
|
||||
## 原生浏览器证据
|
||||
|
||||
用真实 1.2.0 main 插件与发布/候选核心,在 Chromium、Firefox、Windows WebKit 上执行
|
||||
三场景,共 18 项。核心和插件指纹、浏览器版本、请求/错误记录及观察数据见
|
||||
[验证记录](../baselines/multiple-subtitles-failures.json)。三个场景为:
|
||||
|
||||
1. 真实 SRT 转换、原生 textTrack cue、播放时间推进和 DOM 字幕文本,切换/清空/reset。
|
||||
2. 原生 fetch 挂起期间 destroy:没有 AbortSignal、没有及时结束,放行后在已销毁宿主
|
||||
调用 init;真实生成的 Blob URL 仍能被原生 fetch 读取。
|
||||
3. 正常加载后 destroy:插件 URL 仍可读取;保留的 reset 随后生成另一可读取 URL。
|
||||
|
||||
成功显示场景通过真实 plugins.add;资源观察场景直接执行公开注册函数,以区分插件
|
||||
本身行为与核心插件管理器的结束保护。此证据不覆盖旧支持范围全部核心、ASS 原生显示、
|
||||
实体 Safari/移动设备、全部样式组合或在线编辑器;这些仍归 05/06。
|
||||
|
||||
## 验证和接续
|
||||
|
||||
本包命令新增失败文件,并接入主 test:unit。helper/用例显式 lint;最终完整 CI 和准确
|
||||
统计写入验证记录。包内维护文档同步。没有新依赖,不重建未改变的生产产物。
|
||||
LIFE 风险从源码观察提升为已复现;HTTP/宿主 Promise 问题单独登记,全部保持 open。
|
||||
|
||||
最终本包 215 项、原生浏览器 18 项通过;完整 CI 2285 项通过(1937 单元、14 工程、
|
||||
334 基线),严格生产 TS 仍 346 文件。任务状态更新后另跑 9 项风险/契约元数据测试通过。
|
||||
声明字节与上次指纹的差异经 Git 对照确认仅为 CRLF;验证记录同时保留工作区和 Git 指纹。
|
||||
全量 lint 保留既有生成声明的 unused-disable 警告;新增测试文件的显式 lint 无警告。
|
||||
|
||||
本任务独立本地提交,不推送、不发布。回退只移除新增复现和辅助宿主能力,生产行为不变。
|
||||
接下来 03 拆清获取/转换、纯 merge、注册与资源所有权,保持冻结契约并增加候选修复断言。
|
||||
+3
-2
@@ -4,7 +4,7 @@
|
||||
|
||||
基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 222 项,范围 22 个包及工作区/示例。
|
||||
|
||||
状态:todo 91 / doing 13 / blocked 0 / done 118 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
状态:todo 90 / doing 13 / blocked 0 / done 119 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
|
||||
|
||||
前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
| ID | 范围 / 步骤 | 前置依赖 | 交付物 | 验收条件 | 风险 | 状态 |
|
||||
| --- | --- | --- | --- | --- | --- | --- |
|
||||
| PKG-MULTI-SUB-01 | artplayer-plugin-multiple-subtitles<br>核对包契约与历史用法 | BASE-05 | subtitles/onParser、multipleSubtitles 名称及实际返回方法 | 源码/声明/README/demo/发布包差异已登记;公开形状和版本范围冻结;接续 VENDOR-03,定位 WebVTT parser 来源/修订及 CC0 头,保留解析/序列化行为 | H | done |
|
||||
| PKG-MULTI-SUB-02 | artplayer-plugin-multiple-subtitles<br>建立特有行为与错误测试 | PKG-MULTI-SUB-01, ENG-03, ENG-05 | VTT/SRT/ASS、编码/重叠 cue/排序/空轨/失败与切换 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | todo |
|
||||
| PKG-MULTI-SUB-02 | artplayer-plugin-multiple-subtitles<br>建立特有行为与错误测试 | PKG-MULTI-SUB-01, ENG-03, ENG-05 | VTT/SRT/ASS、编码/重叠 cue/排序/空轨/失败与切换 | 旧版本行为可重跑,成功/失败/切源/销毁有必要断言 | H | done |
|
||||
| PKG-MULTI-SUB-03 | artplayer-plugin-multiple-subtitles<br>整理内部职责与资源 | PKG-MULTI-SUB-02, CORE-15 | 解析与合并/获取/渲染分离,过期请求及对象 URL 清理 | 结构变化和缺陷修复分开记录;原 API/事件/资源生命周期通过 | H | todo |
|
||||
| PKG-MULTI-SUB-04 | artplayer-plugin-multiple-subtitles<br>迁移自有源码和公开类型 | PKG-MULTI-SUB-03, ENG-04, ENG-06, CORE-07 | 准确 parser/cue/tree/result 类型与真实异步形状 | 严格类型检查、旧消费样例通过;声明路径/导出和同步异步兼容 | H | todo |
|
||||
| PKG-MULTI-SUB-05 | artplayer-plugin-multiple-subtitles<br>验证新旧核心和组合 | PKG-MULTI-SUB-04, CORE-22 | 与核心字幕/偏移/全屏组合,旧名称调用不变 | 最终核心与原支持范围核心分别通过;设备/SDK 缺证据不能标完成 | H | todo |
|
||||
@@ -512,6 +512,7 @@
|
||||
- PKG-DASH-04: [记录](changes/2026-09-12-PKG-DASH-04-types.md) [记录](baselines/dash-types-validation.json) [记录](dash-validation.md)
|
||||
- PKG-DASH-05: [记录](changes/2026-09-12-PKG-DASH-05-sdk-checkpoint.md) [记录](baselines/dash-sdk.json) [记录](baselines/dash-sdk-checkpoint.json) [记录](dash-validation.md) [记录](changes/2026-09-12-PKG-DASH-05-sdk-types.md) [记录](baselines/dash-sdk-types-validation.json) [记录](changes/2026-09-12-PKG-DASH-05-sdk-events.md) [记录](baselines/dash-sdk-events-validation.json) [记录](changes/2026-09-12-PKG-DASH-05-seek-diagnosis.md) [记录](baselines/dash-seek-diagnosis.json)
|
||||
- PKG-MULTI-SUB-01: [记录](baselines/multiple-subtitles-release.json) [记录](baselines/multiple-subtitles-contract.md) [记录](baselines/multiple-subtitles-contract-validation.json) [记录](changes/2026-09-13-PKG-MULTI-SUB-01-contract.md)
|
||||
- PKG-MULTI-SUB-02: [记录](baselines/multiple-subtitles-failures.json) [记录](changes/2026-09-13-PKG-MULTI-SUB-02-failures.md)
|
||||
- PKG-ADS-01: [记录](baselines/ads-release.json) [记录](baselines/ads-contract.md) [记录](baselines/ads-contract-validation.json) [记录](changes/2026-09-12-PKG-ADS-01-contract.md) [记录](scripts/ads-contract.test.mjs)
|
||||
- PKG-ADS-02: [记录](changes/2026-09-12-PKG-ADS-02-tests.md) [记录](ads-validation.md) [记录](baselines/ads-validation.json)
|
||||
- PKG-ADS-03: [记录](changes/2026-09-12-PKG-ADS-03-lifecycle.md) [记录](ads-validation.md) [记录](baselines/ads-lifecycle-validation.json)
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# 进度与证据
|
||||
|
||||
## PKG-MULTI-SUB-02 错误与生命周期复现完成
|
||||
|
||||
9 份历史实现各 18 类异常/边界,共 162 项;本包命令及主 test:unit 已接入,
|
||||
本包 215 项通过。真实核心 converter 与 TextDecoder 覆盖 SRT/ASS/编码,另验证
|
||||
轨序、重叠、名称、空轨、坏 header 容错、错误身份、下载中销毁和保留方法。
|
||||
真实 1.2.0 插件配发布/候选核心,在 Chromium/Firefox/Windows WebKit 共 18 项通过:
|
||||
SRT 原生字幕显示与切换、挂起 fetch 销毁后继续安装、Blob URL 残留与 late reset。
|
||||
这是历史缺陷的复现成功,不代表已修复;LIFE/MERGE 保持 open,新增 HTTP/HOST 风险。
|
||||
完整 CI 2285 项通过(1937 单元、14 工程、334 基线),严格生产 TS 仍 346 文件;
|
||||
新增文件显式 lint 通过。声明指纹差异已核对仅为 CRLF,生产源码/声明/产物均未改。
|
||||
见[复现记录](changes/2026-09-13-PKG-MULTI-SUB-02-failures.md)和
|
||||
[验证证据](baselines/multiple-subtitles-failures.json)。实体设备、ASS 原生显示及完整组合仍待 05/06。
|
||||
222 项:119 done、13 doing、90 todo;196 项风险。独立本地任务提交,不推送、不发布。
|
||||
下一步 MULTI-SUB-03 拆分获取/解析合并/资源所有权并修复已复现缺陷;VTT 类型取舍继续待决。
|
||||
|
||||
|
||||
## PKG-MULTI-SUB-01 历史契约与 parser 来源完成
|
||||
|
||||
冻结三个实际 npm 版本、20 成员与 9 份 Git 输入;53 项本包契约/vendor 测试通过,
|
||||
|
||||
@@ -196,5 +196,7 @@
|
||||
| VTT-THUMB-EXPORT-01 | open / 已复现 | Older CommonJS default objects and thumbnails control names differ from latest direct export and vtt-thumbnail name | PKG-VTT-THUMB-04, PKG-VTT-THUMB-05, PKG-VTT-THUMB-06 |
|
||||
| MULTI-SUB-TYPE-01 | open / 已复现 | Declarations omit async registration, tracks/reset and make the subtitles array required | PKG-MULTI-SUB-04 |
|
||||
| MULTI-SUB-MERGE-01 | open / 已复现 | 1.0.0 merges cues by index while later versions concatenate independently timed track cues | PKG-MULTI-SUB-02, PKG-MULTI-SUB-03, PKG-MULTI-SUB-05 |
|
||||
| MULTI-SUB-LIFE-01 | open / 源码/产物事实 | Pending downloads and final object URL have no destroy owner | PKG-MULTI-SUB-02, PKG-MULTI-SUB-03, PKG-MULTI-SUB-05 |
|
||||
| MULTI-SUB-LIFE-01 | open / 已复现 | Pending downloads and final object URL have no destroy owner | PKG-MULTI-SUB-02, PKG-MULTI-SUB-03, PKG-MULTI-SUB-05 |
|
||||
| MULTI-SUB-EXPORT-01 | open / 已复现 | Older CommonJS default objects conflict with export-assignment declarations; latest exports a direct factory | PKG-MULTI-SUB-04, PKG-MULTI-SUB-06 |
|
||||
| MULTI-SUB-HTTP-01 | open / 已复现 | HTTP error responses with parseable bodies are installed as subtitles | PKG-MULTI-SUB-03, PKG-MULTI-SUB-05 |
|
||||
| MULTI-SUB-HOST-01 | open / 已复现 | Subtitle init rejections are ignored and failed installation or URL replacement leaks or invalidates resources | PKG-MULTI-SUB-03, PKG-MULTI-SUB-05 |
|
||||
+47
-3
@@ -4275,7 +4275,11 @@
|
||||
"refactor/baselines/multiple-subtitles-release.json",
|
||||
"refactor/baselines/multiple-subtitles-contract.md",
|
||||
"test/multiple-subtitles.test.js",
|
||||
"refactor/scripts/multiple-subtitles-contract.test.mjs"
|
||||
"refactor/scripts/multiple-subtitles-contract.test.mjs",
|
||||
"test/multiple-subtitles-failures.test.js",
|
||||
"test/browser/multiple-subtitles-history.spec.js",
|
||||
"refactor/baselines/multiple-subtitles-failures.json",
|
||||
"refactor/changes/2026-09-13-PKG-MULTI-SUB-02-failures.md"
|
||||
],
|
||||
"compatibleResolution": "Keep historical merge profiles explicit and test real overlap/timing before choosing compatibility behavior.",
|
||||
"closureCriteria": "Unaligned lengths, overlap, sorting, names and real subtitle display across supported cores are verified."
|
||||
@@ -4283,7 +4287,7 @@
|
||||
{
|
||||
"id": "MULTI-SUB-LIFE-01",
|
||||
"title": "Pending downloads and final object URL have no destroy owner",
|
||||
"confirmation": "source-observed",
|
||||
"confirmation": "reproduced",
|
||||
"status": "open",
|
||||
"owners": [
|
||||
"PKG-MULTI-SUB-02",
|
||||
@@ -4294,7 +4298,11 @@
|
||||
"refactor/baselines/multiple-subtitles-release.json",
|
||||
"refactor/baselines/multiple-subtitles-contract.md",
|
||||
"test/multiple-subtitles.test.js",
|
||||
"refactor/scripts/multiple-subtitles-contract.test.mjs"
|
||||
"refactor/scripts/multiple-subtitles-contract.test.mjs",
|
||||
"test/multiple-subtitles-failures.test.js",
|
||||
"test/browser/multiple-subtitles-history.spec.js",
|
||||
"refactor/baselines/multiple-subtitles-failures.json",
|
||||
"refactor/changes/2026-09-13-PKG-MULTI-SUB-02-failures.md"
|
||||
],
|
||||
"compatibleResolution": "Reproduce stale completion and own requests and URLs without changing public selection methods.",
|
||||
"closureCriteria": "Cancellation, failures, source changes, repeated selection and destroy are verified with native core coverage."
|
||||
@@ -4316,6 +4324,42 @@
|
||||
],
|
||||
"compatibleResolution": "Preserve valid historical runtime import forms and explicitly assess type-only extraction conflicts.",
|
||||
"closureCriteria": "Actual installed CJS/ESM/global/legacy consumers and their declarations are verified."
|
||||
},
|
||||
{
|
||||
"id": "MULTI-SUB-HTTP-01",
|
||||
"title": "HTTP error responses with parseable bodies are installed as subtitles",
|
||||
"compatibleResolution": "Reject actual HTTP failures with explicit diagnostics while preserving successful conversion and original transport errors.",
|
||||
"closureCriteria": "Native HTTP errors, transport/body failures, sibling cancellation and successful requests have candidate regressions.",
|
||||
"confirmation": "reproduced",
|
||||
"status": "open",
|
||||
"owners": [
|
||||
"PKG-MULTI-SUB-03",
|
||||
"PKG-MULTI-SUB-05"
|
||||
],
|
||||
"evidence": [
|
||||
"test/multiple-subtitles-failures.test.js",
|
||||
"test/browser/multiple-subtitles-history.spec.js",
|
||||
"refactor/baselines/multiple-subtitles-failures.json",
|
||||
"refactor/changes/2026-09-13-PKG-MULTI-SUB-02-failures.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "MULTI-SUB-HOST-01",
|
||||
"title": "Subtitle init rejections are ignored and failed installation or URL replacement leaks or invalidates resources",
|
||||
"compatibleResolution": "Own installation results and URL rollback while preserving void selection methods and normal registration timing.",
|
||||
"closureCriteria": "Synchronous and asynchronous host failures, stale rejection, allocation failure and destroy leave no plugin-owned live resources.",
|
||||
"confirmation": "reproduced",
|
||||
"status": "open",
|
||||
"owners": [
|
||||
"PKG-MULTI-SUB-03",
|
||||
"PKG-MULTI-SUB-05"
|
||||
],
|
||||
"evidence": [
|
||||
"test/multiple-subtitles-failures.test.js",
|
||||
"test/browser/multiple-subtitles-history.spec.js",
|
||||
"refactor/baselines/multiple-subtitles-failures.json",
|
||||
"refactor/changes/2026-09-13-PKG-MULTI-SUB-02-failures.md"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
+5
-2
@@ -2277,11 +2277,14 @@
|
||||
"ENG-03",
|
||||
"ENG-05"
|
||||
],
|
||||
"status": "todo",
|
||||
"status": "done",
|
||||
"risk": "H",
|
||||
"deliverable": "VTT/SRT/ASS、编码/重叠 cue/排序/空轨/失败与切换",
|
||||
"acceptance": "旧版本行为可重跑,成功/失败/切源/销毁有必要断言",
|
||||
"evidence": []
|
||||
"evidence": [
|
||||
"baselines/multiple-subtitles-failures.json",
|
||||
"changes/2026-09-13-PKG-MULTI-SUB-02-failures.md"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "PKG-MULTI-SUB-03",
|
||||
|
||||
Reference in new issue
Block a user