From c7da49d791085f408deed14949813c8f15ecfd62 Mon Sep 17 00:00:00 2001 From: Alexey Martemyanov Date: Fri, 16 Oct 2026 01:28:17 +0600 Subject: [PATCH] [2026-10-16] eagle: work/projects/cpm-status-2026-10-15.md work/projects/cpm-web-extension-code-guide-2026-10-09.md --- work/projects/cpm-status-2026-10-15.md | 16 +++++++++++++ ...cpm-web-extension-code-guide-2026-10-09.md | 23 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/work/projects/cpm-status-2026-10-15.md b/work/projects/cpm-status-2026-10-15.md index 305c7207..7b338f23 100755 --- a/work/projects/cpm-status-2026-10-15.md +++ b/work/projects/cpm-status-2026-10-15.md @@ -602,3 +602,19 @@ The harness now posts and dequeues one neutral application-defined event after w ### Signing verification detail The latest signed build (`build-signed-event-loop.log`) invokes codesign with **Apple Development: Alexey Martemyanov (9SAT8X9S84)**, team HKE973VLUW, hardened runtime. `codesign -dvv` with normal keychain access confirms the Apple Development → WWDR → Apple Root CA chain. App debug dylib and `Integration Tests.xctest` independently pass `codesign --verify --strict`. `codesign --verify --deep --strict` on the entire Debug app fails in nested `DuckDuckGo VPN.app/Contents/Frameworks/Subscription.framework`: the seal lists four missing `Modules/Subscription.swiftmodule` artifacts (abi.json/swiftdoc/swiftmodule/Project/swiftsourceinfo). This is a separate nested Debug packaging limitation, **not an unsigned main app or test bundle**. No manual re-signing or production packaging changes were made for it. + + +### Verification of cleanup/event-queue changes: still red + +- `signed-pinned-final-control.xcresult`: posting/dequeuing a neutral event alone did **not** resolve the DEBUG window interruption. The first real P5 failure is again recorded in stdout, but no completed green test. The memory graph's currentEvent chain is a real reference; it was not established as the sole cause. Harness synchronous `Tab.setContent`, diagnostics collection and polling conditions are now also confined to autorelease pools, pending verification. +- `signed-large-cache-cleanup.xcresult`: the 20k cache scenario again completed its body with healthy post-reload/readiness controls, but static store removal still failed after the bounded retry. Merely clearing data and dropping harness references was insufficient: the pre-existing Integration Tests process-pool swizzle outlives each test. Teardown now requests `_terminateNetworkProcess` on the owned store **after evidence capture and data clearing**, before UUID removal. This is cleanup, not a causal fault used to claim P3. The previous fresh UUID `0FB56422-72D5-4CCB-AC66-86F3C50DE165` is recorded explicitly for cleanup auditing; no user-store identifier is selected. + + +WebKit cleanup contract checked against primary sources: [profiles API](https://webkit.org/blog/14423/building-profiles-with-new-webkit-api/) documents that removal can fail while an active view uses the profile; [WKWebsiteDataStore.mm](https://github.com/WebKit/WebKit/blob/main/Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm#L1088) implements `_terminateNetworkProcess` by forwarding to its WebsiteDataStore. Current upstream source is reference material, not an assertion that this macOS release has the identical revision. The actual runtime selector is checked before test-only cleanup. + + +### P5 app test scope narrowed explicitly, not a hidden green result + +`signed-pinned-scoped-pools.xcresult` again interrupted after the first lost navigation. The harness printed `currentEventStillOwnsWindow=false`, so advancing the event queue demonstrably does **not** solve the remaining lifetime problem. That neutral-event workaround is removed. The earlier graph also showed the closed MainWindow directly retained in an autorelease pool while the async XCTest was running; the sole original autorelease call site was not established. Synchronous harness navigation/diagnostics/polling remain inside scoped pools as normal lifetime hygiene. + +The app P5 method is now deliberately limited to **one** real failed navigation (`tab_in_context=false`, matching controller, `bg_view_creations=2`) after two healthy/idle cycles and actual shared-pin window closure, followed by healthy regular/new-tab controls. It no longer attempts the second four-second timeout that reaches the app's eight-second DEBUG window guard before XCTest can finish. The guard is not disabled, no controller/tab detach is fabricated, and no claim is made that app-hosted persistent P5/stuck passed. The separate source-linked SPM P5 tests retain the existing two-failure/stuck proof. A new app run is still required for the narrowed method. diff --git a/work/projects/cpm-web-extension-code-guide-2026-10-09.md b/work/projects/cpm-web-extension-code-guide-2026-10-09.md index 4c996664..22f9e4d1 100755 --- a/work/projects/cpm-web-extension-code-guide-2026-10-09.md +++ b/work/projects/cpm-web-extension-code-guide-2026-10-09.md @@ -25,7 +25,7 @@ tags: | `alex/cpm-messaging-readiness-telemetry` | та же; `619869ee84c6` | PR0 #7376: readiness/failure/recovery параметры, CI без failure/pending, review required | | `cpm-readiness-baseline` | `alex/cpm-readiness-baseline`; `99ecf8b12787` | #7384 поверх PR0: baseline readiness; Danger=FAILURE | | `cpm-init-progress-native` | `alex/cpm-init-progress-native`; `46f25175c7c4` | #7385 поверх baseline: `init_stage`, 11 CPMInitProgress unit tests; Danger=FAILURE. Нужен JS privacy-extension#3727 | -| `cpm-e2e-init` | `scratch/cpm-e2e-init`; `46f25175c7c4` | Scratch harness поверх native init-progress: 3 `CPMReproInitProgressE2ETests` и базовые suites; наличие HEAD, совпадающего с #7385, не означает наличие scratch файлов в PR | +| `cpm-e2e-init` | `scratch/cpm-e2e-init`; `46f25175c7c4` (HEAD сохранён, без новых commits) | Прежний scratch native init-progress/SPM harness плюс новые **20 app-hosted XCTest methods** в `macOS/IntegrationTests/CPM/` и схема `CPM Integration Tests`; результаты и ограничения — §13 status. Наличие HEAD, совпадающего с #7385, не означает наличие untracked suites в PR | | `alex/cpm-web-extension-ready-handshake` | та же; `a0717cf098cd` | Старый объединённый локальный A/B harness и slow-wake-with-fixes; архив сравнения. Текущие PR A/B нарезаны в worktree выше | | `cpm-stable-base-url` | `alex/cpm-stable-base-url`; `570c2f8ef479` | Старый M2 experiment: меняет baseURL всем extensions, не доведён и не прогнан через нужный integration harness. Прежнее «production-ready» в старых планах не является актуальным итогом | @@ -193,3 +193,24 @@ Environment P5/P6: macOS 26.7.1 (25G241), Xcode 27.1 (27A9275), embedded bundle - `SP/Loading/WebExtensionLoader.swift:56`, `:93`, `:134`, `:154`, `:158-165` — в `makeContext` выставляется `context.baseURL = webkit-extension:///`; если из идентификатора не собрать URL — ошибка `invalidIdentifier`. - `TP/WebExtensionLoaderDelegateTests.swift:61-94` — 2 теста: URL выставлен до загрузки; неверный идентификатор → загрузка не начинается. - Открыто: сейчас меняет URL **всем** extension (нужно — только встроенным без `web_accessible_resources`); не прогнан через harness (M4, краш Network-процесса, обновление); старая база. + + +## 5. App-hosted CPM integration tests — 16 октября 2026 + +Worktree `/Users/admin/DuckDuckGo/apple-browsers.git/cpm-e2e-init`, branch `scratch/cpm-e2e-init`, HEAD `46f25175c7c42766cab23ea39f447f075c7bdd24`, **без commits**. Новая схема `macOS/DuckDuckGo-macOS.xcodeproj/xcshareddata/xcschemes/CPM Integration Tests.xcscheme` выбирает только две CPM classes, отключает parallel testing и включает `CPM_APP_INTEGRATION=1`. В ней нет Review-profile wipe/pre-action или `killall tests-server`. + +| Файл в `macOS/IntegrationTests/CPM/` | Роль | +|---|---| +| `CPMAppIntegrationTests.swift` | 10 deterministic baseline/diagnostics/scope/recovery tests: slow HTTP/native, одна навигация, одна таба, несколько табов одного окна, все окна, M4, dashboard transport, proxy flag | +| `CPMAppKnownFailureIntegrationTests.swift` | 10 characterization methods: actual AppDelegate flags, shared-pin window closure, Network/background crashes, first install, slow idle wake, frozen WebKit load timeout, 20k persistent-cache reload | +| `CPMAppIntegrationHarness.swift` | Реальные AppDelegate/WindowsManager/MainWindowController/Tab, production navigation/monitor/recorder, JSON attachments, owned windows/data stores, bounded cleanup | +| `CPMAppIntegrationSupport.swift` | Реальный macOS native handler/provider/delegate с fault boundary; recorder transport before daily dedup; extraction через production storage; in-memory installation store; test-only PID/background SPI | +| `CPMAppIntegrationBridge.swift` | Instrumentation только распакованной временной extension copy: page initResp mark, реальные runtime messages и scoped drop/release controls | +| `CPMAppFixtureServer.swift` | Owned HTTP loopback, eight-second resource delay, cacheable 2KiB resources with unique URLs | +| `README.md` | Повторение, signing, flags, все сценарии, ограничения причинной интерпретации | + +Все 6 Swift files включены в **Integration Tests и Integration Tests App Store**. Минимальные production seams: optional manager `controllerConfiguration` с прежним default; DEBUG AppDelegate factory с двумя guards; отдельный ConfigurationStore directory для CPM test host; разрешён только loopback HTTP в opted-in integration Tab; macOS diagnostics flag adapter доступен через `@testable` без изменения поведения. SecureVault/AppMain bypass отсутствует. Существующие dirty ZIP/SPM files сохранены. + +Запускать с **project signing defaults**, как в Xcode; unsigned override оказался ошибкой bootstrap и удалён. CLI run recipe находится в README. Для реального 30s WebKit timeout нужен test-host env `CPM_APP_INTEGRATION_EXPENSIVE=1`; для persistent cache — `CPM_APP_INTEGRATION_CACHE=1`, при необходимости `CPM_APP_INTEGRATION_CACHE_ENTRIES`, execution allowance 2400 s. Cache case лучше выбирать отдельно; этот opt-in включает fresh persistent UUID configuration в harness. Обычные запуски используют nonpersistent stores. + +Артефакты `/private/tmp/cpm-app-integration-20261015/`: signed `.xcresult`, logs, exported JSON, `app-test-results.json` (история результатов и hashes исходников). **Финальные результаты сверять с §13 [[cpm-status-2026-10-15]], не считать каждый characterization test доказательством воспроизведения причины.** P3 может пройти с отрицательным outcome; background crash может самоизлечиться. App P5 ограничен одной потерянной навигацией и контролями: более длинная попытка прерывалась DEBUG guard закрытого окна в XCTest. Persistent P5/stuck доказан отдельно SPM, что не превращает app attempt в green. iOS/device-only причины и естественная потеря listener metadata этим suite не доказаны.