Files
bare-operating-system/packages/bare-os-booter/test.bare-smoke.js
T
Raven Scott ebee9576c8 feat(booter): POSIX/P2P kernel roadmap — sockets, disk.os, VFS, docs
- Bump bareOsCtxApiVersion to 1.46.0 and POSIX profile 1.0.10; sync
  syscalls example, process table, compatibility matrix, CHANGELOGs.
- Socket FD bridge: passive SOCK_DGRAM bind/connect/send path, poll
  readiness; bareOsPosixPoll monotonic timeouts via bare-hrtime.
- disk.os: replication_operator_sketch schema 2; cap-gated
  replication_operator_intent + audit; enrich protomux proc JSON.
- VFS: route /.bare/** to personal drive; optional
  BARE_OS_PERSONAL_VAULT_INDEX_CACHE_MS readdir TTL cache.
- Boot policy: p2pAdmission (peerAllowlistHex, hyperswarmBootstrap) in
  schema + kernel init merge into ctx.env when unset.
- Coreutils/booter getconf: expand _SC_* coverage; shell wait -n under
  BARE_OS_SHELL_POSIX_MODE; seeder multisig verify → security_posture.
- Tests: vfs /.bare routing; test.bare-smoke + test:bare; bench schema 2.
- Docs: syscall-socket-contract, handbook/env/kernel-extensions,
  holepunch drift pretest note, vault threat model multisig section.
- Drop hyperbee from bare-os-booter package.json dependencies (if that
  change is part of this commit).
2026-04-05 01:46:17 -04:00

63 lines
2.0 KiB
JavaScript

/**
* Minimal **`brittle-bare`** suite (no Node **`brittle-node`** / Hyperdrive session).
* Run: **`npm run test:bare -w bare-os-booter`** (concatenates **`test.identity.js`**).
*/
import test from 'brittle'
import { createBareOsDiskOsBridge } from './lib/bare-os-disk-os-bridge.js'
import { BARE_OS_CTX_API_VERSION } from './lib/bare-os-ctx-api.js'
test('disk.os replication_operator_intent EPERM when cap RPC off', async (t) => {
const bridge = createBareOsDiskOsBridge({
drive: null,
bareOsIpc: { list: () => [] },
ctxApiVersion: BARE_OS_CTX_API_VERSION,
systemRevision: null,
bootStartedMs: Date.now()
})
const prev = process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC
if (prev !== undefined) delete process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC
try {
const raw = await bridge.execRpc(
'bare_os',
'replication_operator_intent',
['{}']
)
const j = JSON.parse(raw)
t.is(j.ok, false)
t.is(j.code, 'EPERM')
} finally {
if (prev !== undefined) process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC = prev
}
})
test('disk.os replication_operator_intent ok when cap RPC on', async (t) => {
const audit = []
const bridge = createBareOsDiskOsBridge({
drive: null,
bareOsIpc: { list: () => [] },
ctxApiVersion: BARE_OS_CTX_API_VERSION,
systemRevision: null,
bootStartedMs: Date.now(),
auditBatch: (rows) => {
audit.push(...rows)
return rows.length
}
})
const prev = process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC
process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC = '1'
try {
const raw = await bridge.execRpc(
'bare_os',
'replication_operator_intent',
[JSON.stringify({ action: 'pause_hint' })]
)
const j = JSON.parse(raw)
t.is(j.ok, true)
t.is(audit.length, 1)
t.is(audit[0].kind, 'disk_os.replication_operator_intent')
} finally {
if (prev === undefined) delete process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC
else process.env.BARE_OS_DISK_OS_OPERATOR_INTENT_RPC = prev
}
})