Files
orca/config/scripts/orcad-template-test-fixture.mjs
T
8afa1db50c feat(ssh): rung B glibc 2.17 compat runtime; gate remote vault on host node:sqlite (#24148)
* feat(ssh): wire rung B to the glibc 2.17 compat runtime; gate rung C vault on full node:sqlite

- COMPAT_RELAY_RUNTIMES lists linux-x64-glibc217; rung B plans the compat slot and compat
  pinned Node when glibc is below 2.28 or rung A refused with libc_floor/missing_lib.
- The relay version folds the compat runtime's executable hash; refusals are cached per runtime.
- The orcad template stages an optional linux-x64-glibc217 target (base package + compat
  node-pty slot + compat runtime marker); the verifier and materializer accept it.
- node-pty slot loader falls back to the compat slot when the default slot is missing or
  needs a newer glibc.
- Runtime store GC keeps the compat pin beside the default one on every relay connect.
- hasNodeSqliteReaderApi (DatabaseSync + backup) gates relay session search and the relay
  OpenCode reader, which now names the host Node version in its unavailable reason; the SSH
  vault reader installs the compat Node on old-glibc hosts and uploads nothing when no
  pinned Node can run.
- Rung D: a remembered noexec reports home_noexec and never advises installing Node.

* fix(ssh): re-prove a replayed noexec after rung D so allowing exec recovers the host

* fix(ssh): keep the rung B compat runtime pinned in the relay-connect store GC

* test(ssh): mock deployment-target facts in the Windows OpenCode runtime tests

* ci(ssh): build the glibc 2.17 compat slot for the hostile-host matrix; CentOS 7 lands on rung B

---------

Co-authored-by: m4air <m4air@m4airs-Air.localdomain>
Co-authored-by: m4air <m4air@Mac.localdomain>
2026-10-01 05:32:05 -07:00

70 lines
2.2 KiB
JavaScript

import { createHash } from 'node:crypto'
import { mkdir, writeFile } from 'node:fs/promises'
import { dirname, join } from 'node:path'
import {
ORCAD_NODE_RUNTIME_MARKER_FILENAME,
ORCAD_SERVER_TARGET_FILENAME,
ORCAD_TEMPLATE_MANIFEST_FILENAME,
ORCAD_TEMPLATE_TARGETS_DIR,
orcadTemplateCommonFilenames,
orcadTemplateTargetFilenames
} from '../../src/shared/orcad-artifacts.ts'
import {
COMPAT_SERVER_TARGETS,
ORCAD_TEMPLATE_TARGETS,
pinnedNodeRuntimeAsset
} from '../../src/shared/node-runtime-pin.ts'
async function write(path, contents) {
await mkdir(dirname(path), { recursive: true })
await writeFile(path, contents)
return createHash('sha256').update(contents).digest('hex')
}
function targetFileContents(target, filename) {
if (filename === ORCAD_SERVER_TARGET_FILENAME) {
return `${target}\n`
}
if (filename === ORCAD_NODE_RUNTIME_MARKER_FILENAME) {
return `${pinnedNodeRuntimeAsset(target).executableSha256}\n`
}
return `${target}:${filename}`
}
export async function writeOrcadTemplateTestFixture(resourcesDir, { compat = false } = {}) {
const templateDir = join(resourcesDir, 'orcad-template')
const commonSha256 = {}
for (const filename of orcadTemplateCommonFilenames()) {
commonSha256[filename] = await write(
join(templateDir, ...filename.split('/')),
Buffer.from(`common:${filename}`)
)
}
const targets = {}
for (const target of [...ORCAD_TEMPLATE_TARGETS, ...(compat ? COMPAT_SERVER_TARGETS : [])]) {
const targetDir = join(templateDir, ORCAD_TEMPLATE_TARGETS_DIR, target)
const files = {}
for (const filename of orcadTemplateTargetFilenames(target)) {
files[filename] = await write(
join(targetDir, ...filename.split('/')),
targetFileContents(target, filename)
)
}
targets[target] = { files }
}
const browserName = 'agent-browser-linux-x64'
targets['linux-x64-glibc'] = {
...targets['linux-x64-glibc'],
browserName,
browserSha256: await write(
join(templateDir, ORCAD_TEMPLATE_TARGETS_DIR, 'linux-x64-glibc', browserName),
'browser'
)
}
await writeFile(
join(templateDir, ORCAD_TEMPLATE_MANIFEST_FILENAME),
JSON.stringify({ schemaVersion: 3, commonSha256, targets })
)
return templateDir
}