refactor(lab): move execution to Worker and manage replay and transfer lifecycles

This commit is contained in:
DCCONSTRUCTIONS
2026-11-10 01:09:39 +03:00
parent cd34b6ce1a
commit fe5900ff3b
101 changed files with 9305 additions and 2256 deletions
+220
View File
@@ -13,6 +13,7 @@ run at publication; service journal rotation runs in the owning writer.
| Data | Retention and mechanism |
| --- | --- |
| Source, configuration, secrets, `.git`, installed dependencies and active UI | Not disposable storage. No generic age-based cleanup. |
| Rover/battery scene and environment profiles, materials/textures, camera/editor layout and battery UI | Durable configuration in `data_dir/scene-profiles/.../meta.json`, with `meta.previous.json` on replacement. No cache TTL or scratch cleanup; retain verified recovery sources. Browser records are migration inputs only. |
| Imported Gaussian worlds, recordings, evidence, missions, plans, accepted maps, session map versions | Durable application data. No TTL. Deletion belongs to the owning product workflow or an explicitly reviewed archive/removal operation. |
| Simulation qualifications, computation experiments/results, engineering materials | Preserve unique evidence and the exact input/configuration/result relationship. An old experiment is not a cache. Archive only with a verified destination and complete dependency inventory. |
| Qualified releases and rollback artifacts | Explicit pins; retain independently of the intermediate count. Retiring a release requires removing its pin by name and recording the reason. |
@@ -405,3 +406,222 @@ one-file restoration helper. That local-only audit did not delete Worker dataset
subsequent explicit closeout is indexed separately at
`outputs/storage-closeout-20261107/REPORT.md`; do not add the two cleanup totals
without checking their distinct manifests.
## LAB and installer offload — 2026-11-07
The owner-authorized operator offload uses the existing Worker runtime volume
for preserved LAB evidence and a separate private Git LFS installation archive.
See [the ownership, portability and recovery contract](LAB_AND_INSTALLER_STORAGE.md).
This does not authorize removal of local viewer dependencies, source scans,
accepted maps, installed plugins or pinned build chains. Per-file retirement
requires a verified remote copy and a dependency review; archive transfer and
space reclamation are reported separately.
## LAB playback copies — 2026-11-08
Global Settings → Storage controls the retention of registered portable AI
Inference playback copies: 1–365 days, default 30. The store is
`data_dir/lab-local-storage.json`; owned files stay in
`data_dir/observatory-portable-replay-cache`. The renderer registers only a
validated complete merged RRD and its mapping sidecar. Unknown historical files
are not adopted through directory scanning and are not automatically removed.
Opening a supported result refreshes its last-use timestamp. Reading the catalog,
polling local availability or viewing Settings does not extend retention. Unpin
starts a full grace period. The reaper runs at service startup and then hourly;
changing policy may make unpinned copies eligible at the next sweep. Pin verifies
all registered file hashes and excludes that copy from expiration. Existing
cache publication budgets and free-space refusal still apply, including pinned
bytes; this is not a new global disk quota.
Local-copy deletion checks file identities, in-flight response leases and shared
references. Pinned copies must be unpinned first. Changed files, symlinks and
unknown paths are preserved. Only the reproducible presentation is removed;
source/result evidence, catalog history, configurations, Gaussian scenes and
semantic edits are outside this store. Reopening rebuilds the presentation from
retained validated source/result data, without running inference again.
Scope: portable results and composed portable runs only. Canonical/legacy replay
families, shared video caches, source/result CAS and install/build artifacts are
not silently included in this TTL. The portable source/result transport and
replay packager still require their separate Worker-only migration. A local pin
is not a new backup of the underlying evidence, nor proof that every historical
format can play offline. Existing protected source/result dependencies must stay
until that migration has a verified restoration contract.
History now lists all catalogued LAB formats independently of player support;
job attempts are no longer collapsed by configuration. Exact job/result identity
prevents duplicate rows. The jobs API remains bounded to 500 jobs per module;
older-than-bound histories need pagination rather than unbounded loading.
See [implementation and acceptance](../outputs/lab-history-storage-20261108/REPORT.md),
[storage ownership](LAB_AND_INSTALLER_STORAGE.md) and the prior
[fresh audit](../outputs/storage-fresh-audit-20261108/REPORT.md).
## Permanent LAB trash is distinct from cache expiry — 2026-11-08
An explicit confirmed LAB trash operation deletes its admitted private payloads
from both Core and Worker and removes its history entry. A pinned local copy is
included; an active playback lease blocks deletion until closed. Source sessions,
Gaussian products, semantic edits, other LABs and their shared files survive.
No retained remote archive is required for this intentional permanent deletion.
The archive/copy-preservation prerequisites elsewhere in this document apply to
storage offload and cache retirement, not to this owner-authorized destruction.
Worker receipt precedes local/catalog finalization. A failed or unavailable
Worker must not produce success or a hidden row. Durable IDs/receipts support
retry and block accidental republication. Keep only bounded audit metadata, not
inaccessible result payloads. HTTP callers cannot supply deletion paths.
The separate “delete local copy” action and 1–365 day cache TTL keep LAB history
and remote results. Pin excludes that copy from TTL, not from full LAB trash.
See `src/k1link/laboratory/{data_deletion,deletion_inventory,deletion_coordinator}.py`
and `outputs/lab-history-cleanup-20261108/REPORT.md` for actual acceptance/limits.
## Intermediate stores and protected models — owner clarification, 2026-11-08
The AI Inference UI/history/local-playback work is closed in its accepted scope.
The remaining audit is about transport copies, historical engineering materials
and component dependencies. It does not authorize treating the experimental
system itself as disposable run output.
Integrated and experimental model weights, required runtimes/environments,
registered component code, shared inputs, benchmarks, annotations and meaningful
regression evidence are protected owners. `cache`, `derived`, an old release
directory or absence from AI Inference history is never sufficient deletion
evidence. Retire a model/version only after checking all module, experiment,
qualification and rollback consumers and making an explicit retirement decision.
The local LAB-copy retention interval applies only to unpinned local viewing
copies in Mission Core. It does not apply to Worker experiments, installed
executor packages/images, models, environments or experimental configurations.
Preserve old and new model/executor/configuration versions until the owner makes
a separate pipeline-consolidation decision. A transport package in the rules
below means job input/output transfer data, not an executor/model distribution.
Every new intermediate producer must declare the owner and artifact role before
writing: source, model/runtime, scratch, transport package, accepted result,
presentation replica or engineering evidence. Bind exact input/code/model/config
identities and use volume-relative paths. Declare the family-level byte budget,
temporary peak/reservations, free-space reserve, active leases and terminal
cleanup/recovery contract. Single-file protocol maxima are not aggregate budgets.
An acknowledged transfer is not by itself permission to remove staging. Verify
the durable target, publication/catalogue binding and every retry/outbox reader.
After their readers use the durable copy, retire only the job-owned payload and
preserve small identity/transfer/publication receipts. Failed/interrupted jobs
also need terminal closeout. Active, shared, unclassified or sole-copy data stays
protected; never infer terminal ownership from mtime or run a recursive TTL sweep.
Historical duplicate bytes may be retired only with a protected retained copy,
hash/path restore index and a passing relevant evidence/consumer verification.
A product file matching an old audit file does not automatically protect that
product from later deletion or make the old audit layout reconstructible. Keep
decision-relevant negative results, exact configurations and useful regression
evidence; deduplicate their storage rather than discarding the knowledge.
Current implementation after the 9 November follow-up: registered portable/composed
viewing copies and scoped build retention remain. Source/result transport now
uses shared physical-device reservations with a 2 GiB free-space reserve. The
8/4 GiB aggregate directory ceilings introduced on 8 November could reject valid
large/multicomponent jobs; they have been removed specifically from transport.
Other product cache quotas are unchanged. The protocol bounds (2 TiB input,
64 GiB result member / 256 GiB package) also remain unchanged.
After verified archive and catalog publication, only exact result-package payload
duplicates in staging are retired. The immutable manifest and retirement receipt
remain; retries validate archive hashes and reject altered staging. A published
historical transfer can be closed against its original catalog/archive identity
without adding its old definition back to the compute allowlist. Original
publication timestamps and profile labels do not change during a retry.
Registered source copies now have last-consumer retirement as described below.
Other overlay families, unknown historical ownership and Worker build/materialized
inputs still require their own adapters. These remaining classes are not covered
by the local viewing-copy TTL. This is not a hard filesystem quota on arbitrary
scripts, and installed executors/models are not subject to these budgets.
Measured inventory, exact duplicate hashes, protected dependencies and ordered
acceptance gates: [intermediate storage review](../outputs/intermediate-storage-review-20261108/REPORT.md).
The follow-up [legacy LAB and duplicate-storage audit](../outputs/legacy-lab-and-duplicates-20261108/REPORT.md)
removed two unused old UI controllers and their exclusive test after owner approval.
That earlier audit retained the fixed V1 executor. The later owner-authorized
retirement below removes its admission and agent; shared module/API paths remain.
Thirty-three verified duplicate files now share APFS copy-on-write blocks; paths,
hashes and independent file semantics are preserved. The volume free-space delta
was about 247 MB, not the 3.38 GB logical duplicate size. This one-off physical
deduplication does not implement future source/staging retention or retire any
model, executor, configuration or historical evidence.
## Fixed LAB retirement and transport closeout — 8 November 2026
The old combined EoMT+DDRNet setup is removed from current admission/runtime
registries. Its standalone Worker agent was removed using the guarded migration
`deploy/laboratory/retire_fixed_lab_v1.ps1`; modular AI and TGS agents remain.
Actual DDRNet/EoMT weight hashes and shared bindings match the modular assets;
no unique model needed migration. Model files, environments and images remain.
The modular release builder now consumes `modular_model_assets.py` and current
module definitions, not the retired V1 promotion CLI. Frozen V1 registry fixtures
are for compatibility tests only. Old-named shared helpers remain where current
modules depend on them; filename age does not establish dead code.
Three published transport packages have been closed with archive verification
and repeat checks. Their catalog entries, payload archives, viewing copies and
pins remain. Logical duplicate payload volume is recorded separately from actual
physical free space because earlier APFS clones share blocks.
Evidence: [retirement and retention report](../outputs/lab-retirement-transport-20261108/REPORT.md).
## Source transfer lifecycle and capacity — 9 November 2026
`observatory/transfer_space.py` owns a small Core ledger shared by portable source
and result writers. Admission sums outstanding reservations on the target device
and checks actual filesystem free space, keeping 2 GiB free. Bytes already written
release the corresponding reservation to avoid double-counting disk usage. Locks
are held only for brief metadata updates, never across an async upload. Kernel
locks identify live reservations; after a process dies its private UUID reservation
metadata can be removed, including torn metadata, without deleting any partial
payload. Unknown filenames, symlinks and shared filesystem owners are preserved.
This is cooperative admission for these writers, not an OS quota against unrelated
programs or a prediction of a complete GPU run's output size.
A result manifest preflights all missing payload bytes; each actual member reserves
space again before writing. Source members/archives reserve their declared size
before construction. Already complete exact copies are reusable even if no room
remains for new copies. Storage shortage returns HTTP 503 and Retry-After, which
the existing Worker transport treats as transient. No change to model selection,
executor identities, compute allowlists or model retention is involved.
`observatory/source_transport_lifecycle.py` registers only producer-owned source
copies and their original paths/digests/lengths/session owners. The full durable
queue protects accepted/queued/claimed/running/paused/preemption/reconciliation
states, including hidden records. Pending or failed result publication also blocks
source retirement. A terminal failed compute job may release its duplicate only
when its exact source is still recoverable. A new run regenerates the same copy.
All associated session owners must finish; absence from a truncated UI list is
never used to infer liveness.
The existing 15-second publication-maintenance loop runs a separate bounded source
collection pass (up to 8 ledger rows). Cross-process shared reader locks protect
materialization and the complete HTTP response, including Range, errors and
cancellation. A collector needs an exclusive lock and skips while any reader is
active. It verifies every original and the copy, rejects symlinks/hardlinks/changed
identities, records `retiring`, unlinks only the registered duplicate and records
`retired`. Interrupted retirement is repeatable. Camera archive bindings remain;
a missing retired payload regenerates deterministically from admitted originals,
while a present corrupted payload still fails integrity validation.
The source ledger is a compact per-content receipt, not a second payload archive.
Unknown historical source files are not automatically adopted. A one-time audit
must prove ownership/restoration; `collect(only_paths=...)` fences deletion to the
reviewed paths and preserves even other registered copies outside the list.
Original recordings, models/executors, three accepted LABs, Gaussians and semantic
maps are outside this lifecycle. Worker source cache/build/expanded directories
and unowned interrupted payloads remain separate ownership work; no global
recursive cleanup or new age-based purge has been introduced.
Evidence and exact measured cleanup: [9 November closeout](../outputs/lab-source-lifecycle-20261109/REPORT.md).