LearnNewsExamplesServices
Frontmatter
id19307
titleThe first perspective save with activate: false is always refused
stateClosed
labels
bugaicore
assigneesneo-opus-grace
createdAtSep 27, 2026, 2:39 AM
updatedAtSep 27, 2026, 10:32 AM
githubUrlhttps://github.com/neomjs/neo/issues/19307
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 27, 2026, 10:07 AM

The first perspective save with activate: false is always refused

neo-opus-grace
neo-opus-grace commented on Sep 27, 2026, 2:39 AM

Context

The Institution's FleetPermanenceMatrixRow4NL saves the live Fleet dock document through the real writer with perspectiveStore.savePerspective(record, {activate: false, replace: true}) into an empty library. It has been refused since at least engine pin 9 (retained on neomjs/neo-agent-institution#10, 2026-09-14): ["activeLayoutId must name an existing layout when layouts are present"]. The refusal reproduces on engine 2965d82 and on dev a50ae57ce8 (neomjs/neo-agent-institution#274).

The Problem

savePerspective's activate option is documented as "Point activeLayoutId at the saved record". Into an empty library, activate: false leaves activeLayoutId: null with one layout present. The whole-candidate validator (PerspectiveLibrary's collection check) refuses exactly that state, so the option can never succeed on the first save. The caller gets saved: false and an error that names an invariant it could not have satisfied. Every product caller today activates (the Institution's CockpitPerspectives and cockpit controller, the engine's DockService), so the defect is latent. PerspectiveLibrary.spec only uses activate: false after an activating first save.

The Architectural Reality

src/dashboard/dock/persistence/PerspectiveLibrary.mjs#savePerspective already resolves one dangling pointer: a replaced active holder hands its activeness to the replacement, "rather than leaving the pointer dangling (the whole-candidate validator would reject)". An empty library's null pointer is the same case. The saved record is the only layout, so it is the only valid active one.

The Fix

In savePerspective, a candidate whose activeLayoutId is still null after the save takes the saved record as active, whatever activate says; activate: false keeps meaning "do not move an existing pointer". Update the option's JSDoc to say so.

Acceptance Criteria

  • AC-1: savePerspective(record, {activate: false}) into an empty library saves and makes the record active (a PerspectiveLibrary.spec arm, red on dev).
  • AC-2: with an active record present, activate: false still leaves the pointer where it was (the existing arms stay green).
  • AC-3 (post-merge): on an Institution engine pin carrying this, FleetPermanenceMatrixRow4NL passes. Owner: neomjs/neo-agent-institution#277 (the pin that carries this fix; #274 closes with its PR first).

Out of Scope

  • Relaxing the collection validator: a non-empty library keeps its active record.

Related

neomjs/neo-agent-institution#274, neomjs/neo-agent-institution#10. The perspective-selection contract is ADR 0029 (#18606 / #18618).

Live latest-open sweep: the latest 20 open neo issues at 2026-09-27T00:39Z hold no equivalent; gh search for savePerspective / activeLayoutId finds none. A2A: none in the last 30 messages. Memory Core: the 09-14 pin-9 observation is the only prior record.

Origin Session ID: 6408fcd4-3571-4ec2-8009-b4dae5d18917 Retrieval Hint: "savePerspective activate false empty library activeLayoutId refused"

tobiu referenced in commit 050fdef - "fix(dock): the first record of an empty perspective library is active, even saved with activate: false (#19307) (#19308) on Sep 27, 2026, 10:07 AM
tobiu closed this issue on Sep 27, 2026, 10:07 AM