Skip to content
pi-c Remote S0 qualification
Login

Remote S0 qualification

This is one explicit, bounded qualification procedure for trusted C fixtures on hetzner-hel, not a general remote platform or a sandbox for hostile operators. Main/operator alone executes host actions. No Python runs on the remote control path; the local Python collector/verifier only parses and hashes evidence.

Resources and authority

tools/remote/run.sh prepare DIR NONCE MODE first creates a private off-host manifest and source/control snapshots. NONCE is 16 lowercase hexadecimal characters; MODE is noop, disconnect, timeout, filc, or pic. The exact workspace is $REMOTE_HOME/.pi-c-s0-NONCE.

Each run lists four transient SYSTEM-manager units:

System-manager supervision is intentional: user Linger=no cannot be the SSH-loss lifetime guarantee. Privileged calls only manage the named units; creation, workload, and filesystem cleanup run as UID1000. No privileged recursive deletion, persistent service, linger change, account, package, or reboot is performed.

Owner and worker limits include CPUQuota100%, MemoryMax1G, TasksMax64, LimitFSIZE128MiB, stop timeout5s, and NoNewPrivileges. Worker filesystem/home are read-only except its workspace and private temporary files; compiler tree is explicitly read-only and external network is isolated. These are per-process/cgroup limits, not an invented aggregate disk quota.

The installed Fil-C0.687 compiler/archive pins are in tools/remote/pins.sh. The installed compiler matches the pinned archive member. Runtime library RPATHs were changed by the existing Fil-C setup, so installed fingerprints are compared before/after; do not claim all installed library bytes equal the unpatched archive. No cache installation or mutation is allowed.

Operator sequence

nonce=$(od -An -N8 -tx1 /dev/urandom | tr -d ' \n')
run="$PWD/build/qualification/remote/filc-$nonce"
sh tools/remote/run.sh prepare "$run" "$nonce" filc
sh tools/remote/run.sh preflight "$run"
sh tools/remote/run.sh start "$run"
sh tools/remote/run.sh upload "$run"
sh tools/remote/run.sh work "$run"
# Observe until the worker exits or fails; the initiating SSH connection is closed.
sh tools/remote/run.sh observe "$run"
sh tools/remote/run.sh collect "$run"
sh tools/remote/run.sh teardown "$run"
sh tools/remote/run.sh reconcile "$run"
make filc-remote REMOTE_RUN="$run"

filc-remote verifies an already executed, explicitly supplied run; it does not silently launch host jobs. Starting a new run remains the explicit operator procedure above. There is no nightly job.

The source payload is an allowlist: existing qualification C files/header, saved corpus, and payload shell. It does not include a user's databases, credentials, the whole repository, or the third-party Pi checkout. Snapshots and manifest collisions are refused. Collection is bounded to256MiB/128 entries and rejects links, traversal, duplicate files, forged source hashes, and injected local validation metadata.

pic mode: bounded steps, budget, progress

payload.sh pic runs every test script and binary as timeout -k 10 N env ... (coreutils, required at preflight): STEP_SECONDS 900 per test, BUILD_SECONDS 1200 per compile. A timeout prints FAIL: NAME timed out after Ns, a non-zero exit prints FAIL: NAME exited RC, the step is counted and the run continues; any counted failure makes result.txt FAIL. worker.log gets STEP START / STEP END name rc= secs= lines and PHASE START/END lines, UTC-timestamped.

Worst case: PIC_BUDGET_SECONDS (6000) caps the whole run. Each step's limit is clamped to the remaining budget; once under 30 s remain, later steps are recorded as FAIL: NAME skipped: overall budget exhausted without running. The worker therefore ends by about 6000 + 10 s kill grace, against worker_seconds 6600 and a 7200 s lease: at least about 1100 s remain to collect before the guard cleans. Collect promptly after the worker exits; teardown refuses without verified collection.

Progress: run.sh tail DIR is read-only (guard and workspace identity checked, nothing stopped or written on the host). It prints the worker state, log size and the last 40 log lines, and appends each sample to DIR/worker-tail.log locally, so the last observed lines survive even if the host later loses the workspace. Poll it during the run.

An empty evidence.partial.tar means collect failed before tar started (workspace already cleaned, EVIDENCE_LOST, or the worker still running); the host fail messages go to stderr only. worker.log is precreated by the run owner and appended unbuffered by systemd, so a partial log is on disk as long as the workspace is.

Completion, failure, and teardown

The owner lease retains artifacts even when the worker fails or times out. Collection validates the archive/source indexes and supervisor result locally. A valid collection is NOT RUN pending cleanup, or FAIL if the worker failed; neither is a production-contract PASS. The final evidence gate revalidates hashes and requires teardown/reconciliation receipts before producing fixture qualification PASS.

On any failure, still run teardown/reconcile. Teardown stops only listed worker/owner units, invokes the immutable cleanup as UID1000, verifies workspace absence, then cancels guard units. It refuses symlinks, mismatched UID/mode, canonical paths, or markers. It does not disarm the guard before workspace absence. A missing workspace is idempotent success. Missing evidence is explicitly EVIDENCE_LOST after cleanup, never a passing skip.

If SSH/controller dies, PID1 and the finite lease/guard still stop work and attempt cleanup. Source/ownership ambiguity can make cleanup fail closed; reconcile that recorded run, not unrelated files. Do not restart a second copy while an operator command is still running.

Reboot behavior/full startup-interruption and disk-fault matrices are not qualified here. Transient units are not persistent boot recovery. No host reboot was performed.

Actual verification

Artifacts live under build/qualification/remote/; the current successful Fil-C run is named in current-filc.txt. Failed attempts are retained as failed evidence, not overwritten. These are memory-safety/fixture/supervisor checks, not production harness, storage power-loss, or performance qualification.