Skip to content

Commit aa158f6

Browse files
committed
ci: guard against keeper observer feedback loops
1 parent 0d9986b commit aa158f6

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/js-syntax-check.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,24 @@ jobs:
5858
if (control === sensor) throw new Error('different repository themes should not collapse to one closing');
5959
if (!/資料|推測|分かって/.test(low)) throw new Error('low-confidence closing is not appropriately cautious');
6060
NODE
61+
- name: Guard keeper observer feedback loop
62+
run: |
63+
node <<'NODE'
64+
const fs = require('node:fs');
65+
const source = fs.readFileSync('keeper-closing-client.js', 'utf8');
66+
67+
if (/\.observe\(document\.getElementById\(['"]detailStage['"]\)/.test(source)) {
68+
throw new Error('keeper closing must not observe detailStage because it contains keeperClosing itself');
69+
}
70+
if (/\.observe\([^\n]*keeperClosing/.test(source)) {
71+
throw new Error('keeper closing must never observe its own output element');
72+
}
73+
if (!source.includes('closing.textContent !== nextText')) {
74+
throw new Error('keeper closing writes must be guarded against identical text updates');
75+
}
76+
if (!source.includes('sources.forEach')) {
77+
throw new Error('keeper closing observer should be attached only to source elements');
78+
}
79+
NODE
6180
- name: Check public-pages-client.js syntax
6281
run: node --check public-pages-client.js

0 commit comments

Comments
 (0)