- Add kernel init bundle helper + verify:init-bundle; tighten release-checklist gates
- Implement cooperative F_GETLK/F_SETLK/F_SETLKW; optional BARE_OS_POSIX_SOCKET_FD_BRIDGE - Add ctx.bareOsGetconfSysconf; extend getconf for _SC_*; awk delete stmt; POSIX heredoc cap - disk.os: replication_snapshot + replication_operator_sketch; blind-relay swarm schema 2 - Protomux operatorMetrics.backpressureEmitCount; warm-cache invalidate on boot/init puts - Bump POSIX profile 1.0.6 and syscalls.json schema 6; sync schemas, handbook, env appendix - Tests + seeder/kernel parity (rsync after coreutils/bare-libs builds)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Single source of truth for the kernel/init.js bundle recipe (lib/boot/*.js + lib/init/init-main.js).
|
||||
* Used by verify-kernel-seeder-parity and verify-init-bundle-recipe.
|
||||
*/
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
/**
|
||||
* @param {string} canonicalKernelDir - absolute path to repo `kernel/`
|
||||
* @returns {string} expected init.js contents
|
||||
*/
|
||||
export function computeKernelInitJsFromRecipe(canonicalKernelDir) {
|
||||
const bootDir = path.join(canonicalKernelDir, 'lib', 'boot')
|
||||
const mainPath = path.join(canonicalKernelDir, 'lib', 'init', 'init-main.js')
|
||||
if (!fs.existsSync(mainPath)) {
|
||||
throw new Error(`kernel-init-bundle: missing ${mainPath}`)
|
||||
}
|
||||
const parts = []
|
||||
if (fs.existsSync(bootDir)) {
|
||||
const names = fs
|
||||
.readdirSync(bootDir)
|
||||
.filter((n) => n.endsWith('.js'))
|
||||
.sort()
|
||||
for (const n of names) {
|
||||
parts.push(fs.readFileSync(path.join(bootDir, n), 'utf8').trimEnd())
|
||||
}
|
||||
}
|
||||
const main = fs.readFileSync(mainPath, 'utf8')
|
||||
return (parts.length ? parts.join('\n\n') + '\n\n' : '') + main
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} canonicalKernelDir
|
||||
*/
|
||||
export function assertKernelInitJsMatchesRecipe(canonicalKernelDir) {
|
||||
const outPath = path.join(canonicalKernelDir, 'init.js')
|
||||
const expected = computeKernelInitJsFromRecipe(canonicalKernelDir)
|
||||
const actual = fs.readFileSync(outPath, 'utf8')
|
||||
if (actual !== expected) {
|
||||
throw new Error(
|
||||
'kernel/init.js does not match bundle recipe (lib/boot/*.js + lib/init/init-main.js). Run: node scripts/bundle-kernel-init.mjs'
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user