merge: PR #36을 합친 검사 브랜치에 넣는다

This commit is contained in:
DongHyeonka
2026-11-13 07:16:02 +09:00
10 changed files with 144 additions and 13 deletions
+14 -4
View File
@@ -88,14 +88,24 @@ export async function findSystemTestPrerequisiteFailures(
}
if (executable.get(BWRAP)) {
const probe = host.spawn(BWRAP, NAMESPACE_PROBE_ARGUMENTS, PROBE_TIMEOUT_MS);
if (probe.error || probe.status !== 0) {
failures.push(await namespaceFailure(host, probe));
}
const failure = await findProviderSandboxNamespaceFailure(host);
if (failure !== undefined) failures.push(failure);
}
return failures;
}
/**
* 1101/13-03. Whether this host lets the provider sandbox create its
* namespaces, and if not, why and what to do. The release provider jobs run
* it before the provider (scripts/run-and-validate-provider.ts).
*/
export async function findProviderSandboxNamespaceFailure(
host: SystemTestHost = nodeSystemTestHost,
): Promise<string | undefined> {
const probe = host.spawn(BWRAP, NAMESPACE_PROBE_ARGUMENTS, PROBE_TIMEOUT_MS);
return probe.error || probe.status !== 0 ? namespaceFailure(host, probe) : undefined;
}
async function namespaceFailure(
host: SystemTestHost,
probe: ReturnType<SystemTestHost["spawn"]>,
+17
View File
@@ -432,6 +432,9 @@ const jobSchema = z
browserGateIds: z.array(id).max(64),
environment: z.array(environmentBindingSchema).max(32),
steps: z.array(jobStepSchema).min(1).max(64),
// 1101/13-03. What the runner of a job without a gate needs (the provider
// jobs' sandbox). Rendered beside its runner label like a gate's.
hostRequirements: z.array(nonEmpty.max(512)).min(1).max(8).optional(),
})
.strict();
@@ -862,6 +865,20 @@ function validateContractSemantics(
// paired backend's nightly lanes.
main_gate: ["FE-GATE-029", "FE-GATE-030"],
};
// 1101/13-03. The provider jobs run FE-GATE-013's sandbox (systemd-run
// scope, bwrap with the same namespace options), so they need its host.
const sandboxRequirements = JSON.stringify(
contract.gates.find(({ id: gateId }) => gateId === "FE-GATE-013")?.hostRequirements ?? [],
);
for (const job of contract.jobs) {
if (job.kind === "provider") {
if (JSON.stringify(job.hostRequirements ?? []) !== sandboxRequirements) {
issue(`provider job host requirements must equal FE-GATE-013's: ${job.id}`);
}
} else if (job.hostRequirements !== undefined) {
issue(`only a provider job declares host requirements of its own: ${job.id}`);
}
}
if (JSON.stringify(contract.jobs.map(({ id }) => id)) !== JSON.stringify(Object.keys(expectedJobOwnership))) {
issue("job registry must contain the exact thirteen canonical jobs in semantic order");
}
+10 -4
View File
@@ -267,11 +267,17 @@ function renderHostRequirements(
job: CiWorkflowJob,
index: ReturnType<typeof indexCiGateContract>,
): string[] {
return job.gateIds.flatMap((gateId) =>
(index.gates.get(gateId)?.hostRequirements ?? []).map(
(requirement) => ` # ${gateId} runner requirement: ${requirement}`,
return [
...job.gateIds.flatMap((gateId) =>
(index.gates.get(gateId)?.hostRequirements ?? []).map(
(requirement) => ` # ${gateId} runner requirement: ${requirement}`,
),
),
);
// 1101/13-03. A provider job runs the provider sandbox and has no gate.
...(job.hostRequirements ?? []).map(
(requirement) => ` # provider sandbox runner requirement: ${requirement}`,
),
];
}
/**
+8
View File
@@ -30,6 +30,7 @@ import {
type ProviderGuardianLease,
} from "./lib/provider-guardian-client.ts";
import { createProviderOutputLimiter } from "./lib/provider-output-limiter.ts";
import { findProviderSandboxNamespaceFailure } from "./check-system-test-prerequisites.ts";
import { PROVIDER_SANDBOX_NAMESPACE_ARGUMENTS } from "./lib/provider-sandbox-namespaces.ts";
import {
providerProcessTraceEnvironment,
@@ -125,6 +126,13 @@ await access("/usr/bin/systemd-run", constants.X_OK).catch(() => {
await access("/usr/bin/systemctl", constants.X_OK).catch(() => {
throw new Error("provider cgroup unavailable: /usr/bin/systemctl is required");
});
// 1101/13-03. A runner that refuses the sandbox's unprivileged user and
// network namespaces fails here, by name and with its host settings, instead
// of later with bwrap's raw error.
const namespaceFailure = await findProviderSandboxNamespaceFailure();
if (namespaceFailure !== undefined) {
throw new Error(`provider sandbox unavailable: ${namespaceFailure}`);
}
await assertProviderCgroupManagerAvailable();
const trust = await readProviderTrust(workspaceRoot, publicKeyPath, keyId);
if (!trust) throw new TypeError("provider supervisor trust key is invalid");