fix(multiple-subtitles): repair old ASS conversion line breaks [PKG-MULTI-SUB-11]

This commit is contained in:
Harvey Zhao committed 2026-09-14 13:42:46 +08:00
1 parent 8ae2762a23
commit 318de37e8a
22 files changed
+3268 -27

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -0,0 +1,74 @@
# PKG-MULTI-SUB-11: preserve ASS conversion on old core main
## Reproduction
Frozen npm core5.1.2 has different converter behavior across its own files.
For a plain Dialogue cue, main returns
`WEBVTT 1 00:00:01.250 --> 00:00:03.750 Plain`; the source and legacy file retain
the required header, identifier, timing and payload line breaks. The plugin's
VTT parser consequently sees no ASS cue from main. These are actual verified
tarball members, not simulated converters or version-number assumptions.
The new unit regression initially passes seven baseline/legacy assertions and
fails six main-converter samples. The initial raw-string text assertion also
compared an encoded ampersand with an equivalent literal ampersand; that fixture
failure is retained separately. Canonical HTML comparison fixes the test's text
representation comparison without weakening cue timing/count or semantic markup.
The actual browser regression with the previous plugin artifact fails because
only two of three VTT/SRT/ASS cues load on5.1.2.
## Implementation and compatibility
`src/ass-conversion.ts` is a private adapter called after request decoding. It
calls the existing host converter once. Valid output takes the normal path.
For output with the old collapsed header/timing shape, the adapter reconstructs
the old converter's supported Dialogue fields, timestamp formatting and text
cleanup, then compares the entire collapsed output. Only an exact match receives
the missing structural newlines. Custom output, comments, empty results and
nonmatching malformed conversions retain their original value; exceptions still
reject registration and release owned resources.
This small duplicate of the old supported Dialogue projection is intentional:
importing runtime code from the new core would make the plugin depend on that
core version. It is not a second general ASS parser. Keep its complete-output
comparison and frozen source/legacy parity tests when editing it. Do not extend
accepted ASS syntax or modify cue timing under this repair task.
The host's shared utility is never patched, called with a probe or replaced.
The factory, methods, event order, public types, declarations, global/ESM/CJS
entries, vendor bytes and package versions stay unchanged. No dependency or
lockfile changes are needed. The new test joins existing Yarn unit/package
commands; all three package formats and docs copies are normally rebuilt.
## Validation and limits
Exact inputs, hashes, archived reports and commands are in
[the validation index](../baselines/multiple-subtitles-ass-validation.json).
- Plugin suite315/315: the new15 tests include actual old main/legacy converters,
source parity, independent timing, Unicode, inline markup, ASS line breaks,
overlapping cues, long hours, comma text, custom/empty output and failure cleanup.
- The same targeted15-test file passes with actual main and legacy plugin input.
Its frozen-host and private-adapter checks are identified separately from
full-plugin registration/selection cases in the source.
- Source browser21/21 and actual-main browser21/21. The matrix spans
core5.1.2/5.1.7/5.3.0/5.4.0/candidate in Chromium, Firefox and Windows WebKit.
It checks UTF16 input, explicit type override, native cue times/text, multiline
and semantic HTML, overlapping translation, selection/reset and clearing.
The old-host regression now uses an actual third ASS track on both5.1 cores.
- Actual legacy browser21/21. Strict TypeScript,37 declarations with zero drift,
root and changed-script lint, CI50 and plan/risk validation pass; root lint keeps
the existing generated-doc warning. Detailed evidence is retained in the index.
Close only MULTI-SUB-ASS-01 after these checks. This is conversion into VTT, not
full ASS positioning/animation/rendering, physical-device evidence, remote CI or
package publication. The old WebKit source-seek failure reopened in task10 stays
open and is not rerun or waived by this targeted conversion matrix. Tasks05/06
and the wider refactor remain incomplete.
## Maintenance and rollback
The package architecture and test READMEs describe the adapter and replay commands.
Revert this task and rebuild the plugin to restore prior behavior; preserve the
frozen converter evidence so the known old-main failure cannot be mistaken for
successful ASS compatibility. No push or publication is included.
+3 -2
View File
@@ -4,7 +4,7 @@
基线:`40fcda6a37d0049d42e49c1e64e70d4fd9ba5f7f`。总任务 251 项,范围 22 个包及工作区/示例。
状态:todo 56 / doing 17 / blocked 0 / done 178 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
状态:todo 55 / doing 17 / blocked 0 / done 179 / deferred 0。风险 L/M/H 表示兼容风险,不表示工期。
前置依赖是启动条件;验收是完成条件。任务可以继续拆分,但不能复用或悄悄删除旧 ID。
@@ -232,7 +232,7 @@
| PKG-MULTI-SUB-06 | artplayer-plugin-multiple-subtitles<br>验证分发并同步文档 | PKG-MULTI-SUB-05, ENG-07, CORE-SUBTITLE-OFFSET-01, PKG-MULTI-SUB-09, PKG-MULTI-SUB-10, PKG-MULTI-SUB-11 | multiple.subtitles.js、parser 来源许可及打包边界 | tarball 入口/资源、类型、8082 demo 和 README 一致,有回退记录 | H | todo |
| PKG-MULTI-SUB-09 | artplayer-plugin-multiple-subtitles, artplayer<br>定位旧核心切源寻址与字幕显示边界 | PKG-MULTI-SUB-08, CORE-19 | 无插件及旧新插件对照、真实事件轨迹、原切源失败归因和组合测试顺序 | 保留旧核心立即寻址观察,候选首次寻址与正常字幕组合通过;不把原生时钟失败误归为字幕丢失 | M | done |
| PKG-MULTI-SUB-10 | artplayer-plugin-multiple-subtitles<br>适配旧核心的多条活动字幕渲染 | PKG-MULTI-SUB-08, PKG-MULTI-SUB-09 | 独立旧宿主显示适配、原生异步字幕重叠回归和兼容边界说明 | 旧5.1.2/5.1.7复现先红后绿;保持原生cue对象/时间、旧事件标量和方法身份;多格式显示及清理通过,保留其他组合和设备缺口 | M | done |
| PKG-MULTI-SUB-11 | artplayer-plugin-multiple-subtitles<br>处理旧发布核心 ASS 转换器丢失换行 | PKG-MULTI-SUB-10 | 冻结5.1.2发布/源码转换差异,兼容转换适配与真实ASS字幕回归 | 保持已有效转换行为,旧发布ASS缺陷有先红后绿与实际产物证据;不得将VTT替代夹具算作ASS通过 | M | todo |
| PKG-MULTI-SUB-11 | artplayer-plugin-multiple-subtitles<br>处理旧发布核心 ASS 转换器丢失换行 | PKG-MULTI-SUB-10 | 冻结5.1.2发布/源码转换差异,兼容转换适配与真实ASS字幕回归 | 保持已有效转换行为,旧发布ASS缺陷有先红后绿与实际产物证据;不得将VTT替代夹具算作ASS通过 | M | done |
## 5 包迁移:artplayer-plugin-jassub
@@ -652,3 +652,4 @@
- CORE-SUBTITLE-OFFSET-01: [记录](changes/2026-09-14-CORE-SUBTITLE-OFFSET-01-paused.md) [记录](baselines/subtitle-offset-validation.json)
- PKG-MULTI-SUB-09: [记录](changes/2026-09-14-PKG-MULTI-SUB-09-switch-order.md) [记录](baselines/multiple-subtitles-switch-validation.json)
- PKG-MULTI-SUB-10: [记录](changes/2026-09-14-PKG-MULTI-SUB-10-legacy-captions.md) [记录](baselines/multiple-subtitles-legacy-validation.json)
- PKG-MULTI-SUB-11: [记录](changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md) [记录](baselines/multiple-subtitles-ass-validation.json)
+14
View File
@@ -1,5 +1,19 @@
# 进度与证据
## PKG-MULTI-SUB-11 旧发布核心 ASS 转换适配完成
实际5.1.2 tarball证明只有main转换器丢失模板换行,同版legacy与源码正确;新增
ASS适配模块先调用宿主转换器一次,仅当完整输出匹配已复现损坏格式才补回结构换行。
有效、自定义、空输出和异常保持原行为,不修改宿主utils、不依赖新核心、无新增依赖。
冻结转换器回归修复前6失败/7通过,旧产物浏览器仅加载2/3字幕;修复后全插件315通过,
实际main/legacy各15项定向测试通过。源码/main/legacy各21项三引擎播放通过,覆盖
5.1.2/5.1.7/5.3.0/5.4.0/候选、UTF16、多行、语义HTML、独立时间与重叠翻译、选择重置。
两个旧宿主第三轨现在都使用真实ASS。严格TS、37声明零漂移、lint与CI50通过,三格式及
docs副本正常重建;关闭ASS风险。见[变更](changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md)
和[验证索引](baselines/multiple-subtitles-ass-validation.json)。251项:179 done、17 doing、55 todo。
不计作完整ASS排版、真机或远端CI验收。旧WebKit切源风险仍open;下一步继续task05
剩余组合验收与切源诊断,随后推进分发及其他插件未完成任务。
## PKG-MULTI-SUB-10 旧核心多条字幕显示适配完成
插件以activeCue/activeCues能力检测选择旧subtitleUpdate或现代subtitleAfterUpdate,
+1 -1
View File
@@ -267,4 +267,4 @@
| MULTI-SUB-MARKUP-01 | resolved / 已复现 | Semantic cue nodes receive HTML wrappers inside their annotation fields | PKG-MULTI-SUB-08 |
| MULTI-SUB-OFFSET-01 | resolved / 已复现 | Paused Firefox subtitle offset leaves out-of-time native cues active and captions visible | PKG-MULTI-SUB-05, CORE-SUBTITLE-OFFSET-01 |
| MULTI-SUB-SWITCH-01 | open / 已复现 | Intermittent WebKit core5.3.0 caption loss after selected-track source switch | PKG-MULTI-SUB-05, PKG-MULTI-SUB-09 |
| MULTI-SUB-ASS-01 | open / 已复现 | Published core5.1.2 ASS converter loses required VTT line breaks | PKG-MULTI-SUB-11 |
| MULTI-SUB-ASS-01 | resolved / 已复现 | Published core5.1.2 ASS converter loses required VTT line breaks | PKG-MULTI-SUB-11 |
+14 -5
View File
@@ -2,7 +2,7 @@
"schemaVersion": 1,
"task": "BASE-07",
"sourceCommit": "e01f39ff",
"updatedAt": "2026-09-14T05:23:17.398Z",
"updatedAt": "2026-09-14T05:41:02.580Z",
"note": "Open means closure evidence is outstanding; source-observed and unverified are not reproduced runtime bugs. A source issue already mitigated in the workspace still requires candidate regression evidence. No accepted-with-scope item is implied by baseline task completion.",
"items": [
{
@@ -6064,7 +6064,7 @@
"id": "MULTI-SUB-ASS-01",
"title": "Published core5.1.2 ASS converter loses required VTT line breaks",
"confirmation": "reproduced",
"status": "open",
"status": "resolved",
"owners": [
"PKG-MULTI-SUB-11"
],
@@ -6072,11 +6072,20 @@
"refactor/changes/2026-09-14-PKG-MULTI-SUB-10-legacy-captions.md",
"refactor/baselines/multiple-subtitles-legacy-validation.json",
"refactor/baselines/multiple-subtitles-cores.json",
"test/browser/multiple-subtitles-legacy.spec.js"
"test/browser/multiple-subtitles-legacy.spec.js",
"refactor/changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md",
"refactor/baselines/multiple-subtitles-ass-validation.json",
"test/multiple-subtitles-ass.test.js",
"test/browser/multiple-subtitles-ass.spec.js"
],
"workspaceState": "Initial three-engine regression gets only2/3 native cues on actual5.1.2 main. Tarball source assToVtt preserves newlines while published main collapses template line breaks to spaces.5.1.7 ASS renders. Current display regression uses VTT for third5.1.2 track and explicitly does not claim ASS acceptance.",
"workspaceState": "Task11 verifies actual5.1.2 main/legacy/source hashes and repairs only complete converter output matching collapsed main line breaks. Full plugin315 and actual-format targeted tests pass; source/main/legacy each21 native desktop cases pass across5 cores and3 engines. Both old-host third tracks now use ASS. Original host utils unchanged; valid/custom output and exceptions preserved. Full ASS layout and physical devices are not claimed.",
"compatibleResolution": "Adapt malformed old conversion in the plugin while preserving valid existing converter output and public API.",
"closureCriteria": "Frozen actual-output reproduction, compatible conversion fix and real ASS display verified on old/current hosts and shippable formats."
"closureCriteria": "Frozen actual-output reproduction, compatible conversion fix and real ASS display verified on old/current hosts and shippable formats.",
"resolutionEvidence": [
"refactor/changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md",
"refactor/baselines/multiple-subtitles-ass-validation.json"
],
"resolutionRationale": "Frozen main output fails before repair while same-version legacy/source remain correct. Exact-output repair preserves valid/custom output and exception ownership.315 package checks, actual main/legacy unit cases and source/main/legacy each21 native desktop cases prove this specific conversion defect fixed, without claiming full ASS layout, device or source-seek acceptance."
}
]
}
+5 -2
View File
@@ -5212,11 +5212,14 @@
"dependsOn": [
"PKG-MULTI-SUB-10"
],
"status": "todo",
"status": "done",
"risk": "M",
"deliverable": "冻结5.1.2发布/源码转换差异,兼容转换适配与真实ASS字幕回归",
"acceptance": "保持已有效转换行为,旧发布ASS缺陷有先红后绿与实际产物证据;不得将VTT替代夹具算作ASS通过",
"evidence": []
"evidence": [
"changes/2026-09-14-PKG-MULTI-SUB-11-ass-conversion.md",
"baselines/multiple-subtitles-ass-validation.json"
]
}
]
}