fix(scene): persist editor and battery profiles in Core

This commit is contained in:
DCCONSTRUCTIONS
2026-11-10 01:08:00 +03:00
parent 7595bea07c
commit cd34b6ce1a
18 changed files with 581 additions and 91 deletions
+58 -10
View File
@@ -10,9 +10,11 @@ owner. Driving settings retain their existing modal. A separate workspace
would hide the live scene and duplicate navigation; the admitted surface is an
edit mode of the existing rover view, with no new product root.
The scene document belongs to vehicle + model revision, persists in IndexedDB
on this operator computer, includes imported texture data, and can be exported
or imported as JSON. Loading and persistence failures remain visible; closing
The scene document belongs to its vehicle or battery and records the model
revision. It persists in the canonical Core data directory as `meta.json`,
including imported texture data, and can be exported or imported as JSON.
Browser storage is only a read-only migration source (see the 2026-11-09
refinement below). Loading and persistence failures remain visible; closing
an inspector never waits for saving. This is appearance only, not a firmware,
calibration or hardware profile. Editing pauses local drive input and prevents
new drive input until exit; it never arms a vehicle.
@@ -51,10 +53,12 @@ A synthetic checker texture was uploaded, rendered and retained with its custom
material, name and assignment after a page reload. The texture was then removed
and the enclosure's original material reassigned. Browser error/warning log was
empty. No motor commands were sent; the canonical service remains on port 8000.
The inherited renderer still reduces MSAA to one sample. Local scene storage is
not cross-computer synchronization. Both bounds are recorded in MISSIONCOR-85.
The inherited renderer still reduces MSAA to one sample. At that acceptance,
scene storage was browser-local and not cross-computer synchronization. The
browser-only persistence was superseded on 2026-11-09; the earlier bounds were
recorded in MISSIONCOR-85.
Follow-up: the owner still saw the withdrawn gray preset after clearing browser
Historical migration finding: the owner still saw the withdrawn gray preset after clearing browser
cache. Changing defaults and using the reset in one browser did not migrate
other saved IndexedDB scene documents. Added environmentVersion 2 and a narrow
load migration: only the exact original neutral environment is replaced with
@@ -69,11 +73,11 @@ custom environments, deliberate gray scenes, imports and already restored scenes
Owner refinement, 2026-11-04: reusable environment profiles and SOC surfaces
------------------------------------------------------------------------
The first Environment Inspector section is now Profiles. A shared local
IndexedDB library (`missioncore-environment-profiles`) holds named environment
snapshots, independently of a model. The immutable NodeDC preset is the initial
The first Environment Inspector section is now Profiles. A shared Core JSON
library holds named environment snapshots independently of a model. It replaces
the original `missioncore-environment-profiles` IndexedDB library. The immutable NodeDC preset is the initial
option. Save as creates a new identity; overwrite retains that identity and
uses a transactional revision check. Duplicate names and stale overwrites are
uses a revision check and an atomic file replacement. Duplicate names and stale overwrites are
rejected. Library updates notify other mounted scene editors and browser tabs.
Limits are 64 user profiles and 16 MB of encoded configuration including LUTs.
@@ -125,3 +129,47 @@ It selects the copy in the palette without assigning it to an object; creation
is undoable and obeys the existing material-count and total texture limits.
LevelButton owns compact geometry: text and padding scale together below
64 × 24 px down to 32 × 12 px, including both contrasting fill text layers.
Owner correction, 2026-11-09: durable Core JSON authority
------------------------------------------------------
All rover/battery scene documents, materials and embedded textures, environment
profiles, camera poses, editor layouts, battery appearance and viewport height
belong to `data_dir/scene-profiles/<kind>/<sha256(ownerId)>/meta.json`. The
canonical operator service currently uses `.runtime/mission-core` as data_dir.
These files are durable configuration, excluded from cache/temporary retention.
Battery and rover documents are isolated; the environment library is shared.
This synchronizes browsers using the same Core, not unrelated Core installations.
GET/PUT `/api/v1/scene-profiles/{kind}?owner=…` uses the existing local-operator
origin boundary. Each document envelope has schema, owner, kind, revision and
updatedAt. A writer must supply the revision it read. Atomic replacement and a
`meta.previous.json` backup protect the prior saved document; a stale tab gets a
conflict instead of overwriting newer settings. Failed or corrupt reads never
turn into an automatic default save. Texture-bearing documents retain the 32 MB
bound. Ordered/debounced saves flush pending edits on close/pagehide.
Only an absent Core document may import a validated legacy IndexedDB/localStorage
record. Existing browser records are never deleted, and an existing Core profile
always wins. A server error does not fall back to browser storage. The old neutral
environment migration remains a parser transformation; its historical browser
backup is no longer the persistence authority. Import/export and editor Undo/Redo
continue to use the same scene document.
Incident evidence: the Chrome origin IndexedDB inspected on 2026-11-09 was created
at 13:48:26; the old full scene was absent. The exact deletion/recreation trigger
was not established. Clear Cache's inspected settings excluded IndexedDB and
localStorage; blaming that extension is not supported. Actual Nov 4 00:15 scene
JSON restored the white enclosure, transparent side, black background and stored
camera/layout. A retained Chrome localStorage record separately recovered the
newer battery UI (90 px cards, 11/13 px text, 160% markings, 61×18 indicator).
No more recent complete material/environment scene was found, so recovery is not
a claim of an exact final Nov 4 afternoon state. Evidence and source hashes:
`outputs/scene-profile-recovery-20261109/README.md`.
Validation: 1531 frontend tests, 6 Python persistence/API tests, TypeScript, Ruff
and production build passed. Chrome reload and a separate browser loaded the same
restored Core document. Changing the material-palette tile size produced the next
JSON revision; Undo restored the entire recovered scene document byte-for-byte
after JSON normalization. No hardware commands were used.