dsh-vibe-math 2.7.2 → 2.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/README.en.md +11 -10
  2. package/README.md +13 -12
  3. package/cordis.patch.yml +112 -16
  4. package/docs/AUDIT-CHECKLIST.md +229 -3
  5. package/docs/COMPAT-AUDIT-ROUND2.md +35 -9
  6. package/docs/final-paper.md +2 -2
  7. package/docs/math-computation.md +13 -6
  8. package/docs/parameter-schema.md +37 -0
  9. package/docs/release-notes/README.en.md +1 -0
  10. package/docs/release-notes/README.md +1 -0
  11. package/docs/release-notes/RELEASE-NOTES-2.7.2.en.md +2 -2
  12. package/docs/release-notes/RELEASE-NOTES-2.7.2.md +3 -3
  13. package/docs/release-notes/RELEASE-NOTES-2.7.3.en.md +67 -0
  14. package/docs/release-notes/RELEASE-NOTES-2.7.3.md +67 -0
  15. package/docs/release-notes/TEMPLATE.md +6 -0
  16. package/docs/status-report-fields.md +167 -0
  17. package/docs/test-timing.md +8 -5
  18. package/installer.js +27 -17
  19. package/package.json +250 -203
  20. package/prompt-corpus-persona/persona-corpus.json +9 -9
  21. package/prompt-corpus-persona/persona-corpus.md +225 -33
  22. package/prompt-corpus-v2/formal-verify-v2.json +295 -115
  23. package/prompt-corpus-v2/formal-verify-v2.md +2287 -283
  24. package/prompt-corpus-v3/formal-verify-v3.json +105 -105
  25. package/prompt-corpus-v3/formal-verify-v3.md +213 -143
  26. package/prompt-corpus-v4/formal-verify-v4.json +18 -18
  27. package/prompt-corpus-v4/formal-verify-v4.md +49 -44
  28. package/prompt-corpus-v5/prompt-corpus-v5.json +82 -82
  29. package/prompt-corpus-v5/prompt-corpus-v5.md +451 -207
  30. package/scripts/update-doc-counts.mjs +71 -0
  31. package/tests/audit-artifact-docs.mjs +72 -0
  32. package/tests/audit-artifact-docs.mutants.mjs +58 -0
  33. package/tests/audit-installer-assertions.mutants.mjs +63 -0
  34. package/tests/audit-installer-compat.test.mjs +52 -4
  35. package/tests/audit-installer-policy.test.mjs +41 -8
  36. package/tests/audit-math-computation-contract.mjs +64 -8
  37. package/tests/audit-math-computation-contract.mutants.mjs +106 -0
  38. package/tests/audit-math-computation-parity.mjs +164 -3
  39. package/tests/audit-math-computation-sensitivity.mjs +4 -2
  40. package/tests/audit-package-membership.mjs +57 -0
  41. package/tests/audit-package-membership.mutants.mjs +28 -0
  42. package/tests/audit-participant-set-parity.mjs +160 -0
  43. package/tests/audit-path-discipline.mjs +83 -0
  44. package/tests/audit-path-discipline.mutants.mjs +51 -0
  45. package/tests/audit-persona-sensitivity.mjs +14 -0
  46. package/tests/audit-persona-surface.mutants.mjs +69 -0
  47. package/tests/audit-persona-surface.test.mjs +63 -22
  48. package/tests/audit-prompt-duplication.mjs +143 -0
  49. package/tests/audit-prompt-duplication.mutants.mjs +50 -0
  50. package/tests/audit-prompt-invariants.mjs +43 -5
  51. package/tests/audit-readme-bilingual.test.mjs +152 -0
  52. package/tests/audit-readme-counts.mjs +95 -0
  53. package/tests/audit-readme-counts.mutants.mjs +52 -0
  54. package/tests/audit-registration.mjs +78 -0
  55. package/tests/audit-status-report-fields.mjs +172 -0
  56. package/tests/audit-status-report-fields.mutants.mjs +64 -0
  57. package/tests/audit-v3-registration-parity.mjs +156 -0
  58. package/tests/audit-v5-integrity.mjs +300 -13
  59. package/tests/audit-v5-lean-abstention.mjs +392 -0
  60. package/tests/audit-v5-lean-abstention.mutants.mjs +106 -0
  61. package/tests/audit-v5-prompt-duplication.mjs +88 -0
  62. package/tests/audit-v5-prompt-duplication.mutants.mjs +34 -0
  63. package/tests/audit-v5-sensitivity.mjs +12 -7
  64. package/tests/e2e-identity-a6.mutants.mjs +65 -0
  65. package/tests/e2e-v5-round2.test.mjs +458 -13
  66. package/tests/formal-verify-v2.test.mjs +91 -43
  67. package/tests/formal-verify-v3.mutants.mjs +117 -0
  68. package/tests/formal-verify-v3.test.mjs +85 -39
  69. package/tests/formal-verify-v4.mutants.mjs +152 -0
  70. package/tests/formal-verify-v4.test.mjs +541 -9
  71. package/tests/formal-verify-v5.test.mjs +68 -9
  72. package/tests/helpers/doc-counts-format.mjs +41 -0
  73. package/tests/helpers/math-computation-fake-seam.mjs +4 -0
  74. package/tests/math-computation-a1.mutants.mjs +72 -0
  75. package/tests/math-computation-archive-rerun.mutants.mjs +65 -0
  76. package/tests/math-computation-discovery.mutants.mjs +76 -0
  77. package/tests/math-computation-shared.test.mjs +274 -5
  78. package/tests/math-computation-v2.test.mjs +767 -0
  79. package/tests/math-computation-v3.test.mjs +759 -0
  80. package/tests/math-computation-v4.mutants.mjs +133 -0
  81. package/tests/math-computation-v4.test.mjs +739 -0
  82. package/tests/prompt-v5-integrity.test.mjs +13 -2
  83. package/tests/run-tests.mjs +139 -9
  84. package/tests/run-tests.mutants.mjs +70 -0
  85. package/tests/selfdrive-v5.mjs +53 -1
  86. package/tests/selfdrive-v5.mutants.mjs +132 -0
  87. package/tests/v2-fix-probes.mutants.mjs +100 -0
  88. package/tests/v2-fix-probes.test.mjs +1039 -0
  89. package/tests/v2-list-agents-and-next-step.mutants.mjs +106 -0
  90. package/tests/v3-fix-probes.mutants.mjs +95 -0
  91. package/tests/v3-fix-probes.test.mjs +891 -0
  92. package/tests/v5-institute-fixes.mutants.mjs +190 -0
  93. package/vibe-math-v2/agent.cordis.yml +62 -6
  94. package/vibe-math-v2/math-computation.js +130 -41
  95. package/vibe-math-v2/math-engines.js +12 -12
  96. package/vibe-math-v2/vibe-math-v2.js +388 -113
  97. package/vibe-math-v2//345/256/236/347/216/260/346/226/271/346/241/210.md +5 -1
  98. package/vibe-math-v3/agent.cordis.yml +72 -6
  99. package/vibe-math-v3/math-computation.js +130 -41
  100. package/vibe-math-v3/math-engines.js +12 -12
  101. package/vibe-math-v3/vibe-math-v3.js +422 -126
  102. package/vibe-math-v4/agent.cordis.yml +44 -8
  103. package/vibe-math-v4/math-computation.js +130 -41
  104. package/vibe-math-v4/math-engines.js +12 -12
  105. package/vibe-math-v4/vibe-math-v4.js +196 -43
  106. package/vibe-math-v4//345/256/236/347/216/260/346/226/271/346/241/210.md +2 -0
  107. package/vibe-math-v5/agent.cordis.yml +46 -12
  108. package/vibe-math-v5/math-computation.js +130 -41
  109. package/vibe-math-v5/math-engines.js +12 -12
  110. package/vibe-math-v5/vibe-math-v5.js +1173 -218
  111. package/vibe-math-v5//345/256/236/347/216/260/346/226/271/346/241/210.md +80 -12
  112. package/vibe-math-v5//346/236/266/346/236/204/345/233/276.md +2 -2
