Files
pipelines/app/notes/settings-own-destination.md
T
alan 26bb583f10 Refine Settings destination shell integration
Keep Settings navigation independent while preserving shell actions and destination-specific state. Add the reviewed chat, run-entry, layout, and regression-test updates needed by the destination behavior.
2026-11-12 11:21:26 +00:00

5.7 KiB

Settings is its own destination

Settings belonged to the Pipelines destination in four places: the route-to-tab map (tabForRoute), the shell's tab mapping (shellTabFor, now removed), the tab history, and the shell's onClosePage override that sent a Settings close to Pipelines. Each now treats Settings as AppDestination.settings.

Behaviour

  • /settings (and /settings/templates, /schedules) belong to Settings. The Settings location is persisted under its own key; Pipelines never receives it.
  • Only Settings is selected while it is shown: the phone bar's last item, no highlighted tab in the floating bar (currentIndex -1), and no rail tab (the rail's foot item only).
  • Leaving Settings (system Back, or the bar's Back while it exists) returns to the destination opened before it, from the shell's history. With none recorded (a launch straight onto /settings) it opens Pipelines.
  • Re-selecting Pipelines from Settings opens Pipelines' own last location; it never reopens Settings.
  • A reload on /settings restores Settings. Older saved snapshots that stored Settings under Pipelines are dropped on load (the path no longer matches).

Other change

NeedsYouRunsHeading (features/attention) called notifications.load() in initState. That load notifies listeners synchronously, so a Runs tab first shown from another tab (Settings to Runs) rebuilt an AnimatedBuilder mid-build and threw. The load now starts after the first frame. This is outside the Settings lane; it is needed for Settings to Runs to run without an error.

Focused tests

Command: tool/memwatch/full.sh with ten paths (see the run's output). Result: 68 passed, 0 failed.

  • test/application/tab_locations_test.dart
  • test/application/tab_location_navigation_test.dart (9 tests, new coverage: Settings state across Pipelines to Settings to Runs to Settings; re-selecting Pipelines does not show Settings; on /settings only Settings is selected in the phone bar, the floating bar and the rail; reload restores Settings)
  • test/application/settings_page_test.dart
  • test/application/templates_wiring_test.dart
  • test/shell/tab_history_back_test.dart
  • test/shell/navigation_rail_test.dart
  • test/shell/shell_navigation_bar_test.dart
  • test/shell/floating_tab_bar_test.dart
  • test/features/attention/notify/notification_manager_wiring_test.dart
  • test/features/runs/ui/runs_list_widget_test.dart

tool/analyze.sh: clean.

Harness notes

  • Two test files (tab_location_navigation_test.dart, settings_page_test.dart) now mark the first-run walkthrough as seen. Without that the walkthrough overlay on Pipelines absorbed the bar taps; on untouched HEAD the same tests failed for that reason. No expectation for the app's behaviour was changed to pass them.
  • Expectations that encoded Settings-as-Pipelines were changed to the new behaviour: tab location keys, the malformed-snapshot case (settings is now a valid key), and the routed history test (Back now returns to Chat, then Runs).

Limitations and compatibility with run 419

  • Run 419 removes Settings' Back arrow (shell.back) and the gear. The new navigation test uses the platform Back (handlePopRoute) and the bar, so it does not depend on either. navigation_rail_test.dart and settings_page_test.dart still tap shell.back and the gear; they will need the same change when 419 lands.
  • The shell's onClosePage parameter is removed (its only user was pipelines_app.dart). Any 419 code that still passes it will not compile.
  • Ctrl+A from Settings still goes to Runs (unchanged behaviour).
  • No device or browser capture was taken here; visual states belong to ui-review.

Review fix: Settings sub-pages never saved as Settings' place

_routeChanged recorded _delegate.route directly, so with Templates or Schedules open the Settings location became /templates or /schedules. Selecting Settings then reopened that sub-page. Now a Templates or Schedules route records the Settings route the shell renders underneath (_delegate.shellRoute). TabLocationsSnapshot.decode also drops stored templates/schedules routes, so an older snapshot cannot restore one.

Regression: tab_location_navigation_test.dart, "selecting Settings after a Settings sub-page opens /settings" (Pipelines, Schedules via the bar button, a pushed /runs, then Settings). It fails with the fix reverted and passes with it. Unit: tab_locations_test.dart, "a stored Settings sub-page is never restored".

Focused results (memwatch, two files): 24 passed, 0 failed. Analyzer: clean.

Known, not changed: Schedules opened from Pipelines still returns to Settings (openSchedules sets the return route to Settings), so Settings shows under it.

Land re-entry: main moved

main gained 77a88d09 (Settings as a top-level destination, from another run). Its shellTabFor mapping is gone here: Settings is its own destination, so the shell no longer maps it to Pipelines. The merge was taken as a squash (git merge --squash main), left staged and not committed, as this stage requires.

Conflicts resolved:

  • app/lib/shell/destination.dart: this branch's doc comment (Settings selected alone, no tab highlighted). shellTabFor stays removed; no app/lib or app/test file uses it.
  • app/test/application/tab_location_navigation_test.dart: Settings opened from its nav item has no shell.back; leaving it for Pipelines uses the nav item, not a system Back. The unused systemBack helper is removed.

Focused results (memwatch, 7 files, one quoted list): 53 passed, 0 failed: settings_page_test, tab_location_navigation_test, tab_locations_test, tab_history_back_test, settings_back_test, navigation_rail_test, pipelines_settings_gear_test. Analyzer: clean.