# Profile ownership boundary

Assessment for NEXT_FEATURES.md, 2026-10-04. This is an implementation contract, not a claim that extra profiles are available.

## Existing runtime

`YokanRuntime` is now a compatible facade over one explicit Default `ProfileSession`. The session lazily owns its database, local file/archive services, repository, SettingsStore, LibraryIndexStore, service registry, chapter/download controllers, migration/colorization services, and schedulers. Captured callbacks resolve that owner, and service/observer work uses its scope. Native storage is Room; browser storage is a serialized snapshot whose persistence job/listeners belong to the backend. Additional-profile production construction is explicitly rejected until credentials, activation and jobs are isolated.

## Ownership

`ProfileSession` owns the composition graph and must become the isolation boundary for download queues, source preferences, cookies/logins, extension runtime instances, trackers, sync credentials/identity, backup retention, and every mutable controller that captures these. Independent backend paths and an owned graph do not yet isolate platform stores or jobs. Notes are fields on titles in that database, and saved source presets belong in session settings. Do not store either in a device-level singleton or extension metadata.

The device registry alone owns stable profile IDs, names, permanent Default, and last active profile. Installed launcher icon choice and OS permission grants are device-wide. Immutable extension binaries may be shared; runtime state, credentials, WebView stores, server processes and cookies require a separate namespace or must be unavailable to extra profiles until isolation is supported.

## Compatibility and lifecycle

Adopt existing database, browser key, and app-owned folders as Default in place. Do not rename or copy Default data during registry initialization. Commit registry writes atomically so interruption does not reset adoption. New profiles use independent Room files, browser keys, and app-owned roots keyed by a stable ID, never a display name.

Switching must flush reader progress, cancel and join the session's work, await database persistence, close resources and clear navigation/ViewModels/caches before publishing the new session. Create/validate the replacement before retiring the prior session; retain a usable session on failure. Delayed callbacks and background jobs carry their original profile ID. Deletion invalidates pending jobs and touches only that profile's app-owned data, preserving exports and external folders.

Backup/restore operates on the selected session, even when inactive, with a target lock and safety snapshot for that session. Backup profile metadata never selects the restore destination. Selectors and quick switching appear only when an extra profile exists; Profiles management remains discoverable with Default alone.

## Periodic background-work ownership

Periodic Android requests persist `yokan.profile_id`; unique schedule/cancel names use the stable ID, never the display name or active profile. Default retains its existing unique work names so upgrades do not duplicate jobs. Only legacy requests with an absent owner key adopt Default. A present malformed or non-string owner is invalid and cannot fall back to Default. Existing daily work kept with WorkManager's KEEP policy may retain absent legacy inputs and uses that same explicit adoption rule.

Before opening a session, `ProfileBackgroundWork` reads current registry metadata. Unknown, Provisioning, Deleting, retired, or unsupported owners are terminal skips. Malformed/unreadable registry metadata requests a retry without opening storage or replacing the metadata. The opener must return exactly the recorded ID. Production currently supports Default only; a Ready extra ID never falls back to Default. iOS's existing permitted task identifiers permanently belong to Default; its scheduler rejects extra IDs until an explicit dispatch scheme is implemented. On a cold iOS launch, unreadable metadata retains a request with at least a 15-minute retry delay, since no session opens to restore the settings-derived schedule.

Admitted callbacks execute as children of the owning session. OS caller cancellation cancels and joins that callback, including finalizers, while leaving sibling owner work alive. Retirement stops admission and cancels/joins callbacks before database release. Retiring/closed owners skip late work. Task failure does not cancel the session's SupervisorJob. The last-active registry ID is never used to choose the worker's database. iOS reports completion exactly once after coroutine cleanup, including cancellation before its body is dispatched; cancellation remains a failure rather than a success.

Periodic-work ownership is extended by the download/notification milestone below. Sync namespaces, backup retention, activation routing and a lifecycle lease against concurrent deletion remain pending. A metadata check alone does not exclude deletion racing an already admitted callback. Additional-profile production sessions and management UI remain gated on those boundaries and activation recovery. Verification is tracked in NEXT_FEATURES.md; device execution and real OS relaunch acceptance remain open.

## Download and notification ownership (2026-10-05)

Android download resume work now records `yokan.profile_id`, partitions unique work by stable ID, and uses fresh registry admission before resolving a captured session's downloader. Only absent owner data on pre-profile Default jobs adopts Default; explicit malformed IDs never fall back. Recovery initializes the owning downloader before waiting for its queue to drain. Downloader rows and page/artifact state use its captured database/file service; app-owned roots are already separate, while shared external paths/grants still require the integration audit.

Foreground-service bindings are process-local capabilities carrying a stable profile ID plus a new random session token. A notification action resolves that exact live binding, without bootstrapping storage; old foreground actions without a live token are refused rather than adopted. Its PendingIntent data identity contains both values so two sessions for the same profile cannot share an old action. Replacement invalidates the prior token and stops its mirrors; retirement cancels/joins binding work and removes the capability. Cancellation belongs to that owner scope. Expiring a service mirror cancels/joins the mirror while leaving download workers in the owner scope alive. An already-canceled caller is rejected before dispatch into either a session or a download binding; immediate dispatch cannot give it side effects in a live owner. A service started only to cancel waits for the owner action before stopping. The one Android foreground indicator remains bound to its current live owner; extra-profile concurrency is not yet supported or exposed. The indicator keeps its existing installation-level notification ID.

Notification factories capture a profile. Default retains existing Android/iOS notification identifiers; extras use full string identities. Android extras use NotificationManager's `(tag, ID)` API rather than hashing an arbitrary profile/tag into an integer, so distinct owners and hash-colliding tags cannot cancel or overwrite each other. Session notification endpoints stamp their origin and refuse stale post/cancel/permission calls after retirement. Desktop/browser in-app messages retain that origin and the root filters foreign profiles; genuinely device-level messages remain visible. OS permission grants and channel definitions remain installation-owned.

This does not complete profile switching or deletion. Open-app notification taps still use the existing launcher flow; routing to an inactive profile needs activation recovery. A displayed snackbar and direct device/global notification producers need disposal/audit during switching. Deletion must coordinate a work lease, cancel the selected owner's jobs, and remove its delivered notifications/artifacts; a fresh metadata check alone cannot exclude a concurrent deletion race. Remote sync namespaces/credentials, targeted backups/retention, platform integration stores and external grants remain pending. Additional-profile production sessions remain gated. Real PendingIntent delivery, process relaunch and OS/device acceptance remain unverified.

## Sync-call ownership (2026-10-05)

The service graph exposes session-bound wrappers for both hybrid sync and direct cloud actions. All suspend calls, including password/browser sign-in, logout, manual sync, connect, upload and restore, execute under a child SupervisorJob of the captured session. Caller cancellation cancels and joins only that call, including finalizers; owner retirement cancels and joins every call before releasing the provider graph and platform HTTP transport. Already-canceled callers cannot dispatch even with immediate execution. Synchronous browser-attempt/account/provider reads are gated by the live owner, so stale references cannot open another sign-in flow or read an account after retirement. Browser attempts remain owned by the underlying provider's exact attempt identity; no callback consults the active profile. Both public entry points share one retirement boundary. Orderly cleanup uses `SyncService.closeAndJoin`; legacy `close` remains immediate shutdown.

Hub, Mangayomi and cloud credential commits check cancellation before saving a response. Cloud connect additionally compares the exact captured preference using the database's guarded write, rejecting a delayed sign-in if another provider/server/account configuration has replaced it. Cloud transfer boundaries check cancellation before uploading an export, starting restore from downloaded bytes, or recording success. Remote work already accepted before cancellation cannot be undone; committed local transactions are joined before backend release.

