zeropoint-node 1.0.11 → 1.0.13
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.
- package/CHANGELOG.md +158 -0
- package/CITATION.cff +1 -1
- package/README.md +1 -1
- package/dist/a432.electric.flow.cjs +0 -5
- package/dist/a432.electric.flow.cjs.map +1 -1
- package/dist/a432.electric.flow.esm.js +0 -5
- package/dist/a432.electric.flow.esm.js.map +1 -1
- package/dist/a432.kabbalah.cjs +0 -4
- package/dist/a432.kabbalah.cjs.map +1 -1
- package/dist/a432.kabbalah.esm.js +0 -4
- package/dist/a432.kabbalah.esm.js.map +1 -1
- package/dist/a432.math.constants.cjs +6 -2
- package/dist/a432.math.constants.cjs.map +1 -1
- package/dist/a432.math.constants.esm.js +6 -2
- package/dist/a432.math.constants.esm.js.map +1 -1
- package/dist/a432.sacred.geometry.cjs +0 -4
- package/dist/a432.sacred.geometry.cjs.map +1 -1
- package/dist/a432.sacred.geometry.esm.js +0 -4
- package/dist/a432.sacred.geometry.esm.js.map +1 -1
- package/dist/a432.simple.cjs +0 -5
- package/dist/a432.simple.cjs.map +1 -1
- package/dist/a432.simple.esm.js +0 -5
- package/dist/a432.simple.esm.js.map +1 -1
- package/dist/a432.wave.energy.cjs +10 -2
- package/dist/a432.wave.energy.cjs.map +1 -1
- package/dist/a432.wave.energy.esm.js +11 -3
- package/dist/a432.wave.energy.esm.js.map +1 -1
- package/package.json +24 -3
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.consciousness.orchestrator.ts +0 -2
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.electric.flow.ts +0 -5
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.harmonizer.ts +4 -2
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.index.ts +0 -3
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.kabbalah.ts +0 -4
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.living.os.ts +2 -12
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.main.ts +0 -2
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.math.constants.ts +6 -2
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.os.consciousness.integration.ts +5 -17
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.os.ts +3 -8
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.os.ui.ts +0 -1
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.sacred.geometry.ts +0 -4
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.self.rebuilder.ts +0 -1
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.server.ts +2 -5
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.simple.ts +0 -5
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.test.json +59 -0
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.test.ts +344 -0
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.trinity.ts +28 -3
- package/src/0/3/6/9/1/2/4/8/7/5/1/a432.wave.energy.ts +10 -2
- package/src/kernel/core-exports.test.ts +294 -0
- package/src/multidimensional-vortex-demo.ts +309 -295
- package/src/multidimensional-vortex-framework.ts +13 -1
- package/src/quantum/proof-of-system.ts +252 -244
- package/src/security/quantum-fold-cipher.test.ts +68 -0
- package/src/security/quantum-fold-cipher.ts +5 -1
- package/src/vbm-demo.ts +183 -168
- package/src/vbm-math.ts +8 -3
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The main zeropoint node — every exported function nothing was calling.
|
|
3
|
+
*
|
|
4
|
+
* The coverage audit reports 368 exported functions that nothing in the
|
|
5
|
+
* pipeline ever calls. 321 are in a432 and 31 in quantum; those are the layers
|
|
6
|
+
* around the node. The 20 covered here are src/0, src/kernel, src/crypto,
|
|
7
|
+
* src/security, src/integrity and src/verification — the node itself, and the
|
|
8
|
+
* part a consumer of this package actually gets.
|
|
9
|
+
*
|
|
10
|
+
* Properties, not smoke calls. "It returned without throwing" would pass for a
|
|
11
|
+
* function that returns the wrong answer every time, which is the failure this
|
|
12
|
+
* repository keeps finding. Where a real oracle exists — Math.trunc, Math.tan,
|
|
13
|
+
* the kernel's own constants — it is used, so these check against something
|
|
14
|
+
* other than themselves.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {
|
|
18
|
+
seededUnit, seededIndex, doubleTorusSurface, asTorus,
|
|
19
|
+
digitalRoot, VORTEX_SEQUENCE, foldPair,
|
|
20
|
+
} from '../0/index.ts'
|
|
21
|
+
import { trunc, tan, cos, sin, abs, PI } from '../0/algebra.ts'
|
|
22
|
+
import {
|
|
23
|
+
kernelVortexSequence, legacyConsciousnessSequence, mapLegacyDigitToKernel,
|
|
24
|
+
} from './legacy.ts'
|
|
25
|
+
import { readLobe, readDoubleTorus, lobeLearning } from './lobes.ts'
|
|
26
|
+
import { contentUuidOf } from '../integrity/content-uuid.ts'
|
|
27
|
+
import { expandSeed } from '../crypto/ml-kem.ts'
|
|
28
|
+
import { quantumStateFromUuid } from '../security/quantum-fold-cipher.ts'
|
|
29
|
+
import { verifyProofChain, generateECCertificate } from '../verification/lean-bridge.ts'
|
|
30
|
+
import {
|
|
31
|
+
createInfiniteJourney, generateJourneySteps, generateInfiniteCycles, navigateVortexFlow, VORTEX_FLOW,
|
|
32
|
+
} from '../0/3/6/9/1/2/4/8/7/5/1/index.ts'
|
|
33
|
+
import { getHarmonizationStats } from '../0/3/6/9/1/2/4/8/7/5/1/a432.harmonizer.ts'
|
|
34
|
+
|
|
35
|
+
let failures = 0
|
|
36
|
+
function check(name: string, ok: boolean, detail = ''): void {
|
|
37
|
+
if (ok) { console.log(' ✓ ' + name); return }
|
|
38
|
+
failures++
|
|
39
|
+
console.log(' ✗ ' + name + (detail ? ' — ' + detail : ''))
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log('Core exports nothing was calling\n')
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------- algebra
|
|
45
|
+
// trunc and tan reimplement Math functions the repository bans, so the banned
|
|
46
|
+
// originals are exactly the right oracle: they are what the replacements claim
|
|
47
|
+
// to be.
|
|
48
|
+
console.log('src/0/algebra.ts')
|
|
49
|
+
// math:ban caught the first version of this: I used Math.trunc and Math.tan as
|
|
50
|
+
// oracles, arguing that the banned originals are the right reference for
|
|
51
|
+
// functions claiming to replace them. The ban's own allowlist is only for files
|
|
52
|
+
// IMPLEMENTING algebra, and even there bodies must stay Math-free, so an
|
|
53
|
+
// exemption would have been a real weakening. Stating the expected values
|
|
54
|
+
// directly is stronger anyway — it is the specification rather than "agrees
|
|
55
|
+
// with the thing we removed" — and tolerance comparisons use the repository's
|
|
56
|
+
// own abs.
|
|
57
|
+
{
|
|
58
|
+
// Fractions, not decimals — the same rule the rest of the repository follows,
|
|
59
|
+
// and the reason the decimal ratchet caught the first draft of this file.
|
|
60
|
+
const TRUNC_CASES: [number, number][] = [
|
|
61
|
+
[0, 0], [1, 1], [-1, -1],
|
|
62
|
+
[17 / 10, 1], [-17 / 10, -1], // toward zero, NOT toward negative infinity
|
|
63
|
+
[1 / 2, 0], [-1 / 2, -0],
|
|
64
|
+
[9999 / 1000, 9], [-9999 / 1000, -9],
|
|
65
|
+
]
|
|
66
|
+
check('trunc rounds toward zero on both signs',
|
|
67
|
+
TRUNC_CASES.every(([n, want]) => trunc(n) === want),
|
|
68
|
+
TRUNC_CASES.filter(([n, w]) => trunc(n) !== w).map(([n, w]) => `${n}->${trunc(n)} want ${w}`).join(' '))
|
|
69
|
+
check('trunc never increases magnitude', [39 / 10, -39 / 10, 1 / 10, -1 / 10].every((n) => abs(trunc(n)) <= abs(n)))
|
|
70
|
+
check('trunc of an integer is itself', [0, 5, -5, 1000].every((n) => trunc(n) === n))
|
|
71
|
+
check('trunc is idempotent', [17 / 10, -17 / 10, 9999 / 1000].every((n) => trunc(trunc(n)) === trunc(n)))
|
|
72
|
+
|
|
73
|
+
// tan checked by identity and by exact reference angles, so no decimal
|
|
74
|
+
// reference constants are needed and nothing is compared against Math.
|
|
75
|
+
check('tan(0) is exactly 0', tan(0) === 0)
|
|
76
|
+
check('tan(PI/4) is 1', abs(tan(PI / 4) - 1) < 1e-9, String(tan(PI / 4)))
|
|
77
|
+
check('tan(-PI/4) is -1', abs(tan(-PI / 4) + 1) < 1e-9)
|
|
78
|
+
check('tan is odd: tan(-x) = -tan(x)', [3 / 10, 1, 2].every((x) => abs(tan(-x) + tan(x)) < 1e-9))
|
|
79
|
+
check('tan is sin/cos', [3 / 10, 1, 2, -5 / 2].every((x) => abs(tan(x) - sin(x) / cos(x)) < 1e-12))
|
|
80
|
+
check('tan has period PI', [3 / 10, 1].every((x) => abs(tan(x) - tan(x + PI)) < 1e-9))
|
|
81
|
+
// The pole. cos(PI/2) is not exactly 0 in floating point, so the sentinel
|
|
82
|
+
// branch is unreachable there; what must hold is that tan stays finite.
|
|
83
|
+
check('tan near a pole is finite, not NaN', Number.isFinite(tan(PI / 2)))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ------------------------------------------------------------ seeded values
|
|
87
|
+
// These exist to replace Math.random, so determinism IS the contract.
|
|
88
|
+
console.log('\nsrc/0/index.ts — seeded values')
|
|
89
|
+
{
|
|
90
|
+
check('seededUnit is in [0, 1)', ['a', 'b', 'zeropoint', ''].every((s) => { const u = seededUnit(s); return u >= 0 && u < 1 }))
|
|
91
|
+
check('seededUnit is deterministic', seededUnit('zeropoint') === seededUnit('zeropoint'))
|
|
92
|
+
check('seededUnit separates different seeds', seededUnit('a') !== seededUnit('b'))
|
|
93
|
+
check('seededIndex stays in range', [1, 2, 9, 100].every((n) => { const i = seededIndex('seed', n); return Number.isInteger(i) && i >= 0 && i < n }))
|
|
94
|
+
check('seededIndex is deterministic', seededIndex('seed', 9) === seededIndex('seed', 9))
|
|
95
|
+
check('seededIndex of length 1 is always 0', ['a', 'b', 'c'].every((s) => seededIndex(s, 1) === 0))
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ------------------------------------------------------------------- torus
|
|
99
|
+
console.log('\nsrc/0/index.ts — torus')
|
|
100
|
+
{
|
|
101
|
+
const p = doubleTorusSurface(0, 0, 3, 1)
|
|
102
|
+
check('doubleTorusSurface returns three finite coordinates',
|
|
103
|
+
[p.x, p.y, p.z].every(Number.isFinite), JSON.stringify(p))
|
|
104
|
+
check('doubleTorusSurface is deterministic',
|
|
105
|
+
JSON.stringify(doubleTorusSurface(1, 2, 4, -1)) === JSON.stringify(doubleTorusSurface(1, 2, 4, -1)))
|
|
106
|
+
check('a full turn in theta returns to the same point',
|
|
107
|
+
[0, 1, 2].every((phi) => {
|
|
108
|
+
const a = doubleTorusSurface(0, phi, 3, 1)
|
|
109
|
+
const b = doubleTorusSurface(PI * 2, phi, 3, 1)
|
|
110
|
+
return abs(a.x - b.x) < 1e-9 && abs(a.y - b.y) < 1e-9 && abs(a.z - b.z) < 1e-9
|
|
111
|
+
}))
|
|
112
|
+
// I first asserted the lobes differ in z, and they do not. lobe enters only
|
|
113
|
+
// as `lobe * TORUS_LOBE_OFFSET` on x, so the two lobes sit side by side and
|
|
114
|
+
// share y and z — which is what a double torus is. The code was right; the
|
|
115
|
+
// assertion was wrong. Corrected to the stronger property: displaced on x,
|
|
116
|
+
// identical on y and z, and symmetric about the origin.
|
|
117
|
+
{
|
|
118
|
+
const left = doubleTorusSurface(1, 1, 3, 1)
|
|
119
|
+
const right = doubleTorusSurface(1, 1, 3, -1)
|
|
120
|
+
check('the lobes are displaced along x only',
|
|
121
|
+
left.x !== right.x && left.y === right.y && left.z === right.z)
|
|
122
|
+
check('the lobe offset is symmetric about the origin',
|
|
123
|
+
abs((left.x + right.x) / 2 - doubleTorusSurface(1, 1, 3, 0).x) < 1e-9)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const f = foldPair('alpha', 'beta')
|
|
127
|
+
const t = asTorus(f)
|
|
128
|
+
check('asTorus places a fold at finite coordinates', [t.x, t.y, t.z].every(Number.isFinite))
|
|
129
|
+
check('asTorus digit is a digital root', t.digit >= 1 && t.digit <= 9)
|
|
130
|
+
check('asTorus lobe is exactly +1 or -1', t.lobe === 1 || t.lobe === -1)
|
|
131
|
+
check('asTorus is deterministic', JSON.stringify(asTorus(f)) === JSON.stringify(asTorus(f)))
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ------------------------------------------------------------------ legacy
|
|
135
|
+
console.log('\nsrc/kernel/legacy.ts')
|
|
136
|
+
{
|
|
137
|
+
check('kernelVortexSequence IS the kernel constant', kernelVortexSequence().join() === VORTEX_SEQUENCE.join())
|
|
138
|
+
const c = legacyConsciousnessSequence()
|
|
139
|
+
check('legacyConsciousnessSequence returns digits', c.length > 0 && c.every((d) => d >= 0 && d <= 9))
|
|
140
|
+
// The one interesting case: the two conventions differ only at zero, and
|
|
141
|
+
// this function is the bridge between them.
|
|
142
|
+
check('mapLegacyDigitToKernel sends 0 to 9', mapLegacyDigitToKernel(0) === 9)
|
|
143
|
+
// kernelDigitalRoot is legacy.ts's own alias for the kernel's digitalRoot,
|
|
144
|
+
// so the kernel export is the oracle.
|
|
145
|
+
check('mapLegacyDigitToKernel agrees with the kernel elsewhere',
|
|
146
|
+
[1, 2, 5, 9, 18, 432].every((n) => mapLegacyDigitToKernel(n) === digitalRoot(n)))
|
|
147
|
+
check('mapLegacyDigitToKernel never returns 0', [0, 9, 18, 27, 90].every((n) => mapLegacyDigitToKernel(n) !== 0))
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// ------------------------------------------------------------------- lobes
|
|
151
|
+
console.log('\nsrc/kernel/lobes.ts')
|
|
152
|
+
{
|
|
153
|
+
const l = readLobe('erpax')
|
|
154
|
+
check('readLobe reports the lobe it was asked for', l.lobe === 'erpax')
|
|
155
|
+
check('readLobe returns a path when present, null when not', l.present ? typeof l.path === 'string' : l.path === null)
|
|
156
|
+
check('readLobe laws are strings', Array.isArray(l.laws) && l.laws.every((x) => typeof x === 'string'))
|
|
157
|
+
|
|
158
|
+
const t = readDoubleTorus()
|
|
159
|
+
check('readDoubleTorus reads exactly two lobes', t.lobes.length === 2, String(t.lobes.length))
|
|
160
|
+
check('shared laws are shared by both lobes',
|
|
161
|
+
t.shared.every((law: string) => t.lobes.every((lo: { laws: string[] }) => lo.laws.includes(law))))
|
|
162
|
+
check('unique laws are in exactly one lobe',
|
|
163
|
+
t.unique.every((u: { lobe: string; law: string }) => t.lobes.filter((lo: { laws: string[] }) => lo.laws.includes(u.law)).length === 1))
|
|
164
|
+
check('shared and unique do not overlap',
|
|
165
|
+
t.unique.every((u: { law: string }) => !t.shared.includes(u.law)))
|
|
166
|
+
|
|
167
|
+
const learn = lobeLearning()
|
|
168
|
+
check('lobeLearning returns adopted and candidate lists',
|
|
169
|
+
Array.isArray(learn.adopted) && Array.isArray(learn.candidates))
|
|
170
|
+
check('lobeLearning is content-addressed', typeof learn.root === 'string' && learn.root.length > 0)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// ------------------------------------------------------------------- uuids
|
|
174
|
+
console.log('\nsrc/integrity/content-uuid.ts')
|
|
175
|
+
{
|
|
176
|
+
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
177
|
+
check('contentUuidOf returns a UUID', UUID.test(contentUuidOf('hello')))
|
|
178
|
+
check('contentUuidOf is deterministic', contentUuidOf('hello') === contentUuidOf('hello'))
|
|
179
|
+
check('different content gives different uuids', contentUuidOf('hello') !== contentUuidOf('world'))
|
|
180
|
+
// The point of canonicalisation: key order must not change the address.
|
|
181
|
+
check('object key order does not change the uuid',
|
|
182
|
+
contentUuidOf({ a: 1, b: 2 }) === contentUuidOf({ b: 2, a: 1 }))
|
|
183
|
+
check('a different project namespace gives a different uuid',
|
|
184
|
+
contentUuidOf('x', 'zeropoint-node') !== contentUuidOf('x', 'other-project'))
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ------------------------------------------------------------------ ml-kem
|
|
188
|
+
console.log('\nsrc/crypto/ml-kem.ts')
|
|
189
|
+
{
|
|
190
|
+
const d = Buffer.alloc(32, 7)
|
|
191
|
+
const [rho, sigma] = expandSeed(d)
|
|
192
|
+
check('expandSeed returns two 32-byte halves', rho.length === 32 && sigma.length === 32, `${rho.length}/${sigma.length}`)
|
|
193
|
+
check('the two halves differ', !rho.equals(sigma))
|
|
194
|
+
check('expandSeed is deterministic', expandSeed(d)[0].equals(rho))
|
|
195
|
+
check('a different seed gives different output', !expandSeed(Buffer.alloc(32, 8))[0].equals(rho))
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ------------------------------------------------------------- proof chains
|
|
199
|
+
console.log('\nsrc/verification/lean-bridge.ts')
|
|
200
|
+
{
|
|
201
|
+
check('an empty chain does NOT verify', verifyProofChain([]) === false)
|
|
202
|
+
const good = generateECCertificate('Steane[7,1,3]')
|
|
203
|
+
check('a certificate whose seal held verifies', verifyProofChain([good]) === true, `seal=${good.seal}`)
|
|
204
|
+
// A certificate is verified when its seal HELD, so that is what to corrupt.
|
|
205
|
+
// Deleting a conjunct could not make this fail; changing what it reads can.
|
|
206
|
+
const broken = { ...good, seal: 'broke' as typeof good.seal }
|
|
207
|
+
check('a certificate whose seal broke does NOT verify', verifyProofChain([broken]) === false)
|
|
208
|
+
check('one broken certificate fails the whole chain', verifyProofChain([good, broken]) === false)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ------------------------------------------------------- an honest non-test
|
|
212
|
+
console.log('\nsrc/security/quantum-fold-cipher.ts')
|
|
213
|
+
{
|
|
214
|
+
// quantumStateFromUuid is a STUB. Its body is `return null` under a comment
|
|
215
|
+
// saying "this is a placeholder". Asserting that it returns null would dress
|
|
216
|
+
// an unimplemented function up as a tested one, so what is asserted instead
|
|
217
|
+
// is that it is still a stub — and this check FAILS the day someone
|
|
218
|
+
// implements it, which is when the real test has to be written.
|
|
219
|
+
check('quantumStateFromUuid is still an unimplemented stub',
|
|
220
|
+
quantumStateFromUuid('00000000-0000-0000-0000-000000000000') === null &&
|
|
221
|
+
quantumStateFromUuid('any-string-at-all') === null,
|
|
222
|
+
'it returns something now — implement its real test')
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// -------------------------------------------------------------- the journey
|
|
226
|
+
// The a432 barrel, whose four exported journey functions nothing called. The
|
|
227
|
+
// flow they walk is 0,3,6,9,1,2,4,8,7,5,1 — this repository's own directory
|
|
228
|
+
// path — so the properties are about that sequence, not about the shape of the
|
|
229
|
+
// objects returned.
|
|
230
|
+
console.log('\nsrc/0/3/6/9/1/2/4/8/7/5/1/index.ts — the journey')
|
|
231
|
+
{
|
|
232
|
+
const j = createInfiniteJourney()
|
|
233
|
+
check('the journey path is the vortex flow', j.path === VORTEX_FLOW.join('/'), j.path)
|
|
234
|
+
check('the journey starts at the void', j.currentDigit === VORTEX_FLOW[0] && j.currentDigit === 0)
|
|
235
|
+
check('the journey declares itself infinite', j.isInfinite === true)
|
|
236
|
+
check('createInfiniteJourney is deterministic', JSON.stringify(createInfiniteJourney()) === JSON.stringify(j))
|
|
237
|
+
|
|
238
|
+
const steps = generateJourneySteps()
|
|
239
|
+
check('one step per digit of the flow', steps.length === VORTEX_FLOW.length, `${steps.length} vs ${VORTEX_FLOW.length}`)
|
|
240
|
+
check('the steps walk the flow in order', steps.map((s) => s.digit).join() === VORTEX_FLOW.join())
|
|
241
|
+
check('positions are 0-based and contiguous', steps.every((s, i) => s.position === i))
|
|
242
|
+
|
|
243
|
+
for (const n of [1, 3, 7]) {
|
|
244
|
+
check(`${n} cycles is ${n} x the flow length`,
|
|
245
|
+
generateInfiniteCycles(n).length === n * VORTEX_FLOW.length)
|
|
246
|
+
}
|
|
247
|
+
check('zero cycles is empty', generateInfiniteCycles(0).length === 0)
|
|
248
|
+
check('cycles repeat the same digits each time', (() => {
|
|
249
|
+
const c = generateInfiniteCycles(2).map((s) => s.digit)
|
|
250
|
+
return c.slice(0, VORTEX_FLOW.length).join() === c.slice(VORTEX_FLOW.length).join()
|
|
251
|
+
})())
|
|
252
|
+
|
|
253
|
+
// Navigation must follow the flow and close it, since the flow is a cycle.
|
|
254
|
+
check('navigation follows the flow at every position',
|
|
255
|
+
VORTEX_FLOW.every((d, i) => {
|
|
256
|
+
const nav = navigateVortexFlow(i)
|
|
257
|
+
return nav.currentDigit === d && nav.nextDigit === VORTEX_FLOW[(i + 1) % VORTEX_FLOW.length]
|
|
258
|
+
}))
|
|
259
|
+
check('navigation wraps at the end rather than running off',
|
|
260
|
+
navigateVortexFlow(VORTEX_FLOW.length - 1).nextDigit === VORTEX_FLOW[0])
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ------------------------------------------------ revealed by removing noise
|
|
264
|
+
// getHarmonizationStats had exactly one caller in the whole repository:
|
|
265
|
+
//
|
|
266
|
+
// console.log('A432 Harmonizer initialized:', getHarmonizationStats(context))
|
|
267
|
+
//
|
|
268
|
+
// A debug print. Deleting it — the entropy pass — took the function's only
|
|
269
|
+
// exerciser with it and the coverage audit reported one more uncalled export
|
|
270
|
+
// the same minute. The noise had been standing in for a test.
|
|
271
|
+
console.log('\nsrc/0/3/6/9/1/2/4/8/7/5/1/a432.harmonizer.ts')
|
|
272
|
+
{
|
|
273
|
+
const ctx = { results: new Map(), errors: new Map() } as never
|
|
274
|
+
const empty = getHarmonizationStats(ctx)
|
|
275
|
+
check('an empty context reports nothing attempted', empty.total === 0 && empty.successful === 0 && empty.failed === 0)
|
|
276
|
+
|
|
277
|
+
const mixed = {
|
|
278
|
+
results: new Map([['a', 1], ['b', 2]]),
|
|
279
|
+
errors: new Map([['c', new Error('boom')]]),
|
|
280
|
+
} as never
|
|
281
|
+
const st = getHarmonizationStats(mixed)
|
|
282
|
+
check('total is successes plus failures', st.total === st.successful + st.failed, `${st.total} vs ${st.successful}+${st.failed}`)
|
|
283
|
+
check('successes and failures are counted separately', st.successful === 2 && st.failed === 1)
|
|
284
|
+
check('each failure is reported with its module name and message',
|
|
285
|
+
st.errors.length === 1 && st.errors[0]!.includes('c') && st.errors[0]!.includes('boom'), st.errors.join('|'))
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
console.log()
|
|
289
|
+
if (failures > 0) {
|
|
290
|
+
console.error(`core-exports FAIL — ${failures}`)
|
|
291
|
+
process.exit(1)
|
|
292
|
+
}
|
|
293
|
+
console.log('core-exports ok — every previously uncalled core export is checked against a property')
|
|
294
|
+
process.exit(0)
|