@@ -0,0 +1,152 @@
1
+ // Registered mutant harness for the v4 formal-verify suite — the suite carries its own proof.
2
+ // Mirrors tests/v5-institute-fixes.mutants.mjs: each family is a SINGLE content-anchored mutation of the
3
+ // v4 preset (no line numbers), the suite runs through the V4_PLUGIN seam, child runs are bounded (a
4
+ // timeout is a HANG, never a pass), and skipped families are printed and counted.
5
+ // Exit criterion: every family reddens BY NAME; ALL MUTANTS RED AS REQUIRED + exit 0 only then.
6
+ // Run: node tests/formal-verify-v4.mutants.mjs
7
+ import { readFileSync, writeFileSync, mkdirSync, copyFileSync, rmSync, readdirSync } from 'node:fs'
8
+ import { execFileSync } from 'node:child_process'
9
+ import { dirname, join } from 'node:path'
10
+ import { tmpdir } from 'node:os'
11
+ import { fileURLToPath } from 'node:url'
12
+ const HERE = dirname(fileURLToPath(import.meta.url))
13
+ const REPO = join(HERE, '..')
14
+ const PRESET = 'vibe-math-v4'
15
+ const MAIN = PRESET + '.js'
16
+ const SUITE = 'tests/formal-verify-v4.test.mjs'
17
+ const ENV = 'V4_PLUGIN'
18
+ // The formal-verify suite is long, so the default child budget is generous; MUTANT_CHILD_TIMEOUT_MS
19
+ // overrides it.
20
+ const CHILD_TIMEOUT_MS = Number(process.env.MUTANT_CHILD_TIMEOUT_MS || 300000)
21
+ const TIMES = []
22
+ const hangs = []
23
+ const skipped = []
24
+ function copyGraph(file, dest) {
25
+ const src = join(REPO, PRESET, file)
26
+ copyFileSync(src, join(dest, file))
27
+ for (const m of readFileSync(src, 'utf8').matchAll(/from\s+'(\.\/[A-Za-z0-9_.-]+\.js)'/g)) {
28
+ const dep = m[1].slice(2)
29
+ if (!readdirSync(dest).includes(dep)) copyGraph(dep, dest)
30
+ }
31
+ }
32
+ function runFamily(f) {
33
+ const dest = join(tmpdir(), 'v4fv-mut-' + Math.random().toString(36).slice(2, 10))
34
+ mkdirSync(dest, { recursive: true })
35
+ copyGraph(MAIN, dest)
36
+ const target = join(dest, f.editFile || MAIN)
37
+ const before = readFileSync(target, 'utf8')
38
+ const n = before.split(f.from).length - 1
39
+ const okCount = f.lastOnly || f.all ? n >= 1 : n === 1
40
+ if (!okCount) {
41
+ skipped.push(f.name + ' (anchor x' + n + ')')
42
+ console.error(' SKIP - ' + f.name + ' (anchor x' + n + ')')
43
+ rmSync(dest, { recursive: true, force: true })
44
+ return false
45
+ }
46
+ const mutated = f.lastOnly
47
+ ? (() => { const i = before.lastIndexOf(f.from); return before.slice(0, i) + f.to + before.slice(i + f.from.length) })()
48
+ : before.split(f.from).join(f.to)
49
+ writeFileSync(target, mutated, 'utf8')
50
+ try { execFileSync(process.execPath, ['--check', target], { stdio: 'pipe' }) }
51
+ catch (e) {
52
+ writeFileSync(target, before, 'utf8')
53
+ skipped.push(f.name + ' (mutation did not compile)')
54
+ console.error(' SKIP - ' + f.name + ' (mutation did not compile; restored)')
55
+ rmSync(dest, { recursive: true, force: true })
56
+ return false
57
+ }
58
+ const t0 = Date.now()
59
+ let out = ''
60
+ let code = 0
61
+ let hang = false
62
+ try {
63
+ out = execFileSync(process.execPath, [SUITE], {
64
+ cwd: REPO, encoding: 'utf8', timeout: CHILD_TIMEOUT_MS, killSignal: 'SIGKILL',
65
+ env: Object.assign({}, process.env, { [ENV]: join(dest, MAIN) }),
66
+ })
67
+ } catch (e) {
68
+ if (e && (e.killed || e.signal === 'SIGKILL')) hang = true
69
+ code = (e && e.status) || 1
70
+ out = String((e && e.stdout) || '') + String((e && e.stderr) || '')
71
+ }
72
+ const ms = Date.now() - t0
73
+ TIMES.push([f.name, ms])
74
+ if (hang) hangs.push(f.name + '(' + Math.round(ms / 1000) + 's)')
75
+ const named = out.split(/\r?\n/).filter((l) => /^\s*(FAIL - | {2}- )/.test(l) && f.expect.test(l)).map((l) => l.trim())
76
+ const ok = !hang && code !== 0 && named.length > 0
77
+ console.log((hang ? ' HANG - ' : (ok ? ' ok - ' : ' FAIL - ')) + f.name + ' [' + ms + 'ms]' + (named.length ? ' :: ' + named[0].slice(0, 150) : ' :: no named red (exit=' + code + ')'))
78
+ rmSync(dest, { recursive: true, force: true })
79
+ return ok
80
+ }
81
+ const FAMILIES = [
82
+ {
83
+ // R10-F1: reading `allow` (a permission LIST) as a fence root — this is the branch the no-op path
84
+ // must keep dead, and the red proves case 1b actually reaches the helper with that shape.
85
+ name: 'F-5/1b: treat `allow` as a fence root',
86
+ from: ' else if(p.config && p.config.workspaceRoot !== undefined) pick = p.config.workspaceRoot',
87
+ to: ' else if(p.config && p.config.workspaceRoot !== undefined) pick = p.config.workspaceRoot\n else if(p.allow !== undefined) pick = p.allow',
88
+ expect: /F-5\/1b .*produces NO warning/,
89
+ },
90
+ {
91
+ // the whole comparison removed: a real drift goes unnamed
92
+ name: 'F-5/ii: the drift comparison is never called',
93
+ from: 'fenceRootDriftNote(p);',
94
+ to: 'void 0;',
95
+ expect: /F-5\/ii the drift is NAMED exactly once/,
96
+ },
97
+ {
98
+ // containment disabled: agreeing/ancestor roots would warn (the per-session false alarm)
99
+ name: 'F-5/iii+iv: the containment predicate is disabled (always warn)',
100
+ from: ' if(contained) return',
101
+ to: ' if(false) return',
102
+ expect: /F-5\/iv an AGREEING resolved root produces NO warning/,
103
+ },
104
+ {
105
+ // one-shot dropped: the warning repeats on every policy resolution
106
+ name: 'F-5/ii: the one-shot is dropped',
107
+ from: ' if(!warnedFenceDrift){',
108
+ to: ' if(true){',
109
+ expect: /F-5\/ii the drift is NAMED exactly once .*matched=2/,
110
+ },
111
+ {
112
+ // F-6 site 4: the swallowed compaction failure becomes silent again
113
+ name: 'N15/4: the compaction-failure warning is silenced',
114
+ from: '} catch(e){ if(!warnedCompaction){ warnedCompaction=true;',
115
+ to: '} catch(e){ if(false){ warnedCompaction=true;',
116
+ expect: /N15\/4 realCompact: a failed compaction is NAMED exactly once/,
117
+ },
118
+ {
119
+ // F-5/1c: the `.` clause of the guard is dropped, so an UNKNOWN session cwd (workspaceRoot() ===
120
+ // ".") is reported as drift even though it is constructively unknown, not drifted.
121
+ name: 'F-5/1c: an unknown session cwd is warned about',
122
+ from: " if(!session || session === '.') return",
123
+ to: ' if(!session) return',
124
+ expect: /F-5\/1c an UNKNOWN session cwd stays SILENT/,
125
+ },
126
+ {
127
+ // F6-v4: the `.current` marker write fails silently again (its guard is removed).
128
+ name: 'N18: a failed current-project marker write is silent again',
129
+ from: 'if(ok===false && !warnedCurrentProject){',
130
+ to: 'if(false){',
131
+ expect: /N18 the failed .*write is NAMED exactly once/,
132
+ },
133
+ {
134
+ // ③: the in-function naming is removed again, so a failed index write is silent for all six
135
+ // callers (the measured pre-fix behaviour).
136
+ name: 'N20-3b: a failed index write is silent again',
137
+ from: 'if((_idxLibOk === false || _idxProvedOk === false) && !warnedIndexRebuild){',
138
+ to: 'if(false){',
139
+ expect: /N20-3b a failed index write is NAMED exactly once/
140
+ },
141
+ ]
142
+ let red = 0
143
+ for (const f of FAMILIES) { const ok = runFamily(f); if (ok) red++ }
144
+ console.log('')
145
+ console.log('mutant families reddening the v4 formal-verify suite by name: ' + red + '/' + FAMILIES.length)
146
+ console.log('timings: ' + TIMES.map((t) => String(t[0]).split(':')[0] + '=' + t[1] + 'ms').join(' '))
147
+ const totalMs = TIMES.reduce((a, t) => a + t[1], 0)
148
+ console.log('TOTAL WALL TIME (all families + setup): ' + totalMs + 'ms (' + Math.round(totalMs / 1000) + 's)')
149
+ console.log('hangs=[' + hangs.join(' | ') + ']')
150
+ console.log('skipped=[' + skipped.join(' | ') + ']')
151
+ if (red !== FAMILIES.length || skipped.length || hangs.length) process.exit(1)
152
+ console.log('ALL MUTANTS RED AS REQUIRED')