Files
pipelines/app/notes/persistent-tab-locations.md
T

4.4 KiB

Persistent tab locations

Settings, Templates and Schedules belong to the Pipelines tab. Selecting another main tab and returning restores that tab's last canonical route, including Settings. Same-tab selection preserves the current location; explicit Back still exits Settings. The existing Chats retap-to-workspace behavior remains.

The owning tab's return route is separate from each mounted body's runtime route, so visiting Settings does not clear a hidden Pipelines detail/editor. Settings State stays mounted when switching tabs. Restored Templates/Schedules always retain Settings as their parent.

A scoped SharedPreferences snapshot records per-tab routes and the last active tab. Logical server identity is the scope; an endpoint is used only when there is no identity. Ordinary / / native-default launches can restore the active location; explicit launch URLs, including /pipelines, take priority. Pipeline versions/stages, run visits/filters and chat IDs survive canonical serialization; run decision actions are omitted from durable storage.

Storage loading never saves a partial default map. User-touched slots win over a slow load, untouched slots merge, and writes serialize so the final move wins. Unreadable history remains untouched, write failures do not poison subsequent saves, and disposing the app cancels late read-back persistence. Navigation stays responsive throughout.

Focused acceptance: 40 tests passed across tab locations, full-app navigation, router, Settings Back and existing Chats retap (/tmp/memwatch/out.A1UrLy). The subsequent disposal regression and navigation cases passed (16 cases, /tmp/memwatch/out.eUiZcl), bringing distinct covered cases to 41. Analyzer clean (flutter-analyze.Klkp0D). Full-app tests cover both native hosts, exact Pipelines → Settings → Chat → Pipelines restoration with identical Settings State, explicit Back, preserved hidden Pipelines selection, actual app recreation via SharedPreferences, explicit URL priority and delayed load races.

This change persists route locations; arbitrary dialogs, unsaved editor content and scroll offsets are not serialized by this store. Their existing mounted state remains intact within a session. Settings inner-topic persistence is a separate companion change. Manager-owned integrated browser capture/build and publication are still required; this lane did not deploy or restart anything.

Replacement-owner write ordering

Accepted navigation snapshots enter the shared per-key operation order immediately. Disposal rejects new records and late read-back writes, but does not discard a valid last move that was already queued. Replacement reads wait for all previously accepted writes before merging and saving newer navigation. This preserves the last move when an app is recreated without a new choice, while newer replacement navigation still wins. Idle operation keys are removed, and a failure never poisons later operations.

21 focused controller/full-app navigation/ordering cases passed after the final follow-up (/tmp/memwatch/out.ksAW8x); analyzer clean (JMtEk8). Regressions cover a blocked old write plus a queued accepted old write, disposal, replacement navigation and delayed release. Older accepted history is written before the replacement loads it; newer navigation wins afterward. Recreating without a new choice restores the old owner's last accepted chat, not its previous Settings location. Both same-instance fake stores and distinct SharedPreferences store instances sharing one logical key are covered.

Manager integration

Settings category persistence uses the same resolved server scope as tab locations. Explicit Settings Back returns to the preserved pipeline detail, while tapping the Pipelines tab retains Settings. Ordinary root launches with query parameters also restore saved navigation; explicit app paths still win. The integrated browser flow verified Settings/Tools → Chat → Pipelines → Settings/Tools, then reopening / restored Settings/Tools again.

Focused integration checks passed 14 cases (/tmp/memwatch/out.HMixOA). An older template workflow assertion was updated to use explicit Back, since selected-tab taps now preserve location. Two centered-tab assertions failed on the unchanged previous release too (/tmp/memwatch/out.m3tMaL); they now verify the user-requested left alignment already shipped. No layout code changed for those assertion corrections.