System Interactions
The operating system is not passive. It invokes callbacks, manages process lifecycle, delivers notifications, routes URLs, and terminates background work. Code that participates in OS-managed lifecycles has a fundamentally different structure than code that runs only when explicitly called. This lens identifies where the codebase touches the OS boundary — not to use system frameworks (see system-dependencies), but to participate in OS-managed communication, lifecycle, and integration protocols.
Signals and Indicators
Application lifecycle callbacks:
- iOS/macOS:
UIApplicationDelegatemethods —application(_:didFinishLaunchingWithOptions:),applicationDidBecomeActive,applicationWillResignActive,applicationDidEnterBackground,applicationWillTerminate;SceneDelegateequivalents for multi-window - Android:
Activity.onCreate/onStart/onResume/onPause/onStop/onDestroy,Service.onCreate/onStartCommand,Application.onCreate,ContentProvider.onCreate - Web:
DOMContentLoaded,load,beforeunload,unload,visibilitychange,pageshow/pagehide; Service Worker lifecycle (install,activate,fetch) - Windows:
OnLaunched,OnSuspending,OnResuming(UWP);Application_Startup,Application_Exit(WPF);Main()entry point with message loop
Background execution:
- iOS:
BGTaskScheduler.submit(),beginBackgroundTask(withName:),URLSessionbackground download/upload tasks,WKExtensionDelegatebackground fetch - Android:
WorkManager,JobScheduler,AlarmManager,ServicewithSTART_STICKY,BroadcastReceiverfor system events - Web: Service Worker
syncevent,BackgroundFetch API,Periodic Background Sync - Windows: Background tasks via
IBackgroundTask,AppServiceconnections
Interprocess communication (IPC):
- iOS: App Extensions communicate via shared containers or
NSXPCConnection;openURLto other apps;CFMessagePort; Pasteboard for cross-process data - Android:
Intentsystem (explicit and implicit);ContentProviderfor structured data sharing;AIDLinterfaces;Messenger - Windows: Named pipes (
NamedPipeServerStream/NamedPipeClientStream); COM/DCOM; WCF (Windows Communication Foundation);MemoryMappedFilefor shared memory - Web:
window.postMessagecross-origin;SharedWorker;BroadcastChannel;MessageChannel; Service Worker message passing
Push notifications and remote events:
- iOS:
UNUserNotificationCenterdelegate methods;application(_:didReceiveRemoteNotification:)in AppDelegate;UNNotificationServiceExtensionfor content modification - Android:
FirebaseMessagingService.onMessageReceived(); notification channel creation;PendingIntentfor notification actions - Web:
ServiceWorkerRegistration.showNotification();pushevent in Service Worker;notificationclickhandler - Windows:
ToastNotification;BadgeUpdateManager;TileUpdateManager
URL schemes and deep links:
- iOS:
application(_:open:options:)for custom URL schemes;application(_:continue:restorationHandler:)for Universal Links;UIApplicationShortcutItemfor home screen quick actions - Android:
Intentfilters withACTION_VIEWand URI patterns inAndroidManifest.xml;onNewIntent()handling - Web: Protocol handlers (
registerProtocolHandler); Progressive Web App URL handling inmanifest.json - Windows: Protocol activation in
Package.appxmanifest;OnActivatedhandler in App class
File system and OS integration:
- Document provider extensions (iOS
UIDocumentPickerViewController, Android Storage Access Framework, WindowsFileOpenPicker) - File watching / directory monitoring (
FSEvents,inotify,FileSystemWatcher,ReadDirectoryChangesW) - Socket communication (Unix domain sockets, TCP sockets for localhost IPC)
Keyboard, accessibility, and input system integration:
- Custom keyboard extensions (iOS
UIInputViewController) - Accessibility tree callbacks (
UIAccessibility,AccessibilityServiceon Android) - Input Method Editor (IME) integration
- Global keyboard shortcut registration
Boundary Detection
- Lifecycle callback implementations are natural scope group anchors. Files that implement
UIApplicationDelegate,AndroidApplication, or equivalent are the entry points of the application — they are architectural seams where scope groups plug in. - Each OS integration point is a potential boundary. A file that handles push notification payloads is in the notification scope group. A file that handles URL scheme routing is in the routing/deep-link scope group. Treat each OS integration point as a distinct concern.
- Background execution code belongs in its own scope group. Background tasks have distinct lifecycle, resource, and testing constraints. Code that runs in background contexts should not be mixed with foreground UI code.
- IPC code is infrastructure. An app extension that communicates with its host app via shared container is infrastructure-layer code — it should be grouped with other infrastructure, not with the feature it serves.
- Lifecycle callbacks that dispatch to many subsystems are composition roots. An
AppDelegatethat calls 15 different services is a composition root, not a feature — it belongs in anApporBootstrapscope group that wires everything together.
Findings Format
SYSTEM INTERACTIONS FINDINGS
=============================
Application Lifecycle:
- <Platform> lifecycle callbacks in: <file list>
Callbacks implemented: <list — e.g., "didFinishLaunching, didEnterBackground">
Services initialized in launch: <list>
Background Execution:
- <Mechanism> — purpose: <description>, implemented in: <file list>
IPC Mechanisms:
- <Mechanism> — direction: <"in" | "out" | "bidirectional">, files: <list>
Push Notifications:
- Handler file(s): <list>
- Payload types handled: <description>
URL Schemes / Deep Links:
- Schemes: <list>, handler: <file>
- Universal Link domains: <list>
OS Integration Points:
- <Integration> — files: <list>, purpose: <description>
Lifecycle Anomalies:
- <description — e.g., "AppDelegate initializes 12 unrelated services — should be decomposed into startup tasks">
Recommended Scope Group Candidates:
- <Name> — <primary OS integration>, <one-line rationale>