docs: publish untraced scheduling and native lifetime controls

This commit is contained in:
zsviczian committed 2026-10-30 13:21:54 +01:00
1 parent ab1ef6da42
commit fd32ac682e
14 files changed
+1977 -17

No files matched your search

+17
View File
@@ -3352,3 +3352,20 @@ remain strict pending maintainer classification; no production changes.
bounded untraced scheduling true/false comparison with verified visibility;
time-extension permission pending. Keep PRs draft until resolved and two fresh
complete matching-build repeats pass. Physical-device limits remain unchanged.
- 2026-10-30 (#3022 untraced follow-up): Verified the minimal iframe ownership
mechanism under normal and unthrottled scheduling in both orders (0/62/0,
0/62/0, 0/62/0, 0/61/0), with actual visible/focused state and quiet own-observer
cleanup. Host-only visible/hidden close controls are quiet. Fresh matching
three-repository builds pass the ordered 172 desktop + five lifecycle + six
saved/dirty close controls, 2,000-element saved/dirty/pending-save closes, all
40 profiles and both 43-case mobile workflows, then desktop/lifecycle/Lucide
replay (two settling events). Retained the first ignored wrapper's missing-
status failure; no assertions weakened. Portable passes 666 (68 new / 598
reused), production audit passes, installed baseline restored. No production,
printing or maintained test-source change and no complete native acceptance
retry. The original observer remains unidentified. Automatic approval review
rejected renewed interception after the original exception expired; no command
executed and no bypass attempted. Explicit approval for the full desktop/core
diagnostic trace is pending. Next risk check is that ownership trace if
authorized, then two fresh full repeats only after an evidenced resolution.
+50 -1
View File
@@ -1,6 +1,6 @@
# Test findings for maintainer review
**Current evidence: F29 and the [2026-10-30 acceptance report](testing-evidence/3022/README.md).**
**Current evidence: F30 and the [2026-10-30 acceptance report](testing-evidence/3022/README.md).**
Earlier findings retain their original hosts and failed attempts as history.
The required native pair remains incomplete; all three PRs stay draft.
@@ -634,3 +634,52 @@ remain failures. The diagnostic cap is over; a bounded untraced follow-up is
proposed, with permission pending. Source archives, full observer records, raw
controls, matching artifacts and removal/recovery proofs are
[accessible together](testing-evidence/3022/observer-diagnostic-2026-10-30.json).
## F30 - Scheduling comparison complete; original observer still unidentified
The maintainer authorized continuation without further time-extension questions.
This follow-up uses native observer constructors and methods throughout, with
no interception. Under verified visible/focused conditions, normal scheduling
produces 0/62/0 iframe notifications (none/main/owner constructor); unthrottled
scheduling also produces 0/62/0. Reverse-order repetitions produce 0/62/0 and
0/61/0. Only the test-owned observer is disconnected; all next-second samples
are quiet and original scheduling is restored. The smaller mechanism does not
require the tooling's throttling override. This does not identify the original
suite observer or establish a five-second failure from one-second samples.
Fresh automatic build/deploy/hash/configuration at plugin `ab1ef6da`, fork
`053a3b9`, Extras `1cdcb7c` matches all frozen artifacts. The 172-case desktop
prefix, original lifecycle and six saved/dirty close controls pass all 183 child
cases with zero notifications. Saved/dirty 2,000-element closes pass. All 40
profiles plus both 43-case phone/tablet workflows pass, followed by another
desktop/lifecycle/Lucide replay with two settling notifications and passing
restoration. A real pending save during a 2,000-element popout close hands off
persistence successfully, reaches disk and retires its API/root without errors.
The host-only resize/close timing controls and hidden-popout close are quiet for
5.5 seconds with both plugins unloaded and no added observers.
The first isolated close probe omitted its parent result status. All six child
assertions passed, but the parent correctly failed; that failed evidence is
preserved. The ignored wrapper was corrected before the distinct ordered probe.
No maintained test assertions or production behavior changed. These are
diagnostic occurrences, not new canonical coverage or complete native repeats.
Passive evidence confirms the fresh lifecycle popout is visible/focused before
closing. The real pending-save probe observes a main-realm ToolsPanel observer
and an API/root still present at the first closed-window check, but no notifications. These
observations alone do not justify a constructor or lifecycle production change.
Fresh portable validation passes 666 (68 new / 598 reused), with all source,
package, build and declaration gates; production audit passes. The installed
vault is restored, quiet and usable, with no tasks, print roots or popouts.
The original sustained failure remains unresolved. Renewing the earlier
forwarding-only trace over the full desktop/core sequence was rejected before
execution by automatic approval review: the original exception expired and the
later authorization specified untraced controls. No trace was installed or
rejection bypassed. Explicit trace approval is pending. No full acceptance
retry, production/PDF change, exception exclusion, timeout increase or diagnostic
renderer reset was used in this continuation. Required mobile-mode changes and
restoration reload Obsidian through its normal emulation command. Keep all PRs draft and retain the required
two fresh matching-build complete passes. [Sanitized case evidence and source
archives](testing-evidence/3022/observer-scheduling-followup-2026-10-30.json)
include failed-wrapper evidence, raw notifications and exact artifact hashes.
+105 -11
View File
@@ -3,8 +3,9 @@
At plugin `9b2874ba`, two fresh complete matching-build runs produced **357/357
passes**, then **350/357 passes with seven failures**. Both execute all **258
behavioral obligations** and **40 device/layout profiles**. No identity is missing.
The required pair has not passed. At the subsequent test-diagnostic checkpoint
`f5d5d217`, focused investigations and portable checks pass where noted below;
The required pair has not passed. At the subsequent documentation checkpoint
`ab1ef6da` (maintained test code unchanged from `f5d5d217`), fresh focused native
and portable checks pass where noted below;
**two fresh complete native passes remain required** after resolution.
No production behavior changed after reviewed `f240fb86`. The PDF timeout and
@@ -24,6 +25,8 @@ concurrency-lock rollback and all previously approved fixes are preserved.
([JSON download](https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/refs/heads/2026-10-28-automated-test-coverage/docs/testing-evidence/3022/observer-diagnostic-2026-10-30.json))
- [Complete sanitized observer records](approved-observer-trace-records-2026-10-30.json)
([JSON download](https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/refs/heads/2026-10-28-automated-test-coverage/docs/testing-evidence/3022/approved-observer-trace-records-2026-10-30.json))
- [Scheduling comparison, subsequent native controls and fresh portable results](observer-scheduling-followup-2026-10-30.json)
([JSON download](https://raw.githubusercontent.com/zsviczian/obsidian-excalidraw-plugin/refs/heads/2026-10-28-automated-test-coverage/docs/testing-evidence/3022/observer-scheduling-followup-2026-10-30.json))
- [Earlier failed attempts and controls](acceptance-investigation-2026-10-29.json),
[9c08d814](acceptance-failed-9c08d814.json) and
[098e6ee1](acceptance-failed-098e6ee1.json) remain retained.
@@ -38,7 +41,7 @@ current finite-paging capture is complete.
| Check | Result |
| --- | --- |
| Final portable at `f5d5d217` | **666 passed: 68 new / 598 reused**, plus source/package gates |
| Fresh portable at `ab1ef6da` | **666 passed: 68 new / 598 reused**, plus source/package gates; maintained test code unchanged from `f5d5d217` |
| Plugin fast | 488 passed: 54 new / 434 reused |
| Fork source / browser | 127 passed (12 new / 115 reused) / 18 reused passes |
| Extras source / browser | 29 passed (2 new / 27 reused) / four reused passes |
@@ -157,14 +160,10 @@ point is not an evidenced fix. An earlier multi-arm trial was contaminated after
a loop and is explicitly not independent; another aborted before returning JSON
and has no invented counts. Guarded recovery/readiness failures are retained.
**Limits and next decision:** all small controls temporarily disabled background
throttling, matching the native tooling, and restored it. Normal-versus-unthrottled
scheduling under verified visible conditions was not compared before the cap.
The traced original workflow did not fail, so its exact responsible observer is
still unproven. No sole host/browser causation, harmlessness or production fix is
inferred. A 15-minute untraced scheduling comparison is proposed; permission is
pending because the approved diagnostic window has ended. No additional full
acceptance run should precede that distinction and an evidenced resolution.
**Limit at that checkpoint:** all small controls temporarily disabled background
throttling, matching the native tooling, and restored it. Scheduling had not yet
been compared before the cap. The untraced follow-up below completes that
comparison; the original workflow's responsible observer remains unproven.
The [complete bounded control](iframe-ownership-control-source.txt),
[guarded vault/session runner](guarded-native-probe-source.txt),
@@ -176,6 +175,101 @@ deadline is expired. Any fresh interception requires new authorization; the
untraced control does not replace ResizeObserver or alter production observers.
Reports include source/artifact hashes, raw notifications and recovery records.
## Untraced scheduling and native follow-up
The maintainer authorized continued work without further time-extension
confirmations. No observer interception was used in this follow-up. The
[complete sanitized results](observer-scheduling-followup-2026-10-30.json) retain
case results, source/artifact identities, raw notifications, native window state,
restoration and the fresh 666-case portable report.
With both plugins unloaded, the iframe control ran with normal and unthrottled
scheduling, then repeated in reverse order. Every arm verified actual document
visibility, focus and native window visibility/focus; original scheduling was
restored in `finally`.
| Scheduling | None / main-constructor / iframe-constructor notifications in one second |
| --- | --- |
| Normal, first | 0 / 62 / 0 |
| Unthrottled, first | 0 / 62 / 0 |
| Unthrottled, repeated | 0 / 62 / 0 |
| Normal, repeated | 0 / 61 / 0 |
Every next-second sample after disconnecting only the test-owned observer is
quiet. Unthrottled scheduling is not required for this smaller mechanism. These
one-second samples still do not establish the original five-second gate failure.
| Native workflow at clean plugin `ab1ef6da`, fork `053a3b9`, Extras `1cdcb7c` | Result |
| --- | --- |
| Host-only open/resize/close, both plugins unloaded, no added observers | Quiet for 5.5 seconds with immediate, 50 ms and 500 ms close timing |
| Host-only hide then close | Verified hidden popout; quiet for 5.5 seconds |
| Six isolated saved/dirty drawing closes | All child assertions pass; initial parent fails because the ignored wrapper omitted its result status; failed evidence preserved |
| 172 desktop behaviors, original five lifecycle cases, then corrected six close controls | All 183 child cases pass; zero notifications; cleanup/restoration pass |
| Saved and dirty 2,000-element drawing closes | Both pass; zero notifications; disk persistence and retired APIs verified |
| All 40 device profiles plus 43 phone and 43 tablet behaviors | All 126 pass; zero captured profile notifications; restoration passes |
| Subsequent 172 desktop behaviors, original lifecycle and Lucide | Pass; two transient notifications settle; cleanup/restoration pass |
| 2,000-element popout close with a real save already pending | Pass; immutable persistence handoff reaches disk, API/root retire, zero notifications |
The passive lifecycle snapshot verifies that the fresh popout is visible,
focused, non-minimized and fully loaded before closing. The pending-save control
also observes a main-realm ToolsPanel observer and an API/root still present at
the first closed-window check, followed by successful retirement without errors.
Neither constructor mismatch nor asynchronous retirement alone is therefore
established as the historical storm's cause. No production fix is inferred.
All automatic coordinator runs freshly build, deploy/configure and hash-check
the three workspace revisions; their artifact bytes match the earlier frozen
pair. The initial small scheduling controls reuse the already installed frozen
build and earn no acceptance credit. Diagnostic repeats create **zero new
canonical cases**. The four desktop behavioral CLI cases use registered native
commands; the two mobile CLI cases use public `EA.executeCLI`. The two additional
desktop CLI core cases were not rerun in these focused profiles.
Portable validation freshly passes **666 cases (68 new / 598 reused)** at these
revisions, plus source/package gates, builds and declarations. Production audit
passes; no maintained test source or production/PDF code changed in this
continuation. The original long storm remains unresolved and no complete native
357-case acceptance run was spent. All three PRs remain draft.
The proposed next diagnostic is the unchanged forwarding-only observer trace
over the full desktop/core sequence, which includes workflows omitted from the
smaller controls. **Automatic approval review rejected restarting it** because
the original trace exception expired and the subsequent permission covered
untraced controls. That command did not execute; no new trace was installed or
workaround attempted. Explicit authorization for a renewed trace is pending.
Current native constructors/methods, quiet baseline, installed plugins and
cleanup are verified. No further UI input is running.
Inert control sources are archived alongside the evidence:
[scheduling](observer-scheduling-control-source.txt),
[host resize](observer-host-resize-control-source.txt),
[drawing close](observer-drawing-close-control-source.txt),
[scenario loader](observer-close-loader-source.txt),
[passive window state](observer-passive-close-state-source.txt),
[large drawing](observer-large-close-control-source.txt),
[pending save](observer-inflight-close-control-source.txt), and
[hidden host window](observer-hidden-host-control-source.txt).
To repeat the device-predecessor/desktop comparison from the plugin checkout,
with the same one-time vault prerequisites and exclusive foreground access:
```powershell
New-Item -ItemType Directory -Force tmp | Out-Null
Copy-Item -LiteralPath docs/testing-evidence/3022/observer-passive-close-state-source.txt -Destination tmp/pr3022-passive-close-state-loader.mjs
$env:EXCALIDRAW_TEST_REPORT_DIR = Join-Path $PWD '.test-work/reports/unique-device-predecessor'
npm.cmd run verify:obsidian -- --profile=devices
$env:EXCALIDRAW_TEST_STATE_EVIDENCE = '1'
$env:EXCALIDRAW_TEST_REPORT_DIR = Join-Path $PWD '.test-work/reports/unique-post-device-prefix'
node --import ./tmp/pr3022-passive-close-state-loader.mjs scripts/testing/host/verify.mjs --behavior-matrix --lifecycle --lucide
Remove-Item Env:EXCALIDRAW_TEST_STATE_EVIDENCE
```
The loader adds only the archived passive pre-close snapshot; it does not change
observer methods, readiness or assertions. Both commands rebuild, deploy and
verify the workspace artifacts automatically. Use fresh report names, keep the
revisions fixed, and retain a failed first command rather than interpreting a
later pass as its replacement. These focused profiles are not full acceptance.
## Remaining failure and focused evidence
The second complete attempt fails:
@@ -4,8 +4,8 @@
"files": [
{
"name": "acceptance-status.json",
"sha256": "13a9995c167a5b3837c9cee9eb64c536860335f4e51af79d0674141b7259835c",
"bytes": 34707
"sha256": "911fbab6d9e6572d18c9e84ac05f7a5128b838287f8e177a82adfa3a7de28bdc",
"bytes": 38292
},
{
"name": "acceptance-investigation-2026-10-30.json",
@@ -76,6 +76,51 @@
"name": "guarded-native-probe-source.txt",
"sha256": "c4a0237d0ea24da172d9927c5b4f5fe8a04b6cecc44b03a89ae36149e9a07bd2",
"bytes": 1251
},
{
"name": "observer-scheduling-followup-2026-10-30.json",
"sha256": "70810ac6db52a5add5814407baf551ba7f7ab3dc9ad4e41443bd5ece48444fc2",
"bytes": 2138399
},
{
"name": "observer-scheduling-control-source.txt",
"sha256": "4e4bad111179bd9f205fe52d241cb796599478218e45adc38c18fa98eae223a6",
"bytes": 4440
},
{
"name": "observer-host-resize-control-source.txt",
"sha256": "cbbe6643c2e7c896c7053b44721512810df5d4e328ef7ce85264dd4e6e66bc03",
"bytes": 2845
},
{
"name": "observer-drawing-close-control-source.txt",
"sha256": "0a08c25f1657a844fa4f6f48bd0f24b6897bccc8229f9ab450ad14c6f413d7ab",
"bytes": 4127
},
{
"name": "observer-close-loader-source.txt",
"sha256": "40ae55c81e85b2f45504dffd23e6dc72fbe3a5f57bfacf536293df818de29bb9",
"bytes": 641
},
{
"name": "observer-passive-close-state-source.txt",
"sha256": "7d638b33c4652a53f3fc157b9c13980ae2b37f2712ef3e0193199f10d19d8920",
"bytes": 1409
},
{
"name": "observer-large-close-control-source.txt",
"sha256": "4259ead1b27c74f944b28f9050868192c8599896acfddfe8faf82fc0c99f80f2",
"bytes": 4114
},
{
"name": "observer-inflight-close-control-source.txt",
"sha256": "1d7bda8c94f0a2efcdda1d32555831dad538c9811045f079ed1189126a6d8f0c",
"bytes": 4990
},
{
"name": "observer-hidden-host-control-source.txt",
"sha256": "7efb2d484481c54ec74fb0770a4c17c88c0cd75d6da0576c2f426337742b95df",
"bytes": 3072
}
]
}
@@ -49,7 +49,7 @@
"status": "passed",
"cases": 666,
"sources": {
"plugin": {"commit":"f5d5d217ac7779115b820377181a7ced8f1605a1","dirty":false,"diffHash":"4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945","lockfileHash":"6a52b4b078cb94835b4c9f11c025aaa132baafb7b0e885c8a91835e80c2cfb5c"},
"plugin": {"commit":"ab1ef6da4221a32e30e4c6b7fe96aa9a82e60997","dirty":false,"diffHash":"4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945","lockfileHash":"6a52b4b078cb94835b4c9f11c025aaa132baafb7b0e885c8a91835e80c2cfb5c"},
"fork": {"commit":"053a3b9f9e77917c457fce8ca9453d38b92a303b","dirty":false,"diffHash":"4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945","lockfileHash":"5c64a40db44edf20c89888704dd8c2fa073dbc833bdaa5f8a6d0cf162ecaa909"},
"extras": {"commit":"1cdcb7c425a9b80afdc7b39c88861143b4b85e58","dirty":false,"diffHash":"4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945","lockfileHash":"4773e2de84c7606e94b7eddf5a93957d418d1b0e1bd35091553b01b37d35f8ab"}
},
@@ -87,7 +87,8 @@
"The second repeat fails lucide-3019 and six early desktop profile idle gates after a 702-event storm. All text-history variants, all six stability cycles and all 15 popout drop variants pass in both complete attempts.",
"At traced checkpoint 84a30be0 the 172-desktop-plus-core sequence captures 16879 notifications. Its sustained loop first appears during native:lifecycle-new-popout-survivor; one earlier popout Markdown notification is transient. No JavaScript exceptions; all functional cases execute, but strict parent idle/cleanup-idle gates fail.",
"Isolated Lucide and lifecycle controls pass with zero events. Empty-popout observer controls with both community runtimes unloaded also pass. These clean controls do not exonerate the ordered drawing sequence or justify a production patch.",
"Next action: isolate the state retained between the desktop workflows and fresh-popout teardown, then propose a minimal production fix for approval only if evidence supports it. Do not rerun full acceptance without new evidence. Two fresh complete matching-build passes remain required after any implementation change."
"Next action: isolate the state retained between the desktop workflows and fresh-popout teardown, then propose a minimal production fix for approval only if evidence supports it. Do not rerun full acceptance without new evidence. Two fresh complete matching-build passes remain required after any implementation change.",
"At clean ab1ef6da the matched visible normal/unthrottled iframe control reproduces 0/62/0 under both scheduling conditions; an additional normal repeat records 0/61/0. This does not identify the historical observer. Ordered desktop/lifecycle/close controls, all 40 device profiles and both 43-case mobile workflows, post-device desktop/lifecycle/Lucide, large and pending-save closes pass. No complete acceptance repeat was attempted. The proposed full desktop/core ownership trace was rejected before execution by automatic approval review; explicit trace approval is pending."
],
"limitations": [
"Desktop emulation is not physical touch/WebView/stylus validation.",
@@ -125,6 +126,53 @@
{"mode":"main-constructor","notifications":62,"afterDisconnect":0},
{"mode":"owner-constructor","notifications":0,"afterDisconnect":0}
],
"nextAction": "Use the minimal untraced reproducer for matched normal/unthrottled scheduling controls with actual visible-state verification. Then determine which original observer has that lifecycle and whether a tooling correction or explicitly approved production/host fix is warranted. Do not spend full acceptance repeats until resolved."
"nextAction": "Renew the unchanged previously approved forwarding-only observer trace for the full desktop/core sequence, with a 30-minute safety deadline and no acceptance credit. Explicit renewed-trace approval is pending; no new interception was installed."
},
"latestVerifiedCheckpoint": {
"plugin": {
"commit": "ab1ef6da4221a32e30e4c6b7fe96aa9a82e60997",
"dirty": false,
"diffHash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
"lockfileHash": "6a52b4b078cb94835b4c9f11c025aaa132baafb7b0e885c8a91835e80c2cfb5c"
},
"fork": {
"commit": "053a3b9f9e77917c457fce8ca9453d38b92a303b",
"dirty": false,
"diffHash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
"lockfileHash": "5c64a40db44edf20c89888704dd8c2fa073dbc833bdaa5f8a6d0cf162ecaa909"
},
"extras": {
"commit": "1cdcb7c425a9b80afdc7b39c88861143b4b85e58",
"dirty": false,
"diffHash": "4f53cda18c2baa0c0354bb5f9a3ecbe5ed12ab4d8e11ba873c2f11161202b945",
"lockfileHash": "4773e2de84c7606e94b7eddf5a93957d418d1b0e1bd35091553b01b37d35f8ab"
},
"maintainedPluginTestCode": "f5d5d217ac7779115b820377181a7ced8f1605a1",
"productionUnchangedSince": "f240fb86"
},
"observerFollowup": {
"file": "observer-scheduling-followup-2026-10-30.json",
"status": "scheduling-comparison-complete-original-storm-unresolved",
"observerInterception": false,
"acceptanceCredit": false,
"scheduling": [
{"name":"normal-first","backgroundThrottling":true,"counts":[0,62,0],"afterDisconnect":[0,0,0]},
{"name":"unthrottled-first","backgroundThrottling":false,"counts":[0,62,0],"afterDisconnect":[0,0,0]},
{"name":"unthrottled-repeat","backgroundThrottling":false,"counts":[0,62,0],"afterDisconnect":[0,0,0]},
{"name":"normal-repeat","backgroundThrottling":true,"counts":[0,61,0],"afterDisconnect":[0,0,0]}
],
"nativeRuns": [
{"name":"2026-10-30-popout-close-order-ab1ef6da","status":"failed","tests":6,"events":0,"cleanup":"passed","restored":true},
{"name":"2026-10-30-ordered-popout-close-ab1ef6da","status":"passed","tests":183,"events":0,"cleanup":"passed","restored":true},
{"name":"2026-10-30-large-popout-close-ab1ef6da","status":"passed","tests":2,"events":0,"cleanup":"passed","restored":true},
{"name":"2026-10-30-device-predecessor-ab1ef6da","status":"passed","tests":0,"events":0,"deviceCases":126,"cleanup":"passed","restored":true},
{"name":"2026-10-30-post-device-prefix-ab1ef6da","status":"passed","tests":177,"events":2,"cleanup":"passed","restored":true},
{"name":"2026-10-30-inflight-popout-close-ab1ef6da","status":"passed","tests":2,"events":0,"cleanup":"passed","restored":true}
],
"nextDiagnostic": {
"status": "blocked-before-execution-pending-explicit-trace-approval",
"action": "Renew the unchanged previously approved forwarding-only observer trace for the full desktop/core sequence, with a 30-minute safety deadline and no acceptance credit.",
"approvalReview": "Automatic approval rejected renewing the expired trace: later permission covered untraced controls. The rejected command did not execute and no new observer interception was installed. Explicit authorization was requested; no workaround was attempted."
}
}
}
@@ -0,0 +1,3 @@
import {registerHooks} from 'node:module';
const moduleURL=new URL('./pr3022-popout-close-scenario.mjs',import.meta.url).href;
registerHooks({load(url,context,next){const result=next(url,context);if(!url.endsWith('/scripts/testing/host/verify.mjs'))return result;let source=String(result.source);const anchor='...(lifecycle ? [runLifecycleScenario] : []),';if(source.split(anchor).length!==2)throw Error('Diagnostic scenario anchor drift');source=`import {runPopoutCloseControl} from ${JSON.stringify(moduleURL)};\n`+source.replace(anchor,'...(lifecycle ? [runLifecycleScenario,runPopoutCloseControl] : []),');return {...result,source};}});
@@ -0,0 +1,31 @@
import {readFileSync} from 'node:fs';
import {runInAppTask} from '../scripts/testing/host/inAppTask.mjs';
export async function runPopoutCloseControl({cli,drawingPath}){
const fixture=readFileSync('tests/vault/Drawings/Uncompressed.excalidraw.md','utf8');
return {id:'diagnostic-popout-close-order',status:'passed',acceptanceCredit:false,...await runInAppTask({cli,execute:exercise,args:[drawingPath,fixture],timeoutMs:180000})};
}
async function exercise(c,drawingPath,fixture){
const doc=document,win=doc.defaultView,p=app.plugins.plugins['obsidian-excalidraw-plugin'],events=[],states=[],owned=new Set(),previous=app.workspace.activeLeaf,prefix=drawingPath.replace(/\.(excalidraw\.md|md)$/,'')+'_close_control';
const check=(ok,message)=>{if(!ok)throw Error(message);};
const listener=e=>events.push({at:Date.now(),phase:c.activeCase||c.phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});win.addEventListener('error',listener);
c.defer(()=>win.removeEventListener('error',listener));
c.defer(async()=>{for(const leaf of owned){const owner=leaf.view.containerEl.ownerDocument.defaultView;if(owner&&owner!==win&&!owner.closed){owner.close();await c.waitForCleanup(()=>owner.closed,'owned control popout close');}}if(previous?.containerEl.isConnected)app.workspace.setActiveLeaf(previous,{focus:true});const folder=app.vault.getFolderByPath(prefix);if(folder)await app.vault.delete(folder,true);});
check(String(win.ResizeObserver).includes('[native code]'),'Native observer constructor required');await app.vault.createFolder(prefix);
await new Promise(r=>win.setTimeout(r,500));check(!events.length,'Prior ordered workflow did not settle; do not contaminate close controls');
for(const [index,dirty] of [false,true,false,true,false,true].entries()){
await c.case('diagnostic:popout-close-'+index+'-'+(dirty?'dirty':'saved'),['P02','P03'],async()=>{
const start=events.length,file=await app.vault.create(prefix+'/Drawing-'+index+'.excalidraw.md',fixture);await c.waitFor(()=>p.isExcalidrawFile(file),'fixture metadata');
const leaf=app.workspace.openPopoutLeaf();owned.add(leaf);await c.waitFor(()=>leaf.view.containerEl.ownerDocument!==doc,'empty popout destination');await leaf.openFile(file);await c.waitFor(()=>leaf.view.excalidrawAPI&&leaf.view.isLoaded&&!leaf.view.excalidrawAPI.getAppState().isLoading&&!leaf.view.semaphores.justLoaded,'drawing first commit');
const view=leaf.view,owner=view.ownerWindow,api=view.excalidrawAPI,nw=owner.require('@electron/remote').getCurrentWindow();nw.show();nw.focus();app.workspace.setActiveLeaf(leaf,{focus:true});
const x=1200+index;api.updateScene({elements:api.getSceneElements().map((e,i)=>i?e:{...e,x,version:e.version+1,versionNonce:e.versionNonce+1}),captureUpdate:'IMMEDIATELY',forceFlushSync:true});await c.waitFor(()=>view.isDirty(),'dirty edit');
if(!dirty)check((await view.saveWithOutcome()).status==='persisted','saved control did not persist');
const before={at:Date.now(),dirty:view.isDirty(),ownerIsMain:owner===win,api:!!view.excalidrawAPI,root:!!view.excalidrawRoot,visibility:owner.document.visibilityState};
owner.close();await c.waitFor(()=>owner.closed,'popout closed');const closed={at:Date.now(),api:!!view.excalidrawAPI,root:!!view.excalidrawRoot};await c.waitFor(()=>!view.excalidrawAPI,'closed editor API retired');
await c.waitFor(async()=>{const scene=await p.ea.getSceneFromFile(file);return scene.elements[0].x===x;},'closed drawing physically saved');
await new Promise(r=>win.setTimeout(r,5500));const after={at:Date.now(),newEvents:events.length-start,popouts:app.workspace.floatingSplit.children.length,api:!!view.excalidrawAPI};states.push({index,dirty,before,closed,after});owned.delete(leaf);
check(events.length===start,'Native close notifications/exceptions: '+JSON.stringify({states,events}));
return {dirty,before,closed,after,assertions:['real editor created in popout','scene edit saved on disk','closed API retired','no browser notifications or exceptions for 5.5 seconds']};
});
}
return {tests:c.tests,events,states,acceptanceCredit:false};
}
@@ -0,0 +1,16 @@
(async()=>{
const delay=500,doc=document,win=doc.defaultView,ids=['obsidian-excalidraw-plugin','excalidraw-extras'],remote=require('@electron/remote'),wc=remote.getCurrentWebContents(),events=[],states=[];let phase='baseline',leaf,pw,error;
const sleep=ms=>new Promise(r=>win.setTimeout(r,ms));const wait=async(fn,label)=>{const end=Date.now()+5000;while(!fn()){if(Date.now()>end)throw Error(label);await sleep(25);}};
const listener=e=>events.push({at:Date.now(),phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});win.addEventListener('error',listener);
try{
if(!String(win.ResizeObserver).includes('[native code]'))throw Error('Native observers required');
if(app.workspace.floatingSplit.children.length||app.workspace.getLeavesOfType('excalidraw').length)throw Error('Baseline not restored');
for(const id of ids)await app.plugins.disablePlugin(id);await sleep(500);if(events.length)throw Error('Baseline not quiet');
phase='open';leaf=app.workspace.openPopoutLeaf();await wait(()=>leaf.view.containerEl.ownerDocument!==doc,'Popout destination');pw=leaf.view.containerEl.ownerDocument.defaultView;
await wait(()=>pw.require&&pw.require('@electron/remote').getCurrentWindow(),'Native popout ready');const nw=pw.require('@electron/remote').getCurrentWindow();nw.show();nw.focus();await wait(()=>pw.document.visibilityState==='visible','Visible popout');await sleep(500);
states.push({at:Date.now(),phase,pluginsLoaded:ids.map(id=>!!app.plugins.plugins[id]),mainBackgroundThrottling:wc.getBackgroundThrottling(),popoutBackgroundThrottling:pw.require('@electron/remote').getCurrentWebContents().getBackgroundThrottling(),tabClasses:leaf.parent.tabsContainerEl.className,tabOwnerIsPopout:leaf.parent.tabsContainerEl.ownerDocument===pw.document});
phase='resize';const [width,height]=nw.getSize();nw.setSize(width+47,height+31);await sleep(delay);
phase='hide';nw.hide();await wait(()=>pw.document.visibilityState==='hidden','Hidden native popout');states.push({at:Date.now(),phase,visibility:pw.document.visibilityState,nativeVisible:nw.isVisible(),nativeFocused:nw.isFocused()});phase='close';const closedAt=Date.now();pw.close();await wait(()=>pw.closed,'Popout close');await sleep(5500);states.push({phase,closedAt,completed:Date.now(),afterClose:events.filter(e=>e.at>=closedAt).length,popouts:app.workspace.floatingSplit.children.length});
}catch(e){error=String(e.stack||e);}finally{if(pw&&!pw.closed){pw.close();await wait(()=>pw.closed,'Cleanup popout');}for(const id of ids)if(!app.plugins.plugins[id])await app.plugins.enablePlugin(id);await wait(()=>app.plugins.plugins[ids[0]]?.isReady&&app.plugins.plugins[ids[1]]?.api,'Restore plugins');win.removeEventListener('error',listener);}
return JSON.stringify({delay,error,states,events,acceptanceCredit:false,addedObservers:0,observerInterception:false,productionObserversModified:false,cleanup:{popouts:app.workspace.floatingSplit.children.length,pluginReady:app.plugins.plugins[ids[0]]?.isReady,extrasReady:!!app.plugins.plugins[ids[1]]?.api}});
})()
@@ -0,0 +1,16 @@
(async()=>{
const delay=__DELAY__,doc=document,win=doc.defaultView,ids=['obsidian-excalidraw-plugin','excalidraw-extras'],remote=require('@electron/remote'),wc=remote.getCurrentWebContents(),events=[],states=[];let phase='baseline',leaf,pw,error;
const sleep=ms=>new Promise(r=>win.setTimeout(r,ms));const wait=async(fn,label)=>{const end=Date.now()+5000;while(!fn()){if(Date.now()>end)throw Error(label);await sleep(25);}};
const listener=e=>events.push({at:Date.now(),phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});win.addEventListener('error',listener);
try{
if(!String(win.ResizeObserver).includes('[native code]'))throw Error('Native observers required');
if(app.workspace.floatingSplit.children.length||app.workspace.getLeavesOfType('excalidraw').length)throw Error('Baseline not restored');
for(const id of ids)await app.plugins.disablePlugin(id);await sleep(500);if(events.length)throw Error('Baseline not quiet');
phase='open';leaf=app.workspace.openPopoutLeaf();await wait(()=>leaf.view.containerEl.ownerDocument!==doc,'Popout destination');pw=leaf.view.containerEl.ownerDocument.defaultView;
await wait(()=>pw.require&&pw.require('@electron/remote').getCurrentWindow(),'Native popout ready');const nw=pw.require('@electron/remote').getCurrentWindow();nw.show();nw.focus();await wait(()=>pw.document.visibilityState==='visible','Visible popout');await sleep(500);
states.push({at:Date.now(),phase,pluginsLoaded:ids.map(id=>!!app.plugins.plugins[id]),mainBackgroundThrottling:wc.getBackgroundThrottling(),popoutBackgroundThrottling:pw.require('@electron/remote').getCurrentWebContents().getBackgroundThrottling(),tabClasses:leaf.parent.tabsContainerEl.className,tabOwnerIsPopout:leaf.parent.tabsContainerEl.ownerDocument===pw.document});
phase='resize';const [width,height]=nw.getSize();nw.setSize(width+47,height+31);await sleep(delay);
phase='close';const closedAt=Date.now();pw.close();await wait(()=>pw.closed,'Popout close');await sleep(5500);states.push({phase,closedAt,completed:Date.now(),afterClose:events.filter(e=>e.at>=closedAt).length,popouts:app.workspace.floatingSplit.children.length});
}catch(e){error=String(e.stack||e);}finally{if(pw&&!pw.closed){pw.close();await wait(()=>pw.closed,'Cleanup popout');}for(const id of ids)if(!app.plugins.plugins[id])await app.plugins.enablePlugin(id);await wait(()=>app.plugins.plugins[ids[0]]?.isReady&&app.plugins.plugins[ids[1]]?.api,'Restore plugins');win.removeEventListener('error',listener);}
return JSON.stringify({delay,error,states,events,acceptanceCredit:false,addedObservers:0,observerInterception:false,productionObserversModified:false,cleanup:{popouts:app.workspace.floatingSplit.children.length,pluginReady:app.plugins.plugins[ids[0]]?.isReady,extrasReady:!!app.plugins.plugins[ids[1]]?.api}});
})()
@@ -0,0 +1,32 @@
import {stabilityFixture} from '../scripts/testing/host/stability.mjs';
import {runInAppTask} from '../scripts/testing/host/inAppTask.mjs';
export async function runInflightPopoutCloseControl({cli,drawingPath}){
const fixture=stabilityFixture(2000);
return {id:'diagnostic-inflight-popout-close-order',status:'passed',acceptanceCredit:false,...await runInAppTask({cli,execute:exercise,args:[drawingPath,fixture],timeoutMs:180000})};
}
async function exercise(c,drawingPath,fixture){
const doc=document,win=doc.defaultView,p=app.plugins.plugins['obsidian-excalidraw-plugin'],events=[],states=[],owned=new Set(),previous=app.workspace.activeLeaf,prefix=drawingPath.replace(/\.(excalidraw\.md|md)$/,'')+'_inflight_close_control';
let saveHandle;const check=(ok,message)=>{if(!ok)throw Error(message);};
const listener=e=>events.push({at:Date.now(),phase:c.activeCase||c.phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});win.addEventListener('error',listener);
c.defer(()=>win.removeEventListener('error',listener));
c.defer(async()=>{for(const leaf of owned){const owner=leaf.view.containerEl.ownerDocument.defaultView;if(owner&&owner!==win&&!owner.closed){owner.close();await c.waitForCleanup(()=>owner.closed,'owned control popout close');}}if(previous?.containerEl.isConnected)app.workspace.setActiveLeaf(previous,{focus:true});if(saveHandle&&!saveHandle.settled)await c.waitForCleanup(()=>saveHandle.settled,'pending real save before fixture removal');const folder=app.vault.getFolderByPath(prefix);if(folder)await app.vault.delete(folder,true);});
check(String(win.ResizeObserver).includes('[native code]'),'Native observer constructor required');await app.vault.createFolder(prefix);
await new Promise(r=>win.setTimeout(r,500));check(!events.length,'Prior ordered workflow did not settle; do not contaminate close controls');
for(const [index,dirty] of [false,true].entries()){
await c.case('diagnostic:inflight-popout-close-'+index+'-'+(dirty?'dirty':'saved'),['P02','P03'],async()=>{
const start=events.length,file=await app.vault.create(prefix+'/Drawing-'+index+'.excalidraw.md',fixture);await c.waitFor(()=>p.isExcalidrawFile(file),'fixture metadata');
const leaf=app.workspace.openPopoutLeaf();owned.add(leaf);await c.waitFor(()=>leaf.view.containerEl.ownerDocument!==doc,'empty popout destination');await leaf.openFile(file);await c.waitFor(()=>leaf.view.excalidrawAPI&&leaf.view.isLoaded&&!leaf.view.excalidrawAPI.getAppState().isLoading&&!leaf.view.semaphores.justLoaded,'drawing first commit');
const view=leaf.view,owner=view.ownerWindow,api=view.excalidrawAPI,nw=owner.require('@electron/remote').getCurrentWindow();nw.show();nw.focus();app.workspace.setActiveLeaf(leaf,{focus:true});
const x=1200+index;api.updateScene({elements:api.getSceneElements().map((e,i)=>i?e:{...e,x,version:e.version+1,versionNonce:e.versionNonce+1}),captureUpdate:'IMMEDIATELY',forceFlushSync:true});await c.waitFor(()=>view.isDirty(),'dirty edit');
if(!dirty)check((await view.saveWithOutcome()).status==='persisted','saved control did not persist');
if(dirty){saveHandle={settled:false};Promise.resolve(view.saveWithOutcome()).then(outcome=>{saveHandle.outcome=outcome;saveHandle.settled=true;},error=>{saveHandle.error=String(error.stack||error);saveHandle.settled=true;});}
const before={at:Date.now(),dirty:view.isDirty(),busy:view.isPersistenceBusy(),pendingSave:saveHandle?{settled:saveHandle.settled}:null,toolsObserverIsMain:view.toolsPanelRef?.current?.props?.observer?.deref()?Object.getPrototypeOf(view.toolsPanelRef.current.props.observer.deref())===win.ResizeObserver.prototype:null,ownerIsMain:owner===win,api:!!view.excalidrawAPI,root:!!view.excalidrawRoot,visibility:owner.document.visibilityState};
owner.close();await c.waitFor(()=>owner.closed,'popout closed');const closed={at:Date.now(),api:!!view.excalidrawAPI,root:!!view.excalidrawRoot};await c.waitFor(()=>!view.excalidrawAPI,'closed editor API retired');
if(dirty){await c.waitFor(()=>saveHandle.settled,'pending real save completes');check(!saveHandle.error,'Pending real save rejected: '+saveHandle.error);states.push({phase:'save-outcome',outcome:saveHandle.outcome?.status});}await c.waitFor(async()=>{const scene=await p.ea.getSceneFromFile(file);return scene.elements[0].x===x;},'closed drawing physically saved');
await new Promise(r=>win.setTimeout(r,5500));const after={at:Date.now(),newEvents:events.length-start,popouts:app.workspace.floatingSplit.children.length,api:!!view.excalidrawAPI};states.push({index,dirty,before,closed,after});owned.delete(leaf);
check(events.length===start,'Native close notifications/exceptions: '+JSON.stringify({states,events}));
return {dirty,before,closed,after,assertions:['real editor created in popout','scene edit saved on disk','closed API retired','no browser notifications or exceptions for 5.5 seconds']};
});
}
return {tests:c.tests,events,states,acceptanceCredit:false};
}
@@ -0,0 +1,31 @@
import {stabilityFixture} from '../scripts/testing/host/stability.mjs';
import {runInAppTask} from '../scripts/testing/host/inAppTask.mjs';
export async function runLargePopoutCloseControl({cli,drawingPath}){
const fixture=stabilityFixture(2000);
return {id:'diagnostic-large-popout-close-order',status:'passed',acceptanceCredit:false,...await runInAppTask({cli,execute:exercise,args:[drawingPath,fixture],timeoutMs:180000})};
}
async function exercise(c,drawingPath,fixture){
const doc=document,win=doc.defaultView,p=app.plugins.plugins['obsidian-excalidraw-plugin'],events=[],states=[],owned=new Set(),previous=app.workspace.activeLeaf,prefix=drawingPath.replace(/\.(excalidraw\.md|md)$/,'')+'_large_close_control';
const check=(ok,message)=>{if(!ok)throw Error(message);};
const listener=e=>events.push({at:Date.now(),phase:c.activeCase||c.phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});win.addEventListener('error',listener);
c.defer(()=>win.removeEventListener('error',listener));
c.defer(async()=>{for(const leaf of owned){const owner=leaf.view.containerEl.ownerDocument.defaultView;if(owner&&owner!==win&&!owner.closed){owner.close();await c.waitForCleanup(()=>owner.closed,'owned control popout close');}}if(previous?.containerEl.isConnected)app.workspace.setActiveLeaf(previous,{focus:true});const folder=app.vault.getFolderByPath(prefix);if(folder)await app.vault.delete(folder,true);});
check(String(win.ResizeObserver).includes('[native code]'),'Native observer constructor required');await app.vault.createFolder(prefix);
await new Promise(r=>win.setTimeout(r,500));check(!events.length,'Prior ordered workflow did not settle; do not contaminate close controls');
for(const [index,dirty] of [false,true].entries()){
await c.case('diagnostic:large-popout-close-'+index+'-'+(dirty?'dirty':'saved'),['P02','P03'],async()=>{
const start=events.length,file=await app.vault.create(prefix+'/Drawing-'+index+'.excalidraw.md',fixture);await c.waitFor(()=>p.isExcalidrawFile(file),'fixture metadata');
const leaf=app.workspace.openPopoutLeaf();owned.add(leaf);await c.waitFor(()=>leaf.view.containerEl.ownerDocument!==doc,'empty popout destination');await leaf.openFile(file);await c.waitFor(()=>leaf.view.excalidrawAPI&&leaf.view.isLoaded&&!leaf.view.excalidrawAPI.getAppState().isLoading&&!leaf.view.semaphores.justLoaded,'drawing first commit');
const view=leaf.view,owner=view.ownerWindow,api=view.excalidrawAPI,nw=owner.require('@electron/remote').getCurrentWindow();nw.show();nw.focus();app.workspace.setActiveLeaf(leaf,{focus:true});
const x=1200+index;api.updateScene({elements:api.getSceneElements().map((e,i)=>i?e:{...e,x,version:e.version+1,versionNonce:e.versionNonce+1}),captureUpdate:'IMMEDIATELY',forceFlushSync:true});await c.waitFor(()=>view.isDirty(),'dirty edit');
if(!dirty)check((await view.saveWithOutcome()).status==='persisted','saved control did not persist');
const before={at:Date.now(),dirty:view.isDirty(),ownerIsMain:owner===win,api:!!view.excalidrawAPI,root:!!view.excalidrawRoot,visibility:owner.document.visibilityState};
owner.close();await c.waitFor(()=>owner.closed,'popout closed');const closed={at:Date.now(),api:!!view.excalidrawAPI,root:!!view.excalidrawRoot};await c.waitFor(()=>!view.excalidrawAPI,'closed editor API retired');
await c.waitFor(async()=>{const scene=await p.ea.getSceneFromFile(file);return scene.elements[0].x===x;},'closed drawing physically saved');
await new Promise(r=>win.setTimeout(r,5500));const after={at:Date.now(),newEvents:events.length-start,popouts:app.workspace.floatingSplit.children.length,api:!!view.excalidrawAPI};states.push({index,dirty,before,closed,after});owned.delete(leaf);
check(events.length===start,'Native close notifications/exceptions: '+JSON.stringify({states,events}));
return {dirty,before,closed,after,assertions:['real editor created in popout','scene edit saved on disk','closed API retired','no browser notifications or exceptions for 5.5 seconds']};
});
}
return {tests:c.tests,events,states,acceptanceCredit:false};
}
@@ -0,0 +1,6 @@
import {registerHooks} from 'node:module';
registerHooks({load(url,context,next){const result=next(url,context);if(!url.endsWith('/scripts/testing/host/lifecycle.mjs'))return result;let source=String(result.source);const anchor='const popWindow = popout.view.ownerWindow;';if(source.split(anchor).length!==2)throw Error('Passive close-state anchor drift');source=source.replace(anchor,anchor+`
const native=popWindow.require('@electron/remote').getCurrentWindow(),nativeContents=native.webContents;
const closeState={at:Date.now(),main:{visible:doc.visibilityState,focused:doc.hasFocus()},popout:{visibility:popWindow.document.visibilityState,focused:popWindow.document.hasFocus(),readyState:popWindow.document.readyState,nativeVisible:native.isVisible(),nativeFocused:native.isFocused(),minimized:native.isMinimized(),backgroundThrottling:nativeContents.getBackgroundThrottling(),paints:popWindow.performance.getEntriesByType('paint').map(e=>({name:e.name,startTime:e.startTime})),dirty:popout.view.isDirty(),api:!!popout.view.excalidrawAPI,root:!!popout.view.excalidrawRoot}};
(c.observations||=[]).push({phase:'before:fresh-popout-close',...closeState});`);
const final='return { tests: c.tests };';if(source.split(final).length!==2)throw Error('Passive return anchor drift');source=source.replace(final,'return { tests: c.tests, observations:c.observations };');return {...result,source};}});
@@ -0,0 +1,23 @@
(async()=>{
const throttled=__THROTTLED__,doc=document,win=doc.defaultView,remote=require('@electron/remote'),wc=remote.getCurrentWebContents(),nativeWindow=remote.getCurrentWindow(),originalBg=wc.getBackgroundThrottling(),ids=['obsidian-excalidraw-plugin','excalidraw-extras'],events=[],trials=[],visibility=[];let phase='baseline',observer,iframe,target,error;
const snapshot=label=>({label,at:Date.now(),visibility:doc.visibilityState,focused:doc.hasFocus(),windowVisible:nativeWindow.isVisible(),windowFocused:nativeWindow.isFocused(),minimized:nativeWindow.isMinimized(),backgroundThrottling:wc.getBackgroundThrottling()});
const listener=e=>events.push({at:Date.now(),phase,message:e.message,isTrusted:e.isTrusted,hasError:e.error!=null,stack:e.error?.stack});
const visibilityListener=()=>visibility.push(snapshot('visibilitychange'));win.addEventListener('error',listener);doc.addEventListener('visibilitychange',visibilityListener);
const sleep=ms=>new Promise(r=>win.setTimeout(r,ms));const wait=async(fn,label)=>{const until=Date.now()+3000;while(!fn()){if(Date.now()>until)throw Error(label);await sleep(25);}};
try{
if(globalThis.__pr3022ResizeTrace||!String(win.ResizeObserver).includes('[native code]')||!String(win.ResizeObserver.prototype.observe).includes('[native code]'))throw Error('Observer interception remains');
if(app.workspace.floatingSplit.children.length||app.workspace.getLeavesOfType('excalidraw').length)throw Error('Baseline contains drawing/popout');
nativeWindow.show();nativeWindow.focus();wc.focus();wc.setBackgroundThrottling(throttled);await wait(()=>doc.visibilityState==='visible'&&doc.hasFocus()&&!nativeWindow.isMinimized(),'Visible foreground required');
visibility.push(snapshot('before-disable'));for(const id of ids)await app.plugins.disablePlugin(id);await sleep(500);if(events.length)throw Error('Baseline not quiet');
for(const mode of ['none','main-constructor','owner-constructor']){
phase=mode;const start=events.length,deliveries=[],before=snapshot('before:'+mode);
if(before.visibility!=='visible'||!before.focused)throw Error('Foreground lost before trial');
target=createFragment().createDiv();target.setCssStyles({width:'121px',height:'81px'});iframe=createFragment().createEl('iframe');iframe.setCssStyles({position:'fixed',left:'1px',top:'1px',width:'200px',height:'200px'});doc.body.appendChild(iframe);await wait(()=>iframe.contentDocument?.body,'Frame body');const owner=iframe.contentWindow;iframe.contentDocument.body.appendChild(target);
if(mode!=='none'){const Ctor=mode==='main-constructor'?win.ResizeObserver:owner.ResizeObserver;observer=new Ctor(entries=>deliveries.push({at:Date.now(),sizes:entries.map(e=>({width:e.contentRect.width,height:e.contentRect.height,hasWindow:!!e.target.ownerDocument.defaultView}))}));observer.observe(target);await wait(()=>deliveries.length,'Initial delivery');target.setCssStyles({width:'123px'});await wait(()=>deliveries.some(d=>d.sizes.some(e=>e.width===123)),'Final live delivery');}
const removedAt=Date.now();iframe.remove();await sleep(1000);const sampledAt=Date.now(),during=events.length-start;phase=mode+':after-disconnect';observer?.disconnect();observer=null;await sleep(1000);const endedAt=Date.now(),afterDisconnect=events.length-start-during,after=snapshot('after:'+mode);
trials.push({mode,registeredAfterAdoption:true,removedAt,sampledAt,endedAt,during,afterDisconnect,before,after,deliveries,pluginsLoaded:ids.map(id=>!!app.plugins.plugins[id])});target.remove();target=null;iframe=null;
if(afterDisconnect>1)throw Error('Control did not settle');if(after.visibility!=='visible'||!after.focused)throw Error('Foreground lost during trial');
}
}catch(e){error=String(e.stack||e);}finally{observer?.disconnect();target?.remove();iframe?.remove();for(const id of ids)if(!app.plugins.plugins[id])await app.plugins.enablePlugin(id);await wait(()=>app.plugins.plugins[ids[0]]?.isReady&&app.plugins.plugins[ids[1]]?.api,'Restore plugins');wc.setBackgroundThrottling(originalBg);win.removeEventListener('error',listener);doc.removeEventListener('visibilitychange',visibilityListener);visibility.push(snapshot('restored'));}
return JSON.stringify({started:visibility[0]?.at,completed:Date.now(),error,throttled,originalBg,trials,events,visibility,acceptanceCredit:false,workspaceOrPopoutAPIsUsed:false,productionObserversModified:false,nativeObserver:String(win.ResizeObserver)});
})()
File diff suppressed because it is too large. Load diff