fix: retain capture evidence and control failed task recovery

This commit is contained in:
abaishu0730 committed 2026-10-26 11:00:11 +08:00
1 parent c19be938fc
commit 5bae83922c
17 files changed
+333 -35

No files matched your search

+8
View File
@@ -41,3 +41,11 @@ test('undeclared generic single-row templates do not expand and fieldsOnly remai
test('dynamic row expansion never evaluates hidden expressions or executes page scripts',{timeout:30000},async t=>{
const hydrate=await fixture(t),html=remarksHTML.replace('<table','<table hiddenexpress="(()=>{throw Error(\'NO EVAL\')})()"').replace('</form>','<script>throw Error("NO SCRIPT")</script><script src="https://evil.example/remote.js"></script></form>'),result=await hydrate(html,[backend(remarkTable,[{Remark:'ONE'},{Remark:'TWO'}])]);assert.equal(result.blocker,undefined);assert.doesNotMatch(result.snapshot.html,/<script/);assert.match(result.snapshot.html,/ONE.*TWO/s);assert.deepEqual(result.requests,[]);
});
test('dynamic datamap may include proven hidden columns without dropping visible rows',{timeout:30000},async t=>{
const hydrate=await fixture(t),html='<form><table dynamicarea="0,1" datamap="HRID->Salers.HRID;Name->Salers.Name;Dept->Salers.Dept;FullName->Salers.FullName"><tr><td><input type="hidden" xdatabind="Salers.HRID"><input xdatabind="Salers.Name"></td><td><input xdatabind="Salers.Dept"><input style="display:none" xdatabind="Salers.FullName"></td></tr></table></form>';
const tables=[backend('Salers',[{HRID:'PRIVATE-ID',Name:'A',Dept:'D1',FullName:'PRIVATE-NAME'},{HRID:'PRIVATE-ID2',Name:'B',Dept:'D2',FullName:'PRIVATE-NAME2'}])];
const result=await hydrate(html,tables);assert.equal(result.blocker,undefined);assert.match(result.snapshot.html,/>A<.*>D1<.*>B<.*>D2</s);assert.doesNotMatch(result.snapshot.html,/PRIVATE-ID|PRIVATE-NAME/);
for(const invalid of [html.replace('<input type="hidden" xdatabind="Salers.HRID">',''),html.replace('HRID->Salers.HRID','HRID->Other.HRID'),html.replace('HRID->Salers.HRID','Ghost->Salers.Ghost')])assert.ok((await hydrate(invalid,tables)).blocker);
const missing=[backend('Salers',[{Name:'A',Dept:'D1',FullName:'HIDDEN'}])];assert.ok((await hydrate(html,missing)).blocker);
});