This is call-lifetime ownership, not complete credential isolation. Native/browser transport cookies, WebView storage, tracker callbacks, extension/server state and external grants still need isolation or capability gates. Remote accounts/libraries need an explicit ownership or namespace policy before two profiles can connect; current provider protocols do not acquire a profile namespace from these wrappers. Cloud object prefixes, targeted restore leases and transfer-versus-account-change recovery remain pending. Additional-profile production construction and UI remain gated. All 66 focused sync tests passed, including 17 new lifecycle/credential-race tests, followed by the full 1000-test desktop suite and Android/browser/iOS simulator compilation.

## Remote sync account leases (2026-10-06)

Every profile, including extra profiles, builds the real Hybrid/Hub/Mangayomi/cloud sync graph and Together; `UnavailableProfileSync` and Together's account gate are gone. The device registry records `syncLeases` (`key` → owner profile). A profile holds at most one lease (it has one sync preference): claiming replaces its previous lease, repeats are idempotent, and a key held by another profile fails with "This sync account is already connected to profile ‘<name>’". Conflicts leave the registry Ready. Old registry JSON without the field decodes unchanged; beginning a deletion drops the profile's lease.

Keys come from the stored preference, lowercased: `hub|<normalized server>|<email>`, `mangayomi|<normalized server>|<account>`, `cloud|<provider>|<account label>`, `syncyomi|<normalized host>|<first 8 bytes of SHA-256(API key), hex>` (the raw key never enters the registry), `gdrive|<OAuth client id>|<Google account email>`. Mangayomi password logins store the typed email and OAuth the server username, so one account reached both ways yields two keys. A blank account name still leases its server/provider, so only one profile may use an unnamed account there.

Hub, Mangayomi and cloud sign-in claim the key right before the guarded credential write; a conflict writes nothing, and a rejected write hands the lease back to the previous account (or releases it). Logout releases the lease (best effort). Session start adopts the account the profile already uses, such as Default's pre-lease login. Every Hub round, Hub live-events start, Mangayomi run and cloud transfer re-claims first, so a conflicting login (e.g. restored from a backup) reports the lease error and never contacts the server; its credentials are kept.

Auto-sync is scheduled for every profile: Android WorkManager per profile, foreground scheduling elsewhere. iOS BGTasks stay Default-only (fixed task IDs). On the browser, extra-profile transport refuses WebSockets and Cookie headers, so Hub live events are unavailable there (REST rounds still work) and Mangayomi sync, which authenticates by cookie, fails in extra browser profiles.

## Cookie and shared-browser ownership (2026-10-05)

`CookieJar` captures its stable profile ID and session lifetime. Database cookies retain their existing encoding and Default adoption behavior; transient solved-browser user agents remain local to the jar. Reads and mutations are serialized per jar. A retired jar returns no credentials, ignores imports/responses/clears, and does not touch the closed database. A replacement session reads only its saved database cookies and starts without the previous jar's transient user-agent state. Separately created extra jars can hold independent database cookies but cannot access a shared browser store.

The public browser factory gates a lazy platform delegate before creation or any operation. Production supplies its session scope; headless browser calls are children of an owned SupervisorJob, join their cleanup on caller cancellation, and are canceled/joined before session storage release. Already-canceled callers cannot dispatch, including with immediate execution. Standalone Default callers retain their existing factory signature and caller lifetime. Retired owners, and extras on platforms without browser isolation, return the existing unavailable results without creating a browser or reading a platform cookie store.

Android headless challenge/script calls create their WebView on the main dispatcher and await `stopLoading`/`destroy` in a non-cancelable main-thread finalizer. Challenge polling is removed before release. Page/script callbacks ignore an expired continuation and cannot harvest after that call's cancellation. This replaces detached Handler-posted destruction that a joined coroutine could previously leave pending. iOS already awaits main-thread stopLoading; the desktop challenge's interruptible caller joins its existing process-cleanup finalizer. Actual native/resource cleanup and platform-store acceptance still require device/process testing.

The common rendered-browser entry gates the native view and keys it to the captured jar, so replacement cannot reuse a page that captured an earlier session. Navigation/progress, native seed/harvest/interception, queued desktop construction/update, and external-open actions recheck that jar. Sync browser sign-in receives the jar captured with its service graph rather than resolving the active runtime during rendering. In-app cookie feedback carries the owner and is suppressed after retirement. Active native-page disposal still belongs to the pending UI/switching coordinator; these guards do not provide a native-page lifetime lease or clear the adopted Default store.

Browser storage is gated by `CookieJar.canUseBrowserStorage`: open jar and (Default or `platformBrowserIsolation`). The profile's Room jar stays the source of truth; each platform store is seeded from it before loads and harvested back after loads/challenges.

| Integration | Default store | Extra-profile store |
| --- | --- | --- |
| Android headless/rendered WebView | Process CookieManager and WebView website data | androidx.webkit WebView profile named by the profile ID (`newProfileWebView`/`profileCookieManager`) when `WebViewFeature.MULTI_PROFILE` is supported; refused otherwise. Profile deletion calls `ProfileStore.deleteProfile` (in-use failures are logged). |
| iOS headless/rendered WebView | Default WKWebsiteDataStore | iOS 17+: `WKWebsiteDataStore(forIdentifier:)` with a UUID made from the ID's 32 hex digits, removed on profile deletion. iOS 15/16: one non-persistent store per profile per process (logins last until relaunch; the Room jar reseeds). |
| Desktop embedded browser | JavaFX WebKit and process CookieHandler | A fresh in-memory CookieHandler whenever the owning profile changes; `userDataDirectory` = `<profile cacheRoot>/webview` (deleted with the profile root). |
| Desktop challenge / system browser | Dedicated Chromium user-data-dir beneath cacheRoot; external browser fallback | Same, beneath the extra profile's own cacheRoot. |
| Browser tab opening (wasm) | Origin/browser-managed credentials | Refused: the tab's cookies cannot be isolated (`platformBrowserIsolation = false`). |

This is an explicit capability boundary for the browser bridges. Direct HTTP transport credential/cookie stores, third-party extension/server state, tracker callbacks, external grants and remote sync library ownership still need isolation or refusal policies. In particular, the Darwin HTTP engine still uses its existing session configuration, and browser HTTP uses its existing fetch policy. No extra-profile production activation is enabled. All 28 focused tests passed, including 13 new cookie/browser ownership tests, followed by the full 1013-test desktop suite and Android/browser/iOS simulator compilation after awaited Android headless cleanup. Rendered-view remount/callback guards and native cleanup were compiled; actual native-browser/store behavior, cleanup and device acceptance remain unverified.

## HTTP call ownership and transport admission (2026-10-05)

The service graph wraps both its enhanced HTTP client and raw sync transport in `ProfileHttpService`. The outer boundary owns settings/cookie access, Cloudflare retries and streaming; the raw boundary also protects Mangayomi's separate credential path. Each call runs under a SupervisorJob child of the captured session, preserves its request/response arguments, and cancels/joins on caller expiry. Session retirement joins these children before closing the HTTP engine and database. Transport or chunk-consumer failure does not cancel sibling work. Retired references fail with cancellation before entering the delegate. Stream callbacks check the original call job and owner even when invoked from a non-cancelable cleanup context; retained callbacks cannot deliver bytes after the call completes.

Both public platform HTTP factories accept a stable owner ID, defaulting to Default for existing callers. Extra IDs are refused in common code before allocating an engine. Service construction passes its captured ID for both app HTTP and the Hub WebSocket engine. Default still uses the existing OkHttp, Darwin and JS engine configuration; adopted cookies/authentication behavior is unchanged. This is a refusal policy for unsupported owners, not an independently namespaced transport implementation. Native/browser credential stores, redirects/authentication replay and independent extra-profile transports still require implementation and platform acceptance.

