Skip to content

Startup route logic (reopen last project)#164

Merged
kirich1409 merged 1 commit intomainfrom
feature/startup-route-logic
Apr 17, 2026
Merged

Startup route logic (reopen last project)#164
kirich1409 merged 1 commit intomainfrom
feature/startup-route-logic

Conversation

@kirich1409
Copy link
Copy Markdown
Contributor

Summary

  • AppDelegate now lazily builds the root TCA Store with a computed initial route instead of hardcoding .welcome.
  • When SettingsStore.reopenLastProject is on and ProjectRepository has a recent project, the app opens in .main and auto-sends .openProject(url); otherwise it shows Welcome.
  • Pure decision logic extracted into StartupRouteResolver so the three branches are unit-testable without SwiftData/UIKit.

Files

  • MacApp/Relay/StartupRouteResolver.swift — new pure resolver (StartupDecision + resolve(reopenLastProject:latestProjectPath:)).
  • MacApp/Relay/AppDelegate.swiftstore becomes lazy var; resolver output determines AppFeature.State.Route; pending URL dispatched in applicationDidFinishLaunching.
  • MacApp/RelayTests/StartupRouteResolverTests.swift — 5 cases covering the 3 required scenarios plus two edge cases (empty-string path, false+empty).

Test plan

  • swiftlint lint --strict — 0 violations (148 files)
  • xcodebuild build — BUILD SUCCEEDED
  • xcodebuild test -only-testing:RelayTests — 22/22 unit tests pass (including 5 new StartupRouteResolverTests)
  • Pre-existing RelayUITests failures are unrelated — they also fail on main (verified by reverting the change and re-running testOpenTerminal_newTab)

Closes #148

AppDelegate now lazily builds the root Store with a computed initial
route. When reopenLastProject is on and ProjectRepository has a recent
project, the app opens in main with that project; otherwise it shows
Welcome. Logic is extracted into StartupRouteResolver for testability.

Closes #148
Copilot AI review requested due to automatic review settings April 17, 2026 11:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements “reopen last project” startup routing by deriving the initial AppFeature.State.Route from settings + persisted recent-project data, and extracting the branching logic into a pure, unit-testable resolver.

Changes:

  • Added StartupRouteResolver/StartupDecision to compute whether startup should show Welcome or reopen the last project.
  • Made AppDelegate build the root TCA store lazily with a computed initial route and (optionally) send an .openProject(url) on launch.
  • Added unit tests covering the resolver’s decision branches and edge cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
MacApp/Relay/StartupRouteResolver.swift Introduces pure resolver that maps (reopenLastProject, latestProjectPath) to a startup decision.
MacApp/Relay/AppDelegate.swift Switches store initialization to lazy var, computes initial route, and attempts to dispatch pending .openProject.
MacApp/RelayTests/StartupRouteResolverTests.swift Adds unit coverage for resolver behavior across main scenarios and edge cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread MacApp/Relay/AppDelegate.swift
@kirich1409 kirich1409 merged commit f5ac6ef into main Apr 17, 2026
14 checks passed
@kirich1409 kirich1409 deleted the feature/startup-route-logic branch April 17, 2026 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Startup route logic (reopen last project)

2 participants