docs(tests): clarify import loading and package validation boundaries
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* 独立导入 runner 的解析、依赖分组、发布和持久化状态机测试。每个已提交前缀可见,坏记录及取消不默认回滚全部导入。
|
||||
* 依赖循环作为强连通组原子提交;稳定 ID、待处理定位、源身份和 generation 支持恢复并隔离迟到异步准备。
|
||||
* fixture 用内存文档与克隆 cut 验证端口调用顺序;引擎/真实存储集成另有测试,不由此模拟持久层事务保证。
|
||||
* 文中的“可见”指当前文档已包含元素,未挂载 renderer;dependencies 仅用于调度,不在此 fixture 中创建真实父子/连线引用。
|
||||
*/
|
||||
import {test} from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -89,6 +90,7 @@ test('dependency backpressure pauses with locators intact and a larger budget re
|
||||
});
|
||||
|
||||
// 未来 job 版本、重复目标 ID 和缺乏结束条件的 completed cut 均在校验阶段拒绝。
|
||||
// 本例直接调用 validateImportJob,不创建 runner;验证的是记录合同,未执行或计数源读取。
|
||||
test('future interpreter versions and malformed job cuts fail before any source read',()=>{
|
||||
const job=createImportJob({id:'i',projectId:'p',sourceFingerprint:'s',parserVersion:1});assert.throws(()=>validateImportJob({...job,version:4}),/import_interpreter_unavailable/);assert.throws(()=>validateImportJob({...job,stableIds:{a:'same',b:'same'}}),/invalid_import_job/);assert.throws(()=>validateImportJob({...job,status:'completed'}),/invalid_import_job/);
|
||||
});
|
||||
@@ -121,6 +123,7 @@ test('a source I/O failure is reported after publishing all already prepared rea
|
||||
});
|
||||
|
||||
// A/B/C 循环即使 maxBatch=1 仍作为一个完整原子组提交一次,不能用软批量限制拆开依赖环。
|
||||
// maxBatch 是调度的软上限,强连通依赖组优先保持完整;这里断言一个 commit 接收三项,而不是三次单项发布。
|
||||
test('a reference cycle commits every member in one root even when the adaptive batch budget is one',async()=>{
|
||||
const f=fixture([{id:'A',dependencies:['B']},{id:'B',dependencies:['C']},{id:'C',dependencies:['A']}],{ports:{maxBatch:1}});await f.runner.start();assert.equal(f.root.job.status,'completed');assert.deepEqual(f.calls,[['A','B','C']]);assert.equal(f.commits.length,1);assert.equal(f.root.document.elements.size,3);validateImportJob(f.root.job);
|
||||
});
|
||||
@@ -151,6 +154,7 @@ test('optimistic local checkpoints use host backpressure without declaring compl
|
||||
});
|
||||
|
||||
// 最终内容 cut 或 completed 元数据保存失败均 paused;修复后续跑不重复 committed key 或 ID,仅补完持久化终态。
|
||||
// 第二次 start 复用当前内存 root;此例证明失败后原地重试,不模拟进程崩溃后仅从最后 durable cut 重开。
|
||||
test('both final content and completion-metadata storage failures pause resumably without replaying committed keys',async()=>{
|
||||
for(const phase of ['content','metadata']){
|
||||
const f=fixture([{id:'one'},{id:'two'}],{ports:{optimisticLocal:true,awaitDurabilityBudget(){}}}),persist=f.ports.persist;let broken=true;
|
||||
|
||||
Reference in New Issue
Block a user