Reader-image and Together transports now capture their owner and join call-context cleanup as described below; cached image/UI callbacks still need the switching/disposal audit. The wrapper owns synchronous suspend stream callbacks but cannot join arbitrary work a consumer launches outside its call. Cancellation does not roll back bytes or remote requests already accepted. Additional-profile activation stays gated. All 54 focused tests passed, including 12 new HTTP lifecycle/admission tests, existing Cloudflare request/stream and sync regressions, and actual retired Room/service-graph rejection. Final full desktop regression passed (1025 tests, 1023 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Native/browser credential-store and device acceptance remain unverified.

## Together and image-client ownership (2026-10-05)

`ProfileSession` now owns a lazy `ProfileTogetherSession`, with its room client, following/driving state and captured database/scope. Together route and title actions capture that controller before any REST request or join. Replacing/leaving a room joins socket, pinger, send, client and engine jobs before transport release; it never cancels the parent profile. Interrupted replacement retains cleanup targets for retirement. Stale account snapshots and non-Hub sync providers are refused before engine allocation. Session retirement joins room work and releases retained transports before database close. Deep-link codes remain device-owned; existing reader/player state facades still require composition/navigation disposal when switching is implemented.

The image loader creates one reusable `ProfileImageHttpClient` with its captured jar, database and owner. Requests no longer resolve credentials through the current global runtime. Explicit source cookies and user agents keep priority except for a solved clearance's required user agent, preserving compatibility. Expired owners refuse settings/cookie access and progress callbacks. Owner cancellation starts transport cleanup; loader shutdown and successful transport release are also registered through the session's retryable resource cleanup before database close. Context-dependent resources register atomically with retirement, after their captured dependencies. A failed cleanup retains the database and retries its same resource. Loader publication and identity-checked clearing of the active cache target/URL progress are serialized, so an old loader cannot clear a replacement. Disk roots remain captured from the same session.

Together and image clients use `ProfileHttpEngine` to track Ktor's actual call-context jobs through completion, including response-body/socket lifetime. These jobs are attached to request execution contexts, not the engine job; canceling/joining only a client or engine job does not join their finalizers. Retirement stops admission, cancels and joins each tracked call, then releases the engine and joins its own job. Non-cancelable transport finalizers must finish before a room replacement can allocate another engine. App HTTP/Hub-sync shutdown now extends this tracking as described below; the earlier HTTP wrapper alone guaranteed its owned delegate/callback lifetime.

This addresses transport/controller lifetime, not independent OS/browser credential stores or remote room/account leases. Together account revocation is extended below. Cached image/decode callback disposal, full switching recovery and native/device acceptance remain pending. Additional-profile transport factories and production activation stay gated. All 49 focused tests passed, including 14 new Together/image/resource lifecycle tests and existing room reducer, progress, HTTP and Room/session regressions. The final full desktop suite passed (1039 tests, 1037 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Native/socket/browser/device acceptance remains unverified.

## App HTTP and Hub transport retirement (2026-10-05)

`KtorHttpService` now wraps the app engine in the same call-context tracker and exposes awaited shutdown. The service graph passes its captured owner job and awaits tracked request/body finalizers before native release. Raw transport entry points reject expired owners, callers and closed clients before URL validation, while the platform service factory rejects an expired owner before allocating Default's engine. Standalone callers retain the existing factory and service defaults. A failed engine release remains retired and can be retried; awaited shutdown still joins call jobs after an earlier legacy immediate close.

Hub owns a SupervisorJob child of the supplied app scope. Its snapshot watcher, debounce jobs and live-events work run under that child, so closing Hub preserves parent/sibling work. Its socket engine also tracks actual Ktor call roots. Orderly cleanup cancels/joins Hub work, then joins socket call finalizers and client/engine jobs. Hybrid sync forwards awaited cleanup to all providers in order. The profile wrapper serializes both public shutdown entry points, joins external calls first, and records successful awaited cleanup separately from legacy immediate release. Failed cleanup can be retried without reopening admission.

All 73 focused lifecycle/regression tests passed, including 10 new tests. They cover pending request/body-producer finalizers, actual Hub handshake cleanup through both wrappers, response/header compatibility, expired-owner refusal before Default allocation/dispatch, joined shutdown after legacy immediate close, concurrent public cleanup, native-release retry, and removal of Hub's watcher while preserving parent/sibling work. The final full desktop suite passed (1049 tests, 1047 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Independent credential stores, account/remote-library leases, UI switching/disposal and real native/device cleanup acceptance remain pending; production extra-profile activation stays gated.

## Together account revocation (2026-10-05)

The profile controller observes the selected Hub account identity: preference ID, provider, normalized server, token and device. A changed identity clears the published room and resets following/driving controls, cancels room admission and awaits retained socket/client/engine cleanup. Changes to unrelated library/settings or sync bookkeeping do not close the room. A new join drains every retained cleanup target before allocating a replacement; cleanup failure keeps its target for explicit leave/join or session retirement and reports a credential-free warning.

Room clients also retain a synchronous account guard at connect, Ktor engine dispatch, queued send, receive and reconnect boundaries. Observing an invalid account permanently cancels that client, so restoring its token does not resurrect a retained client. Room and engine admission call this guard outside their locks, and connection jobs start after unlocking even with an immediate dispatcher, avoiding room/engine/database lock inversion. The watcher rereads the current account after acquiring the operation lock, so a queued older snapshot cannot close a valid replacement. Already accepted remote bytes cannot be recalled, and this does not add atomic account leases to REST creation, sync transfers or remote libraries. UI following/navigation disposal and native/device acceptance remain pending.

All 41 final focused tests passed, including 10 new lifecycle/concurrency tests covering account changes, joined replacement, failed cleanup retry, unchanged settings, queued dispatch, actual Ktor WebSocket frames, independent owners and concurrent close during a blocked credential read. The final full desktop suite passed (1059 tests, 1057 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Extra-profile activation remains gated; native/device acceptance and the remaining account/UI boundaries above are pending.

## Cloud transfer account consistency (2026-10-05)

Cloud upload, download and combined sync capture one exact preference ID, server/provider, account label and access token for the entire operation. Each provider call uses that captured connection. Listing/export/download boundaries reject changed identities; combined sync downloads the object it already listed instead of listing again. Missing IDs do not fall back to an unrelated preference, missing/blank tokens fail before provider dispatch, and logout of an absent ID does not create a record or clear another account.

Cloud restore uses `BackupService.restoreIf`. The production implementation decodes normally, then checks the captured account against the current snapshot before writing a safety snapshot or preparing the replacement. That same snapshot is the atomic commit's expected value, so changes during preparation reject publication instead of overwriting new credentials or local edits. An implementation without guarded restore support fails closed. Existing merge/replace behavior, retained target credentials, local-note protection, safety snapshots and outbox generation remain in place. Completion uses the backend's guarded preference update and preserves unrelated settings/bookkeeping.

All 74 focused tests passed, including 12 new regressions covering transfer/account boundaries, exact-ID refusal, single-listing sync, guarded commit conflicts, unrelated bookkeeping and retained target credentials/safety snapshots. Final full desktop regression passed (1071 tests, 1069 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. These are boundary checks and optimistic commit guards, not durable account/profile leases: an identity changed away and restored between checks is not detected. An upload already accepted remotely cannot be recalled, and an account changed after a committed restore does not roll back that restore. Remote-library ownership, provider object namespaces, selected-target restore/switch/delete coordination, REST account leases, independent credential stores and native/device acceptance remain pending. Extra-profile production activation stays gated.

## Together REST creation ownership (2026-10-05)

The title detail route captures one session for its repository/settings/services and injects that session's Together controller and HTTP service. Its ViewModel observes that controller's room flow and uses its client/actions; the title action no longer resolves the runtime singleton. The controller owns REST creation and socket replacement in one joined external call. Controller shutdown cancels/joins the request even when the parent profile remains live; cancellation propagates through the profile HTTP wrapper and awaits delegate finalizers while preserving sibling HTTP work.

Room REST methods accept an optional account admission guard, preserving standalone API defaults. They check caller cancellation and admission before dispatch and after the response, before interpreting status/payload and before successful delivery. Creation captures preference ID, Hub provider, normalized server, token and device through replacement cleanup. A changed selection with identical credentials cannot retarget the created room. A successful result retains its exact client, and the title action checks that client and its own caller before navigation. Failed REST creation leaves the existing room in place. The account guard checks run outside room/engine locks.

All 37 final focused tests passed, including 14 new regressions covering captured REST/socket arguments, account changes, joined controller/caller cleanup, late responses, REST failure preservation, replacement cleanup, stale navigation and injected ViewModel behavior. The initial full run exposed the previously observed SQLite busy-lock fixture failure: unconditional rollback could mask failed acquisition. Its external lock now has a bounded acquisition wait, rolls back only after successful BEGIN, and always closes the connection; close-timeout and durable-retry assertions are unchanged. Expanded focused and final full checks passed after that fix. Final full desktop regression passed (1085 tests, 1083 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. These checks do not add durable account leases or detect every changed-away-and-restored identity between boundaries. A remote room already accepted cannot be recalled by cancellation; automatic remote-room cleanup is pending. Reader/player following, navigation disposal, selected-profile activation/switch recovery, independent credential stores and native/device acceptance remain open. Extra-profile production activation stays gated.

## Together UI bindings (2026-10-05)

Reader entry resolution captures one Default session and passes that owner to manga, anime and novel routes. Their ViewModels/settings callbacks retain that owner. Together hooks explicitly receive its room controller and collect its room/following/driving flows. Composition-bound capabilities retain the exact client and a child job; composition disposal or a new chapter/client cancels the old capability. Every follower mutation and host loop checks live controller ownership, account admission, controls and a STARTED lifecycle. Stopping the lifecycle suppresses admission immediately; resume creates a fresh capability and restarts effects. Follower position checks reject superseded media/position snapshots while permitting unrelated chat/error updates. The anime follower no longer asserts a nullable room.

Novel scrolling executes inside the follower effect rather than launching detached work in the screen scope. A canceled effect cancels its scroll; successful progress tracking resets for each client/chapter binding and ignores non-finite room values. Media navigation captures repository/settings/controller dependencies and checks its binding/current media before lookup and delivery; unavailable-title messages carry the originating profile ID. Together screen controls use captured state/lambdas. Leave passes the captured client into the controller's serialized operation so a delayed old action cannot leave a replacement room.

This is Together composition/client admission, not full profile switching. The coordinator still needs foreground progress save/join, navigation/ViewModel release, cache/media cleanup and failure recovery. The reader content milestone below covers remote anime/novel extraction; other screen callbacks still require their own ownership audit. Independent credentials, durable leases, extra-profile activation and native/device acceptance remain open. All 31 focused tests passed, including 15 new Compose/socket/navigation regressions for initial delivery, clamping/detachment, disposal/remount, stale media/position, account revocation before watcher dispatch and during a player read, same-code replacement, scoped Leave, lifecycle stop/resume, debounce cancellation, novel scroll finalization/threshold reset and navigation retention. Four initial execution failures were test-frame timing: Flow collection needs a subsequent composition frame. The fixture now delivers those frames without draining delayed work, and the original follower assertions passed. Final full desktop regression passed (1100 tests, 1098 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. These controlled transports/Compose scenes do not establish native player/browser/device acceptance or full switching cleanup.


## Reader content extraction (2026-10-05)

The session owns a lazy `ProfileReaderContent` with its captured database, extension factory, chapter resolver, local files and archives. Manga page loading, novel source headers/remote cleaned markup and anime video lists use this service. Each extraction is a child of its controller/session; caller cancellation cancels and joins that request, and retirement waits for runtime finalizers before service/database release. Closing the content service preserves the parent scope. Retained requests reject both canceled jobs and a retiring session before resource access.

The shared page resolver checks cancellation before saved-list reads, between headers/page extraction, after runtime release and before cache writes. Reader calls also supply session admission at those boundaries, so a retiring status rejects results even before the owner job is canceled. TTL, source-version validation, header merging, offline header/page fallback, deleted-chapter protection and no fabricated anime streams remain unchanged. Local manga files use the captured file/archive dependencies and settings on the file dispatcher.

Local novel EPUB resources and links are extended by the next milestone below. TTS, player initialization/configuration/proxy/AniSkip/screenshots, reader image/colorization/export callbacks, foreground progress save/join and full navigation/ViewModel shutdown still need ownership work. Production extra-profile activation remains gated. All 36 focused tests passed, including 15 new extraction/cache regressions and actual Default Room/service-graph retirement checks. Final full desktop regression passed (1115 tests, 1113 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Coverage includes late non-cancelable headers/pages/HTML, retirement admission before job cancellation and during runtime finalization, cache protection, joined caller/service cleanup, retained-call rejection, captured data/local files, compatibility behavior and parent-scope preservation. These controlled tests do not establish device or real-extension acceptance.


## Local novel content and links (2026-10-05)

EPUB inventory, chapter reads, embedded-resource reads and rich-content parsing now run inside the captured session's content call. The file dispatcher handles blocking archive work and parsing. Admission is checked after each archive read, before remote fallback/parse work and before delivering the parsed result. Retirement/caller cancellation joins an in-flight blocking read; it cannot publish content after expiry. Admission also checks the failure path after cleanup, so a late archive failure becomes cancellation instead of reaching UI error/fallback handlers. Embedded-resource callbacks retain the request job and refuse access after parsing finishes, even while their session is still live.

The service resolves configured paths with its captured database/settings/file service. Existing EPUB suffix/index defaults, absent-href behavior, resource-path normalization, cleaned remote markup and blank-chapter fallback remain. The UI parser owns markup, base URL and resource reference interpretation; no UI dependency moved into the content service.

Parsed links retain a composition/chapter/content binding, check the actual lifecycle at click time and refuse a retiring content owner before navigation. Backgrounding suppresses clicks immediately; resuming the same screen keeps its current links usable. Chapter/content replacement or disposal permanently cancels the old binding. A valid current link uses the latest same-screen action/settings. Content/header/loading/error state also keys on the captured content service, and loading restarts when a replacement lifecycle owner creates a new link binding.

All 40 final focused tests passed, including 18 new extraction/parser/Compose regressions. Controlled blocking reads verify joined caller/owner cleanup; real Compose scenes and parsed link listeners verify disposal/remount, chapter/owner replacement with identical IDs, immediate lifecycle admission, retiring status before job cancellation, updated actions, lifecycle-owner replacement and late archive-failure suppression. Final full desktop regression passed (1133 tests, 1131 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. These controlled reads/Compose scenes do not establish native/device or real-EPUB acceptance. TTS ownership, native player service callbacks, cached image/decode disposal, foreground progress save/join, complete navigation/ViewModel shutdown, credential isolation, extra-profile activation and native/device acceptance remain open.

## Novel speech ownership (2026-10-05)

The service graph wraps its captured native TTS backend in a session-owned speech service. Each novel chapter/composition obtains its own reader handle. Voice lookup and utterances run as owned child calls; retained handles and progress callbacks reject canceled callers, completed utterances, retired readers and retiring sessions. Native access serializes through cleanup: a replacement reader cannot allocate an utterance while its predecessor is still stopping. Stop cancels and joins only that reader's registered calls. Session Stop covers all registered speech calls.

The controller owns a child scope and serializes commands. Restart/pause/skip join the previous playback before changing its inputs. Progress callbacks retain their playback generation and cannot change highlights after pause, restart or retirement. Composition disposal synchronously retires both controller and reader instead of launching Stop into a canceled composition scope. Chapter or service replacement obtains fresh handles; an old Stop cannot target replacement speech.

Orderly session release joins voice initialization, utterances and native finalizers before closing the backend. Failed Stop remains recorded and retries before native reuse or release; failed backend release retains its target for retry. Successful release does not repeat. Android shuts down its captured engine; desktop destruction waits for process exit, escalating to forceful termination after a bounded graceful wait. iOS retains its existing immediate-stop behavior, and the browser backend remains its existing no-op.

All 28 focused tests passed, including 20 new speech/Compose lifecycle regressions and actual Default Room/service-graph retirement checks. Final full desktop regression passed (1153 tests, 1151 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. These ownership changes preserve the existing background-speech policy and do not implement foreground progress save/join, complete navigation/ViewModel shutdown, player callbacks, cached-image disposal or extra-profile activation. Real native speech/audio/device acceptance remains open.

## Player auxiliary ownership (2026-10-05)

The session lazily owns a player auxiliary service with its captured local files, AniSkip HTTP service and native stream proxy. Each episode/composition obtains a reader handle. Configuration paths derive from that owner's cache root; foreign configuration roots are rejected before file access. Configuration preparation and script installation check request admission between inventory, writes and native command dispatch. File work uses an injected background dispatcher and cancellation joins blocking work before returning.

AniSkip lookup belongs to the reader and checks the original caller and session on both result and failure paths. Screenshot requests seed a path under the captured cache root, recheck admission before native dispatch and join removal of rejected seeds. Long titles retain the timestamp and per-service request suffix, so a second rejected request cannot overwrite or delete a previous accepted screenshot. An accepted mpv command is still asynchronous; this layer does not establish native capture completion or revoke a command already accepted by mpv.

The reader's proxy adapter admits only its captured live handle. Stopping an old adapter retires that handle without stopping the shared session proxy. Synchronous registration drains on the background dispatcher before the session releases that proxy. Awaited native worker/HTTP cleanup is extended by the following milestone.

The player route injects this service; the screen no longer resolves auxiliary dependencies through the global runtime. Chapter or service replacement/disposal retires the old reader synchronously and resets remembered player/content/control state. Initialization checks that reader before native allocation/publication and before exposing failure UI; effects key on the controller/reader identity. Markers also refresh when the MAL identity changes and clear before lookup. External-open and screenshot actions use coroutine cancellation to reject stale calls.

All 35 focused tests passed, including 27 new service/blocking-I/O/Compose regressions and actual Default Room/service-graph retirement checks. Final full desktop regression passed (1180 tests, 1178 passed, 2 skipped, no failures/errors), alongside Android/browser/iOS simulator compilation. Native controller initialization/release joining, surface/bridge callbacks, queued mpv commands, PiP ownership, foreground progress save/join, complete navigation/ViewModel shutdown and additional-profile activation remain open. Controlled file/HTTP/proxy/Compose tests do not establish real native playback, screenshot or device acceptance.

## Native media proxy retirement (2026-10-05)

Session retirement now awaits the captured proxy's `closeAndJoin()` rather than its legacy immediate `stop()`. On JVM (Android/desktop), retirement closes admission, the listener and all accepted sockets, cancels the proxy's own worker job and shuts down the bounded executor. Ktor's actual call-context jobs are tracked through the existing profile HTTP engine, including response producers that outlive `execute()`. Awaited cleanup joins those finalizers before native engine release, then joins the listener/client threads off the UI thread and releases the client job. A failed native release remains retryable and cannot restart the proxy; another proxy retains its own registrations, headers and transport. Direct URLs with no headers also reject a retired JVM proxy. iOS/browser retain the no-op proxy through the compatible default awaited contract.

The legacy `stop()` still provides immediate socket/transport shutdown. A later awaited close joins outstanding finalizers even after that legacy path. Cancellation during awaited cleanup waits for retirement to finish. Loopback tests exercise the real socket and Ktor request pipeline with a controlled upstream transport; they do not establish native media playback or device acceptance. All 40 focused tests passed, including 7 new proxy lifecycle regressions, existing registration/idle-socket behavior, player auxiliary ownership and actual Default Room retirement. Full desktop regression passed (1187 tests, 1185 passed, 2 skipped, no failures/errors). Final Android/browser/iOS simulator compilation passed.

## Player controller allocation and retirement (2026-10-05)

The captured player service now owns controller allocation and its entire active callback. Native factory work runs on the captured background dispatcher; the result is recorded inside that block so prompt cancellation cannot lose a late allocation. Admission is checked before publication, and callback/factory expiry joins controller cleanup before returning. Failed controller cleanup remains in a service-owned retry ledger; another allocation and final session retirement retry it without reopening the old reader. Parent and sibling sessions retain their own controllers.

The player composition binds that lifetime through one effect. Its captured episode callback saves the current position before release and clears only its own controller state. Chapter/service replacement and disposal cancel the owned lifetime; the final callback stays on the captured UI context. This invokes the existing ViewModel progress action; joining the resulting persistence work remains a switching-coordinator task.

mpv controllers separate command/observer jobs from cleanup. Immediate release closes queue admission and cancels work; awaited release joins command/observer finalizers before native release, retries unsuccessful release and joins the owned cleanup job. Raw commands report failed admission accurately. The vendored mpv wrapper now distinguishes retired playback admission from successful engine close, so a failed close can retry rather than returning early. Compatibility controller release is terminal: retained commands, preparation results and snapshots cannot revive it. Its underlying Compose/platform surface lifetime is extended by the native/compatibility surface milestone below.

All 68 focused application tests and 8 vendored wrapper tests passed, including 18 new regressions (17 app, 1 dependency). Full desktop regression passed (1204 tests, 1202 passed, 2 skipped, no failures/errors); final Android/browser/iOS simulator compilation passed. Native capture completion is extended below. Legacy queued script/bridge commands, remaining surface/bridge/PiP callback ownership, image/decode disposal, foreground progress persistence joining, full switching and extra-profile activation remain pending. Controlled backends do not establish native playback, screenshot or device acceptance.

## Native command and screenshot completion (2026-10-05)

The controller exposes a separate awaited native command call. Its work belongs to the controller command job and shares the existing command mutex, preserving queue order. It checks the captured caller before native dispatch; caller expiry cancels and joins only that command, including blocking native calls and non-cancelable finalizers. Controller retirement also joins it before native release. Native errors return failure rather than successful queue admission. Legacy immediate commands still report admission; commands that launch scripts or other background work do not join that separate work.

Screenshot requests use this path with an explicit `sync` prefix, covering encoding/writing according to [mpv's synchronous command contract](https://mpv.io/manual/stable/#synchronous-vs-asynchronous). The captured reader creates a unique seed under its own cache root, awaits capture and rechecks admission before publishing the path. Failed or expired requests join capture before removing only their own file, so a late native write cannot race seed deletion. A backend that implements only queue admission cannot report capture success. UI notices recheck caller/reader admission after resource lookup and distinguish native capture failure from an unsupported backend.

Sixteen new regressions cover completion before path publication, queue ordering, queued/active caller expiry, delayed native writes, native failure, retired admission, independent file ownership, actual service/controller retirement and a native call blocked on an I/O thread. All 75 focused tests passed. Full desktop regression passed (1220 tests, 1218 passed, 2 skipped, no failures/errors); final Android/browser/iOS simulator compilation passed. Bridge UI/PiP admission and native/compatibility surface retirement are extended below. legacy queued script/bridge command completion, image/decode disposal, foreground persistence joining and full profile switching remain open. Controlled backends do not establish native screenshot or device acceptance.

## Player bridge UI and PiP admission (2026-10-05)

Bridge collection runs under the captured reader call and returns delivery to its caller's UI context. A separate UI binding retains that reader/controller and owns collection work. Caller, composition and session expiry join finalizers; expired callbacks cannot navigate episodes, update panels or dispatch playback commands. Handler updates use the latest callback within the same binding. Chapter/controller/service or lifecycle-owner replacement closes the old binding. Lifecycle stop closes admission immediately and advances an epoch, so stop/resume before recomposition cannot revive retained callbacks; STARTED remains admitted for paused/PiP playback.

PiP remains an installation-level platform capability with one current player owner. Ownership activates after composition commits; replaced/closed owners cannot publish state, request entry or clear a replacement's state. The platform retains an admission predicate that checks the original reader/controller/UI binding at dispatch, even before the next recomposition. Playback eligibility retains platform-specific rules, including browser toggling while paused. Android host replacement drops prior eligibility; detach, leave-hint and PiP-mode callbacks retain their originating activity and cannot retarget or clear a newer host. Browser requests also check admission before looking up the existing video target.

Nineteen new tests cover captured UI delivery, joined finalizers and late events, caller/session expiry, sibling preservation, PiP owner identity/publication and actual Compose disposal/remount, controller/chapter/service replacement, rapid stop/resume, lifecycle-owner replacement and current handlers. All 105 focused tests passed. Full desktop regression passed (1239 tests, 1237 passed, 2 skipped, no failures/errors); final Android/browser/iOS simulator compilation passed. Player surface retirement and browser DOM/PiP target binding are extended below; queued script/bridge completion, image/decode disposal, foreground persistence joining, full switching and extra-profile activation remain open. Controlled platform hooks do not establish native/browser PiP or device acceptance.

## Software player surface retirement (2026-10-05)

Desktop and iOS software render loops now run as controller-owned children on the captured composition UI context. Frame calls dispatch to the controller's background dispatcher without holding the playback command mutex, so a pending load does not stall surface work. The render capability retains its loop and caller; it rejects retired/completed loops and calls from another coroutine, preventing escaped callbacks from starting untracked native work. Native frame results and failures recheck admission before returning to UI handling. Expiry turns late success or failure into cancellation.

Caller cancellation cancels and joins its render loop, including native finalizers and the UI pixel finalizer. Controller retirement cancels every owned loop and joins them before releasing libmpv. The render loop has one pixel finalizer on its captured UI context: it removes the canvas reference before closing Skia pixels. Bitmap and error state are keyed to controller/output size, so old resize/replacement cleanup cannot close or overwrite a new surface. The earlier separate disposal path that could close pixels while frame work was still running is removed.

All 46 focused tests passed, including twelve new regressions. Nine ownership tests cover captured context, pending load independence, native/UI finalizer order, caller expiry, late success/failure, retired and escaped callbacks, and sibling preservation. Three actual desktop Compose surface tests cover mounted retirement, resize and controller replacement with delayed native completion. Full desktop regression passed (1251 tests, 1249 passed, 2 skipped, no failures/errors); final Android/browser/iOS simulator compilation passed. Native/compatibility surface retirement and browser DOM/PiP target binding are extended below; queued script/bridge completion, image/decode disposal, foreground persistence joining, full switching and extra-profile activation remain open. Controlled software frames do not establish real libmpv playback or native device acceptance.

## Native and compatibility player surfaces (2026-10-06)

Android's SurfaceHolder callbacks now retain a controller-owned native binding instead of launching attachment work in an independent view scope. Attach, resize and detach serialize; generations invalidate queued callbacks, and an identity check prevents old cleanup from detaching a replacement target. Ownership is recorded before attachment, so a partially failed native call still receives final detachment. Controller retirement closes callback admission, joins in-flight attachment and final detachment, then releases libmpv. Failed detachment remains retryable.

Compatibility surfaces allocate a fresh VideoPlayerState per controller/composition. The controller owns their effect work and a retryable resource record. Cleanup first removes the surface state and awaits child view disposal, then awaits backend disposal on the captured UI context. Compose's reverse effect-disposal order places the detachment acknowledgement after child effects. Failed backend release retains the allocation and cannot revive the UI; a retry also retains the original UI context. Controller replacement and remount never borrow an old backend.

The pinned ComposeMediaPlayer 0.7.11 source is now the local `:media-compat` module, with its MIT license and unchanged published native binaries. Its new `disposeAndJoin()` closes admission immediately and joins retryable cleanup. Android joins position-update work before ExoPlayer release; Linux cancels and joins queued UI callback work before stopping and disposing its pipeline; macOS and Windows join backend scopes before native release. macOS records a created pointer under its mutex even when cancellation arrives during allocation. iOS metadata extraction and queued main-thread actions belong to the backend scope, and metadata publication and observers check their captured player/item before using it.

Browser surfaces own an exact video element, removable guarded listeners, audio work and pending PiP promises. Retirement removes the source and callbacks immediately; awaited disposal joins element jobs, exits only that element's PiP and awaits AudioContext.close(). A failed Web Audio source still retains its context for cleanup. PiP requests capture the controller and its current bound state instead of searching the DOM. A pending old request blocks replacement requests until late entry and exit finish, preventing an old promise from retargeting a new player. Old unbinding cannot clear a replacement state.

Focused verification passed: 65 app tests, including nineteen new regressions (nine resource lifetimes, five native bindings, four actual Compose surface tests and one captured-controller PiP test); four JVM awaited-disposal tests; and all 36 headless-Chrome library tests, including four DOM/PiP and two AudioLevelProcessor cleanup tests with controlled AudioContext promises. Full desktop regression passed (1270 tests, 1268 passed, 2 skipped, no failures/errors); final Android/browser/iOS simulator compilation passed after the Linux/iOS callback refinements. Controlled browser promises and native hooks do not establish real media playback, native PiP or device/store acceptance. Queued script/bridge completion, image/decode disposal, foreground persistence joining, full switching and additional-profile activation remain separate open work.

## Notes compatibility delivered first

Private notes have an empty default in snapshots and Room migration 10→11. Source refresh copies the existing title and cannot replace private text. Native exports include notes for selected title types, including retained notes on unfavorited titles; native backups therefore contain private text. Merge retains existing notes when an old backup has no note, and separates differing texts with a blank-line divider. Replace honors the incoming native backup (legacy absence clears the note). Repeated imports of the same appended note do not duplicate it.

Hub sync excludes `privateNote` from outgoing documents, change detection, and incoming replacement. Mangayomi sync never emits it and retains the existing local note on remote update. Cloud backup uploads disable private notes regardless of caller options; a cloud payload records this omission so replacement preserves matching local notes. External Mangayomi exports omit notes and explain the limitation in the format picker. Entity debug strings contain only the title ID.

Two independently created database/repository instances are the current storage boundary. A true second-profile acceptance test remains open until sessions and platform credential isolation are implemented; no extra-profile UI should be exposed ahead of that work.

## Source preset compatibility

Saved source presets live in the owning database's settings JSON, with stable preset IDs, query text, typed selections, and a snapshot of the source/filter schema. This extends existing settings without another Room schema change. Legacy query-only rows retain deterministic IDs and are bound to their existing source at repository startup; rows whose original source is absent are marked unavailable rather than adopted by a later unrelated row.

Source identity includes runtime, repository, name, URL, language and title type, excluding installed version and local row ID. Apply fetches the current filter schema and validates identifiers, names, types, options and defaults before changing the active request. Runtimes that synthesize identifiers from labels/positions do not gain an assumed stable identity: translated names or reordered options require review. Review stages only individually compatible selections and requires an explicit Filter action before searching. Unsupported preset versions, ambiguous identifiers, missing schemas and mismatched sources cannot be applied.

Native settings exports include presets. Restore remaps source row IDs only when one destination source matches the stored identity (or the original backup source for legacy rows). Merge retains the local preset when stable IDs conflict and repeated imports do not duplicate it; Replace honors the incoming settings, including absence of presets. Merge leaves existing presets unchanged when a legacy backup has no preset field. A settings-only backup can remap by its stored source identities. Unmatched or ambiguous rows retain their original IDs, with identity validation preventing attachment to an unrelated source that reused a numeric ID. External backup formats do not carry these app settings.

Persistence is scoped to Default today. Future profile sessions must provide independent settings/database instances and backup targets; additional-profile isolation remains pending.

## Chapter release preferences

Default scanlator priorities and optional per-title overrides belong to database settings, alongside the duplicate-skipping toggle. Missing fields in legacy settings default to all releases; duplicate skipping is opt-in and uses the same selection policy across details, library counts/filters, manga/novel reading order, and anime navigation. Anime navigation retains the title's configured sort order. The existing separate automatic-read setting now uses the conservative release identity too. Preference changes select rows without deleting chapters, downloads, file paths or saved page positions. Live reader changes replace future preloads while keeping the current chapter/page and earlier stream content.

Identity uses explicit/leading chapter numbers and preserves fractional numbers, suffix parts, volume/season labels and recognized language/edition markers in chapter names. The runtime chapter model has no structured language/volume/edition fields; absent information cannot be inferred. Unnumbered, ambiguous and range entries stay separate. When skipping duplicates, any equivalent release's read/bookmark state is reflected on the winner. Group read/bookmark actions on the winner intentionally affect equivalents; Show all releases exposes individual state/actions and keeps scanlator/status exclusions. Online selection ranks configured groups first and uses downloaded availability to break equal ranks. Downloaded-only mode restricts candidates to available downloads before ranking.

Native backups carry preferences in settings JSON without another Room schema change. Merge retains local entries on owner-ID conflicts and maps incoming title overrides by title identity, so repeated imports are idempotent. Replace honors selected incoming settings. Settings-only restores can recover default preferences but omit title overrides without their original title identities; they never guess ownership from reused numeric IDs. Full native backups include those identities with their title rows. External formats do not carry the new app preferences. Additional-profile activation and targeted backup selectors remain pending.

Hub documents exclude release preferences and preserve them on incoming settings updates until the hub protocol supports their owner mapping and backup representation. Local sync identity migration remaps title overrides with the owning title. Native cloud backup transport follows the native restore rules above. No automatic-download runner exists yet; future automatic downloads must consume the shared policy before queuing.

## Bulk migration lifecycle

Migration discovery, review state and detail caches are transient and belong to the captured database/repository/settings/service scope. Default currently provides that scope. Discovery performs no library writes; an explicit review action applies cached candidates through the existing transfer path. Route recreation attaches to the existing request rather than starting another run. Search failure, cancellation or an unavailable destination cannot unfavorite an unfinished original. A transfer failure can leave a prepared destination row; the original, private note, progress and files remain available.

Future profile sessions must create their own MigrationService and runtime factory, cancel and join discovery/transfer work before closing the session, and discard its review/cache when publishing another profile. A run must never resolve its repository or settings from a newly active global session. No extra-profile migration UI is exposed by this change. Process restart abandons transient reviews; it does not implicitly resume or commit them.

## Automatic reader layout

The opt-in global flag and per-title automatic overrides live in database settings JSON. Legacy settings default to disabled; existing manual per-title modes continue to win until the user chooses Automatic or resets to the default. Automatic overrides retain a manual fallback, and explicit page-pairing overrides remain separate. Reader/page enum serialization is unchanged and no additional Room schema migration is required.

Native settings backups carry the new fields. Restore remaps title owners by unique backed-up title identity and drops unmatched/ambiguous owners; settings-only imports restore the global flag without guessing per-title ownership. Merge retains local conflicting overrides, while replacement honors the incoming settings. Hub documents exclude the new fields and preserve them on incoming updates; local identity migration remaps their owners.

Image geometry and classification decisions are transient reader-session state, never persisted in settings or backups. Sampling uses the existing image/cache pipeline with a bounded window and request limiter. Decisions include policy/source versions, metadata and page identity/header inputs; force refresh invalidates them. Closing the reader cancels its sampling deadline. A future profile switch must close and discard this ViewModel and its geometry/decision caches along with the owning session, preserving progress before publishing another profile. Default is the only session available today.

## Hold-to-scroll ownership

The opt-in flag belongs to database settings and defaults to disabled. It persists through existing Room settings JSON/browser snapshots and native backups; replacement restores the selected incoming flag, while merge preserves the local choice. Hub settings exclude this new flag until protocol support is available. Existing reader enums and schema versions are unchanged.

Gesture ID, base/current speed, idle/holding/scrolling phase and foreground eligibility are transient ViewModel state, never backed up or persisted per pointer update. A hold takes over the single list scrolling controller and release leaves ordinary scrolling paused. Stale drag/up callbacks cannot reclaim ownership or terminate a newer hold. Lifecycle pause, disposal/exit, focus loss, dialogs, zoom, resolved-mode changes and confirmed end-of-content stop scrolling. Continuous in-place chapter adoption retains the originating reader scope.

Future profile switching must pause/flush and discard the old reader ViewModel, dispose its scrolling/gesture effects, and join the session before publishing the next profile. No hold state may survive into another profile or be resolved against newly active global settings. Actual additional-profile lifecycle acceptance remains dependent on feature 8; Default is the only session available today.

## Installed app icons

The process-owned AppIconService reads and changes OS-owned installation state; it has no database setting and is absent from native backups and sync. Android persists stable launcher-alias enabled states; iOS persists the alternate icon name. Every future ProfileSession must share this service, and session construction/switch/restore must not reapply a profile's icon. Color-theme preferences continue belonging to each profile. See [app icon capabilities](APP_ICONS.md) for supported appearance choices and remaining launcher/upgrade/device checks.

## Registry and storage groundwork

`ProfileRegistry` owns only device metadata: version, permanent `default`, validated generated `p_` IDs, display names, last active ID, and retired IDs. Names never enter paths. Provisioning records cannot be activated until the coordinator marks them Ready; Deleting records cannot be activated and remain available for recovery. The coordinator must switch away before beginning deletion and remove app-owned data before finishing it. Retired IDs prevent reuse. These are metadata transitions, not a resource/session manager or a completed deletion implementation.

Registry metadata lives at `profiles/registry.json` beneath Android filesDir, the desktop data root, or iOS Documents; the browser uses `yokan-profiles-v1`. Metadata limits are 64 records, 4096 retired IDs, and 256 KiB of UTF-8. Deletion checks retirement capacity before permitting data removal to begin. IDs identify storage rather than acting as credentials.

Registry initialization adopts Default in place. Android/desktop use a stable sibling lock file, exact-value compare-and-set, a synced temporary file, and atomic replacement with no unsafe overwrite fallback. iOS serializes foreground scenes/BGTasks within this app process and uses Foundation atomic writes; app extensions must not mutate the registry. Browser commits hold a named origin lock around localStorage compare-and-set, following the [Web Locks specification](https://www.w3.org/TR/web-locks/). Where Web Locks is unavailable, registry mutations fail instead of falling back to unsynchronized writes. Invalid, oversized, unsupported or unreadable metadata is preserved, never reset. Startup reports failure while retaining the existing Default runtime. A started commit joins its result before publishing state.

Storage factories now accept `ProfileId`; their no-argument defaults preserve every existing location:

| Storage | Default | Extra profile |
| --- | --- | --- |
| Native database | Existing `yokan-room.db` in the platform database/data/Documents directory | `profiles/<id>/yokan-room.db` beneath the same base |
| Browser database | `yokan-database-v1` | `yokan-database-v1:<id>` |
| Android files | Existing filesDir `downloads`/`backups`, cacheDir | filesDir `profiles/<id>/downloads`/`backups`, cacheDir `profiles/<id>/cache` |
| Desktop files | Existing data root `Yokan/downloads`/`backups`, `cache` | data root `profiles/<id>/downloads`/`backups`/`cache` |
| iOS files | Existing Documents `Yokan/downloads`/`backups`, Caches `Yokan` | Documents `profiles/<id>/downloads`/`backups`, Caches `profiles/<id>/cache` |
| Browser virtual files | Existing `/yokan/downloads`/`backups`/`cache` | `/yokan/profiles/<id>/downloads`/`backups`/`cache` |

Only Default's native factory may load the legacy snapshot. Fresh stores have the standard empty first-launch state and no copied credentials. Each browser backend now owns its persistence timer and page listeners, removes them before the final flush on close, and rejects later persistence/atomic replacement. An explicit flush reports save failure and keeps dirty state available for retry. A malformed extra browser snapshot fails opening rather than being replaced by a seed. Whole-snapshot writes still need a future session/writer lease across tabs; a registry lock alone does not protect database saves.

### Boundaries still required before exposing extra profiles

- `YokanRuntime` delegates to its explicit Default session. Startup initializes registry metadata but does not open a recorded extra-profile session. Profile creation/rename/delete transitions are low-level APIs; no extra-profile management or quick-switch UI is enabled. The production session factory rejects extra IDs before allocating resources.
- Session retirement and backend close are implemented and verified. A switching coordinator still needs reader/player progress capture, UI/navigation/ViewModel disposal, activation publication, and a recovery plan. Retirement is terminal, including after a timeout: retry cleanup rather than reactivating a canceled owner. A failed retirement never claims the session is Closed; successful resource releases are not repeated on retry. Global in-memory logging and device UI/media state still need clearing or reassignment when activating another profile.
- Database cookies and their jar lifetimes are captured; browser bridges use per-profile platform stores where the platform has them (see the browser storage table) and are refused otherwise. Direct HTTP transport credential stores, extension runtimes/server state, media/stream proxies, browser-selected files and external folder grants still need isolation. Android SAF permissions and iOS security-scoped bookmarks remain process/device resources. File services accept external paths: distinct roots do not enforce containment or prevent cross-profile access by stale paths. Audit those capabilities and keep unsupported integrations disabled in extra profiles.
- Periodic/download resume jobs have recorded owner IDs, fresh admission checks and session-bound execution. Foreground cancel actions use expiring owner capabilities; notification identities/events capture the profile. Artifact rows/app-owned roots are captured, while shared external capabilities still need review. Activation/open-app routing, notification cleanup, remote sync identities, backup retention and the work/deletion lease remain pending. No new profile may inherit or implicitly attach to Default's remote sync library or device credentials.
- Inactive-profile export/restore locks, safety snapshots, selectors and a deletion coordinator that removes only owned data are pending. Preserve explicit exports and user-owned external folders. Native caches and Android database files occupy separate bases; cleanup must handle all owned locations without deleting the device registry.

All 40 profile tests, 9 download-binding tests, 6 notification tests, 4 background-completion tests, 12 sync-ownership tests, 8 cloud-sync tests, 5 cookie-ownership tests and 8 browser-ownership tests passed within the final 1013-test desktop suite (1011 passed, 2 skipped, no failures/errors). Android, browser and iOS simulator compilation passed after cookie/browser ownership and awaited Android headless cleanup. The tests verify metadata recovery/concurrency, ownership/retirement, background routing/expiry/completion, stale download actions and notification identities/origins, external sync-call lifetime and stale credential-response rejection, cookie ownership and browser admission/lifetime, plus actual desktop Room/files using identical title IDs and snapshot flush failure/retry. They do not verify actual OS browser/transport credential stores or native cleanup, remote-library ownership, profile switching, real PendingIntent/background-worker delivery, device acceptance, multiple browser tabs, or iOS process-extension coordination.

## Session retirement contract

Resource lookup and retirement share a lock so a racing lazy factory cannot open a resource after retirement begins. Resource construction remains lazy, preserving Default's startup behavior and storage locations. Hub auto-sync inherits the service/session scope through its own child job. Session work is canceled and joined before cleanup; finalizers must use the dependencies they captured while Open rather than looking up resources on a retiring owner. The caller must first save/stop reader/player progress and dispose its UI owners. Closing an unused session opens nothing. Cleanup is serialized and idempotent, and a canceled caller joins the started retirement result. Join and individual cleanup operations have deadlines; a timeout or cleanup failure produces RetirementFailed and retains unfinished resources for retry. This contract deliberately does not promise switching rollback.

Room stops accepting mutations, waits for an ordered cancellable flush barrier, drains/closes its writer channel, joins/cancels its persistence scope and closes Room. Initial import failures retry rather than allowing a later flush to claim success with an unpersisted seed. A pre-drain timeout restores write acceptance and retains pending writes; explicit mutation transactions still join their committed result. Browser close joins/removes persistence work, flushes current memory, and suppresses stale callbacks/atomic writes after success. Failed saves keep the dirty snapshot for retry. The active root attaches logging with an ownership token so retirement cannot detach a later target, even if both target the same file service.

Thirteen new tests passed for lazy ownership, independent captured stores, canceled close/final progress, retirement timeout/retry, quota failure, stale snapshot saves, real Room queue drain/reopen, a busy SQLite write lock, the actual Default service graph/scope, and stale logging ownership. Final desktop regression and Android/browser/iOS simulator compilation passed as recorded above.

## Activation foundations (2026-10-06, in progress)

The foreground navigator now owns its watcher scope, captures ViewModel jobs before store removal, and awaits finalizers from current, popped and replaced entries. Session retirement owns the actual app navigator. Reader temporary-file release waits for image writes and retains failed cleanup for retry. The coordinator serializes activation and explicit-target storage operations, detaches the old UI, retires its session and reopens a fresh prior owner if replacement activation fails. OS jobs use counted session leases outside the operation mutex; switch/delete joins their captured finalizers. Failed cleanup remains retained and blocks reopening the affected storage.

Extra-profile HTTP engines now have an explicit credential policy. JVM transports disable ambient cookie/authenticator/cache stores. Darwin disables OS cookie, credential and URL caches and automatic non-TLS credential challenges. The pinned [Ktor 3.1.0 browser engine source](https://repo1.maven.org/maven2/io/ktor/ktor-client-core-wasm-js/3.1.0/ktor-client-core-wasm-js-3.1.0-sources.jar) has no browser request-configuration hook, so extras use a separate anonymous fetch transport rather than the newer API documented for later Ktor versions. It always omits ambient credentials, uses no browser response cache, refuses cookie authentication/WebSockets and bounds a buffered response to 64 MiB. Default uses the original engines. Native/browser runtime acceptance remains separate from compilation.

Deletion uses stable app-owned paths rather than settings paths, protects recorded explicit exports and never follows native filesystem symlinks. Device-level export records are not backup payloads. Production activation/UI, targeted backup integration, cross-process/tab storage reservations and remaining shared integrations are still pending. These foundations do not remove the production extra-session gate.

## Mihon extension-server ownership (2026-10-06)

Each session builds its own extension-server runtime from `createPlatformExtensionServerAdapter(profileId)`; the adapter is the single capability gate (`unavailableReason`). A loopback proxy setting always resolves to the session's own server (running URL or a fresh start); the saved ephemeral port is never trusted because another profile's server may now hold it. Remote proxy URLs and the browser's user-configured URL pass through unchanged.

| Platform | Default | Extra profile |
| --- | --- | --- |
| Desktop | Legacy JVM home/tmp/cwd | Server JVM runs with `user.home`, `java.io.tmpdir` and cwd under `profiles/<id>/extension-server-data`; the downloaded bundle stays shared |
| Android | Legacy SharedPreferences names | In-process bridge prefixes every SharedPreferences name with `<id>__`; one profile owns the process-wide bridge at a time (others fail to start until it stops), and an owner change clears the bridge cookie jar and HTTP cache. Deletion removes the prefixed `shared_prefs` files |
| iOS | Embedded JVM | Unavailable: one embedded JVM per process whose bridge state cannot be reset per profile; remote URLs still work. A session that never started the JVM cannot stop it |
| Browser | Remote URL | Remote URL |
