Skip to content
pi-c Artifact [b0604ee42e]
Login

Artifact [b0604ee42e]

Artifact b0604ee42e39c9f104ea2e6277edea3284936037294aa004eb5f3304cc254d54:


# 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, or filc. The exact workspace is `$REMOTE_HOME/.pi-c-s0-NONCE`.

Each run lists four transient SYSTEM-manager units:

- `pi-c-s0-NONCE-owner.service`: UID/GID1000, a finite 600-second lease, immutable unprivileged ExecStopPost cleanup.
- `pi-c-s0-NONCE-worker.service`: UID/GID1000, at most300 seconds (3 in timeout mode), bound/ordered to the owner.
- `pi-c-s0-NONCE-cleanup.service` and `.timer`: armed before workspace allocation; Conflicts/ordering stops the owner/worker before running the same unprivileged cleanup body.

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

```sh
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.

## 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

- Local fake transport/manager tests passed; they run no real SSH/sudo. Collector negative/positive cases passed.
- The first live no-op exposed transient D-Bus percent handling: `%%s` wrote literal `%s`. Exact live bytes and a local regression led to the fix. Its inspected marker was repaired as UID1000 solely to allow verified cleanup; no payload ran.
- The next attempt exposed root-created append-log ownership. Logs are now precreated by UID1000 before PID1 opens them. That failed attempt was cleaned and reported evidence loss, not success.
- Corrected no-op completed, collected, and cleaned. A worker remained running after the initiating SSH closed; its three-second systemd deadline produced a real timeout, which was collected as FAIL and then cleaned.
- Real Fil-C ran10 native fixture tests,8 oracle verdict checks, and7 corpus files/5 parsed sequences. Evidence was verified and teardown/reconciliation succeeded.
- Independent final host inventory showed no `pi-c-s0-*` units or `.pi-c-s0-*` workspaces, and the borrowed compiler fingerprint was unchanged.

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.