# Worker LAB service This deployment moves the existing LAB evidence readers, bounded visualization preparation and evaluation adapters off the operator. It preserves their API and viewer contracts. It does not add another scheduler, model-training orchestrator, or UI. New packaged LAB jobs keep using the installed-package Worker executor. ## Reproducible runtime `Dockerfile` pins the Python base image by digest; `requirements.lock` pins Python artifacts and hashes. Build from the repository source, plugin SDK and `config`: copy `Dockerfile` and `requirements.lock` to a bounded build context containing `src/`, `packages/plugin-sdk/python/`, and `config/`. Seal a manifest of source paths, sizes and SHA-256 values; pass its identity as `NODEDC_SOURCE_TREE_SHA256`. Use the resulting immutable image digest in Compose, not a mutable `latest` tag. The image has no models, private evidence, host credential or Docker socket. Configure these deployment bindings, separately from artifact identities: | Variable | Meaning | | --- | --- | | `LAB_IMAGE` | Built `sha256:…` image identity | | `LAB_RUNTIME` | Existing portable Worker LAB directory, mounted at `/lab` | | `LAB_ARCHIVE` | Dedicated LAB archive volume, `/lab-archive` | | `LAB_AI_JOBS` | Admitted AI executor jobs/sources volume, `/ai-jobs` | | `LAB_TGS_JOBS` | Admitted TGS executor volume, `/tgs-jobs` | | `LAB_CONFIGURATION` | That release's verified `config/`, mounted read-only at `/lab/config` | | `LAB_TOKEN_FILE` | Private bearer credential file, mounted read-only | | `LAB_FFMPEG_ROOT` | Sealed Linux FFmpeg/FFprobe asset tree with `bin/ffmpeg` and `bin/ffprobe` | | `LAB_PORT` | Host loopback port, default 19087 | The existing deployment uses the independently verified FFmpeg 7.0.2 asset. Validate its tree manifest/digests before binding it. It is an external portable runtime asset, not an implicit host-installed executable. Requalification on a new CPU/OS requires the matching Linux image/asset architecture. Run `docker compose -f compose.yaml up -d --pull never` with those bindings. The service is `ndc-laboratory-evidence` in project `ndc-laboratory`. It runs with a read-only root, 2 CPU / 4 GiB / 128 PID limits, a 512 MiB tmpfs, dropped capabilities and rotating logs. It is reachable only on host loopback; the token is required for health and API calls. Never publish the bearer token in command arguments or logs. Persist its host file with owner-only access. ## Volume and migration The existing immutable archive is **not** the mutable working volume. Explicit one-time materialization uses: ``` python -m k1link.laboratory.materialize_archive --archive /archive --target /lab ``` Run only as Worker with the archive read-only and the intended LAB volume writable. The module verifies every file and seals `state/materialization.json`. Existing conflicting files stop migration; they are not overwritten. Resume is by verified content. The volume remains separate from both source releases and image layers. For legacy catalogs ordered by mtime, preserve the reviewed original directory metadata separately; hash-valid contents alone do not preserve result ordering. Recorded camera preparation uses the existing Worker source CAS, never a Core fallback. `materialize_recorded_sources` accepts a digest-bound import manifest, checks source members and prepared-media timelines, and publishes bindings only after validation. Replacing bindings requires the previous digest. Original camera archives and accepted operator recordings stay preserved. Ready canonical RRDs are indexed by `recorded-sources/canonical-recordings.json` and verified before use. Host filesystem paths are deployment bindings, not source identities. The legacy evidence volume layout retains `.runtime/compute-*` paths to reuse validated readers. They are under **Worker `/lab`**, not the operator checkout. Generated viewing products go to `/lab/presentation`; manual annotations have separate provenance. No automatic age-based deletion is admitted. ## Operator connection Core reads `.runtime/mission-core/laboratory-worker-gateway.json`: ```json { "schema_version": "missioncore.laboratory-worker-gateway/v1", "base_url": "http://127.0.0.1:19087", "token_file": "laboratory-worker.token" } ``` Keep the credential separate (mode 0600 on POSIX). For a remote Worker use the existing authenticated SSH alias with a loopback-only forward, or a verified HTTPS endpoint. Plain remote HTTP, redirects and proxy-environment substitution are rejected. The Mac managed SSH link uses `com.nodedc.mission-core.laboratory-worker-link` with bounded logging and automatic reconnect; it does not change VPN/routes. `install_operator_link.py` writes this versioned binding on macOS. It refuses to overwrite a different existing definition. Other platforms can provide the same loopback transport with their service manager; macOS launchd is not baked into the Worker image. Core forwards LAB/LiDAR requests and the perception recording/media endpoints. Transport limits: 8 concurrent requests, 8 MiB request body, 2 GiB response, 5-second connect timeout, 60-second read timeout (360 for bounded RRD preparation). Range, ETag, compressed points and Rerun headers are preserved. No automatic retry of writes and no staging of whole responses on Core. Worker unavailable means 503; never run a local reader/model as fallback. ## Acceptance, rollback and lifecycle 1. Verify ownership, immutable archive, camera and supplemental evidence receipts. 2. Start the exact image; authenticate `/health`; compare existing catalog choices. 3. Run `verify_runtime.py` inside the installed container. Its tiny synthetic clips verify that 20 selected frames stay 20 with correct Rerun timestamps. 4. Verify real camera frames, segmentation video ranges, full RRD transfer and 3D timeline chunks (start/middle/end). Inspect Play/seek in the existing UI. 5. Switch only the canonical Core service. Preserve its data and UI; never start an alternate Core on another port. 6. Retire only archived local working files whose current hashes still match, after the previous local process has stopped. Leave changed/unknown files and all scans/maps/captures/accepted operator recordings. Record actual freed disk. Rollback selects the previous verified service image/configuration on the same volume. Do not rollback or overwrite annotations, sources or accepted results. Keep one verified rollback release; retire only this deployment's superseded build contexts/images after no container or active task uses them. Never use a global Docker prune. The archive can restore explicitly selected files if needed. The 128 GiB restore-admission budget and 40 GiB free reserve are not a hard volume quota. Existing per-product cache publication budgets apply; exhaustion refuses new copies rather than evicting recovery data. Active jobs and unknown ownership block cleanup. Long-term retained experiment growth still requires explicit retention decisions on Worker. The operator must not become the spillover disk. ## Explicit user deletion The authenticated `POST /api/v1/laboratory/data-deletions` accepts only opaque `owner_ids`. `MISSIONCORE_LAB_DELETION_ROOTS` is supplied by Compose, mapping `lab`, `archive`, `ai`, `tgs` to bound volumes. All bindings must be present. It inventories only admitted producer layouts, protects references shared with retained owners, validates paths and deletes owned files. Failed operations are retryable; receipts in `/lab/state/data-ownership` contain identities/status. `/lab-archive/deleted-members.json` prevents legacy restore from resurrecting explicitly deleted results. These are bounded metadata, not retained LAB bytes. The archive mount is writable only because this service now owns explicit LAB destruction. There is no age-based archive purge. Generic runtime roots, source CAS, images, plugins and unrelated datasets are outside the deletion bindings. The low-disk reserve must not block authorized cleanup itself. Requalification must cover shared content, interrupted deletion and actual playback of keepers. ## Retiring the fixed LAB V1 agent `retire_fixed_lab_v1.ps1` is the reviewed one-time migration for the standalone EoMT+DDRNet agent. Core must first remove its setup from admission and verify that no old job is active. The script checks the exact predecessor container ID/image, current modular/TGS agents and absence of a separate scheduled legacy launcher. It persists a retirement receipt under the supplied runtime root before removal. It never prunes images, mounts, models, environments or experiment data. Applied on Worker 006 on 8 November 2026. Do not rerun the predecessor migration against another container. The active modular builder reads shared model assets from `k1link.observatory.modular_model_assets`; its legacy promotion CLI is retired. Rollback of compute admission requires a deliberate versioned registry/runtime change; do not launch the frozen compatibility fixtures as current configuration. See `outputs/lab-retirement-transport-20261108/REPORT.md` for IDs and evidence. ## Publishing a complete portable LAB recording The service exposes authenticated read-only manifest and RRD routes: `GET /api/v1/laboratory/portable-replays//` and `GET .../recording.rrd?generation=`. The RRD supports Range/If-Range; manifest identity, source generation, renderer cache key and content hash must match. Missing publication is 404; missing/corrupt **published** payload is 409, and a wrong requested generation is 412. Existing Bearer authentication applies; no public port, arbitrary file reader or new credentials are introduced. An internal producer publishes a validated `missioncore.ready-lab-replay/v1` manifest and complete RRF2 file with `ReplayPublications.publish`, or inside the configured Worker runtime: ```sh python -m k1link.laboratory.replay_publication --runtime-root /lab --manifest /lab/OWNED_JOB/manifest.json --source /lab/OWNED_JOB/complete.rrd ``` `OWNED_JOB` denotes a producer-owned path, not a literal deployment folder. The CLI requires existing Worker authority. Payloads live on the bound volume at `/lab/presentation/portable-replays///.rrd`, never in the image. Existing generations cannot be replaced; exact publication retries are idempotent. Retain this directory with the runtime during a host move. Full LAB trash inventories it; active transfer leases block destruction. Current manifests admit files up to 1 GiB and publication preserves a 40 GiB Worker free-space reserve. Core uses its existing 4 GiB portable publication budget and 2 GiB free reserve. These refuse new copies without evicting accepted products. Core retries transient read interruptions at most three times within 30 minutes, validating Range, ETag, length, RRF2 and SHA-256 before atomic publication. This is in-process retry, not persistent resume after a Core crash. Acceptance on 10 November backfilled the three current accepted RRDs unchanged. New composition runs now opt into `worker-ready-v1`; legacy runs are not enrolled or rebuilt. The existing Core result reconciler waits for all selected module results, submits a digest-bound `missioncore.replay-build/v1` plan and streams only missing inputs from existing stores. It does not render the new LAB on Mac. A previously published canonical source is restored after Core restart without starting a source exporter. A missing canonical source blocks assembly explicitly. The authenticated `/api/v1/laboratory/replay-builds` API registers immutable plans; `/{id}/inputs/{sha}` accepts bounded, hash-verified input streams, and `/{id}/commit` validates the source/member bindings before queueing. Only this input route admits up to 1 GiB per file; other request bodies retain the 8 MiB limit. A single consumer in the existing LAB container runs the existing RRD renderer with the bound FFmpeg asset. No separate model runtime is installed. Durable plans/state live under `/lab/presentation/replay-builds/`. An interrupted build resumes after service restart. A successful build publishes the immutable full RRD, then removes only its own input and assembly directories. Active upload/build leases protect it from concurrent full-LAB deletion. Explicit LAB deletion also inventories these owned staging files. No model/source TTL applies. Admission reserves 40 GiB plus declared pending inputs and render headroom. Core reports the composition ready only after checking the actual Worker replay manifest. Viewing a new run restores that ready RRD; a missing publication cannot fall back to local assembly. Transport retries are bounded; a failed assembly can be retried via `POST /api/v1/observatory/ai-composition-runs/{id}/retry-replay` without rerunning inference. Core keeps only the small publication receipt and its ordinary, unpinned/pinned local viewing cache under existing storage rules. For non-destructive cold-view acceptance only, `MISSIONCORE_LAB_VIEW_CACHE_DIR` redirects the portable cache and its local-copy index to an owned empty test root. It leaves the source catalog, original cache and full-deletion guards unchanged. Use the single canonical Core service; remove this environment override and restart that service after testing, verify the original index/pin, then remove only the inventoried test copies. It is not a new operational storage destination.