diff --git a/context/CONTEXT_2026-10-26_15-25-00_client-reliability-9-torrent.md b/context/CONTEXT_2026-10-26_15-25-00_client-reliability-9-torrent.md new file mode 100644 index 00000000..247ad3bd --- /dev/null +++ b/context/CONTEXT_2026-10-26_15-25-00_client-reliability-9-torrent.md @@ -0,0 +1,4 @@ +Goal: interpreter-authorized current-HEAD offline active torrent lifecycle investigation, no implementation. +Baseline HEAD e9af76df, real observer/grid/queue/probePeers, fake WebTorrent IO+clock. +Result: corrected12cases7pass5fail/naturalexit1; cleanup0remaining resources; existing lifecycle11/11 naturalexit0. See matching TEST_LOG. +Next: dispatch independent reproduction and explicit gridHealth/probePeers-only ownership plus spec correction before fixes/tests. QA owns browser; no full/build/submission. diff --git a/decisions/DECISIONS_2026-10-26_15-25-00_client-reliability-9-torrent.md b/decisions/DECISIONS_2026-10-26_15-25-00_client-reliability-9-torrent.md new file mode 100644 index 00000000..4047f7cd --- /dev/null +++ b/decisions/DECISIONS_2026-10-26_15-25-00_client-reliability-9-torrent.md @@ -0,0 +1,5 @@ +- Investigation uses actual production chain, fake only observer delivery/WebTorrent IO/timers/persistence; no implementation or committed tests. +- Preserve first12=5pass/7fail fixture: two control failures are JSDOM storage-event timers; separate memoryStorage IO fixture12=7pass/5fail retains identical assertions and original evidence. +- Treat five failures as planned Stage3 active-cancellation gap, not regression against existing intentional active-sharing/cache contracts. Need explicit routed spec correction before changing those tests. +- Smallest fix boundary gridHealth ownership/identity/cache plus probePeers lifecycle only. Preserve deferred temporary-torrent destruction after callback unwinds and release queue slot after teardown; retain shared probe client/other owners. +- No live browser/WebTorrent/network/CPU/RangeGET claim; no product edits until independent routing. diff --git a/docs/agents/backlog/client-reliability-9.json b/docs/agents/backlog/client-reliability-9.json index 5b8f7972..82ea5053 100644 --- a/docs/agents/backlog/client-reliability-9.json +++ b/docs/agents/backlog/client-reliability-9.json @@ -7,5 +7,5 @@ "addedOn": "2026-10-22", "filedAt": "fb54cea3a2ba99b4860421724a5050af6b97c293", "brief": "docs/agents/CAMPAIGN-2026-10-22.md", - "evidence": "HEAD-only fix e9c960ed/merged09f52bdd durably landed f41ac656 normalgateexit0,435discovered/435unique starts missingextra0,ancestry0;build/artifactexit0;controlled native Chromium+Firefox lifecycle PASS with synthetic loadeddata/publicdeny. Prior60focused/16mutants/lint11. Resources released. HLS/torrent/RangeGET separately OPEN; no wholeStage3 claim. test_logs/TEST_LOG_2026-10-22_20-52-00_client-reliability-9-browser.md HLS read-only atd04d501e:12modes/7controls pass/5cancellationfail/0cancelled/naturalexit1; GET/body finalowner retains timer/unsettled,rejoin old,latecache. Await explicit controller+HLShelper routing. test_logs/TEST_LOG_2026-10-22_20-54-00_client-reliability-9-hls-investigation.md HLS explicitlyrouted20:55:13Z;minimal controllerhandoff+helperfetch/bodycancel implemented;new35+existing94=129pass/6files,19isolatedmutantsnaturallyfail/cancelled0,lint11exit0;noexistingtestsmodified. READY for serialized full/build/browser/normal slot after candidatecommit/merge; notsubmitted. test_logs/TEST_LOG_2026-10-22_21-03-00_client-reliability-9-hls-ready.md" + "evidence": "HEAD-only fix e9c960ed/merged09f52bdd durably landed f41ac656 normalgateexit0,435discovered/435unique starts missingextra0,ancestry0;build/artifactexit0;controlled native Chromium+Firefox lifecycle PASS with synthetic loadeddata/publicdeny. Prior60focused/16mutants/lint11. Resources released. HLS/torrent/RangeGET separately OPEN; no wholeStage3 claim. test_logs/TEST_LOG_2026-10-22_20-52-00_client-reliability-9-browser.md HLS read-only atd04d501e:12modes/7controls pass/5cancellationfail/0cancelled/naturalexit1; GET/body finalowner retains timer/unsettled,rejoin old,latecache. Await explicit controller+HLShelper routing. test_logs/TEST_LOG_2026-10-22_20-54-00_client-reliability-9-hls-investigation.md HLS explicitlyrouted20:55:13Z;minimal controllerhandoff+helperfetch/bodycancel implemented;new35+existing94=129pass/6files,19isolatedmutantsnaturallyfail/cancelled0,lint11exit0;noexistingtestsmodified. READY for serialized full/build/browser/normal slot after candidatecommit/merge; notsubmitted. test_logs/TEST_LOG_2026-10-22_21-03-00_client-reliability-9-hls-ready.md 2026-10-26 active-torrent investigation at e9af76df: actual grid observer/queue/probePeers fake WebTorrent IO+clock; corrected scratch12=7pass/5fail/naturalexit1/allcleanup0/network0. Final-owner retains1torrent/2listeners/timeout+poll/unsettled, same-turn+later joins obsolete probe, latecache and occupied FIFO capacity; shared/live-wire/error/timeout/queued-priority/deferred-teardown/staleobserver controls pass. Existing lifecycle11/11 unchanged naturalexit0. First JSDOM timer-confounded12=5pass/7fail preserved; IO-isolated correction documented. Proposed gridHealth+probePeers optional lifecycle ONLY, needs explicit routing/spec correction for prior active-sharing/cache assertions; no product/test edits/full/build/browser/submission. test_logs/TEST_LOG_2026-10-26_15-25-00_client-reliability-9-torrent-investigation.md" } diff --git a/test_logs/TEST_LOG_2026-10-26_15-25-00_client-reliability-9-torrent-investigation.md b/test_logs/TEST_LOG_2026-10-26_15-25-00_client-reliability-9-torrent-investigation.md new file mode 100644 index 00000000..5dab06a9 --- /dev/null +++ b/test_logs/TEST_LOG_2026-10-26_15-25-00_client-reliability-9-torrent-investigation.md @@ -0,0 +1,39 @@ +# Client9 active torrent investigation — no product changes + +- Authority: interpreter mail2026-10-26T15:19:48Z, INVESTIGATION only after source plan; actual gridHealth/queue/probePeers with fake IO/clock, no real peer traffic. QA sole browser; no client browser/full/build/product/test edits or submission. Read newest RULE-CHANGES/test-integrity and Stage3 source before scratch. +- HEAD e9af76dfd23c6ebdde355d376af05261bdb89f00, own area/client-reliability branch; clean initial tree. Runtime still unchanged at final inspection (`git diff --exit-code e9af76df -- js tests` =>0). filedAt fb54cea3 precedes already landed HEAD/HLS fixes; remaining torrent boundary still applies at current HEAD. +- Source plan: import actual js/gridHealth.js/createCardObserver/queue and actual TorrentClient.probePeers. Substitute WebTorrent class at constructor IO boundary with EventEmitter-based temporary torrents; transparent wrapper records actual method settlement. Controlled setTimeout/setInterval clock, synthetic observer delivery/JSDOM cards, fake persistence IO. No copied/rewritten product modules. No live tracker/WebRTC/swarm/decoder/browser. fetch/WebSocket guards record0 attempted calls; fake WebTorrent means no real peer IO. setImmediate only drains task/promise turns; no wall-clock sleeps/retries/timeouts increased/force exit. + +## Commands and retained results + +- `env -u NODE_TEST_CONTEXT -u UNIT_TEST_SHARD node /tmp/client9-torrent-investigation-20261026.mjs > /tmp/client9-torrent-investigation-20261026.log 2>&1`: natural exit1,12cases/5pass/7fail. Five intended Stage3 cancellation assertions fail; two extra controls fail counting1 remaining zero-delay JSDOM StorageImpl event as torrent timer. Source node_modules/jsdom/lib/jsdom/living/webstorage/Storage-impl.js:74 schedules setTimeout on setItem. First script/log preserved unchanged; this is not a product error/timeout resource failure. +- Separate storage-isolated fixture keeps actual storage serialization/read functions, substitutes memory map at localStorage IO instead of JSDOM's asynchronous storage-event dispatch. All scenario assertions unchanged. `env -u NODE_TEST_CONTEXT -u UNIT_TEST_SHARD node /tmp/client9-torrent-investigation-storage-isolated-20261026.mjs > /tmp/client9-torrent-investigation-storage-isolated-20261026.log 2>&1`: natural exit1,12cases/7pass/5fail. All12 finally-cleanups activeTorrents0/listeners0/unsettled0/timers0; each created torrent destroyed exactly once, max actual fake torrent resources4. This correction isolates fixture IO and does not change product code or rerun unchanged flakiness. +- `env -u NODE_TEST_CONTEXT -u UNIT_TEST_SHARD node --test tests/grid-health-lifecycle.test.mjs > /tmp/client9-grid-existing-contract-20261026.log 2>&1`: natural exit0, runner reports file-level1pass/0fail/0cancelled (~2028ms); no individual scenario count in that output, not called11 from that run. +- `env -u NODE_TEST_CONTEXT -u UNIT_TEST_SHARD node tests/grid-health-lifecycle.test.mjs > /tmp/client9-grid-existing-contract-direct-20261026.log 2>&1`: natural exit0, actual11scenarios/11pass/0fail/0cancelled/0skip (~332ms). Direct invocation exposes subtest counts, including prior active-sharing and disposed-active-cache contracts. Existing suite unchanged. +- Raw scripts/logs and SHA256 manifest retained under /home/user/.local/state/agent-fleet/bitvid/evidence/client-reliability-9/client9-torrent-investigation-20261026.sha256. Corrected script SHA25696eec664a054ba0d63c903c3f9bb086f57526e17b3df8951056898af162cfbe4; corrected log882780bf806cade580ffe0287709a5cf0f879acc7ea21842561bece63c522832. Original script86b5d189733cdcbc7fab716d3fb48136590f0be6a52955d46586d276aa255ef0/log42ffd9a486f930ef0bd308373c26e15894df71785c48d8672edd480ecadfb792. + +## Corrected fixture observations + +| Case | Result | Boundary evidence | +| --- | --- | --- | +| Final owner dispose | FAIL | Before and after dispose plus task/zero-delay drain:1torrent,2listeners,1timeout+1poll,1unsettled;0destroy. Expected prompt release without original20s deadline. | +| Disposed late wire | FAIL | Controlled late success destroys torrent/cleans timers but populates persistent healthy cache; disposed card remains checking. No stale badge defect. | +| Same-turn fresh owner | FAIL | Still1probe/1torrent, expected fresh second probe after prior final-owner disposal; new owner joins old work. | +| Later fresh owner | FAIL | Same1probe after task drain; retained obsolete work remains deduplicated. | +| Queue capacity after disposal | FAIL | Four active; fifth live source queued. Dispose one active final owner => still4starts/4resources/8listeners/4timeouts+4polls; expected fifth start after obsolete teardown. This is retained occupied capacity, not exceeding cap. | +| Shared live owner | PASS | Two feeds share1probe; first dispose retains live work/timer; wire yields healthy live card/cache, disposed card checking. | +| Live wire/cache | PASS | Healthy result and cache reuse; no extra add. | +| Live error | PASS | Unhealthy/error, temp torrent destruction, timers cleaned, negative cache retained. | +| Live20s timeout | PASS | Unsettled at19999 fake ms; timeout settles/unhealthy/cache/cleanup at20000. | +| Queued prune/priority/FIFO | PASS | Cancelled queued source never adds/caches; equal priority insertion then lower priority, peak4. | +| Deferred teardown/slot | PASS | Wire settles internally but next add waits for zero-delay destroy; destroy precedes fifth add, peak4. | +| Late disposed observer | PASS | No old-card updates/new add; late observer guarded. | + +## Contract and smallest proposed routing + +- Source-backed gap from planned Stage3 active cancellation, not a regression against existing queued-only tests. docs/performance-efficiency-plan.md Stage3 says pass abort/cancellation into active torrent probes and removed cards do not retain probes. Current gridHealth releaseProbe intentionally preserves running jobs; job.cancel only removes still-queued entries; webtorrent.probePeers accepts no cancellation owner and retains timeout/poll/temp torrent until wire/error/timeout. Missing signal alone is not proof: actual disposal retains measured resources and delays live queued progress. +- Proposed product boundary ONLY js/gridHealth.js ownership/cancelled record/inflight/cache guards and js/webtorrent.js probePeers optional lifecycle plumbing, plus unique focused tests/spec/integrity notes AFTER explicit dispatch routing. Do not change limits/TTLs/magnet hints/tracker policy, shared probe client or playback/service-worker/engine/app behavior. +- Mark final-owner cancelled/unavailable synchronously, detach active probe hooks/timers and schedule safe temporary-torrent destruction; settle cancelled work and advance queue exactly once AFTER destruction, preserving existing event-unwind/teardown-before-slot-release safety. Do not destroy the shared probeClient or other owners' torrents. Same-source replacement cannot share cancelled record or be deleted/cached/painted by old continuations. Preserve ownerless standalone helper callers and live/shared wire/error/timeout/cache behavior. +- Spec correction needed before altering tests/grid-health-lifecycle.test.mjs scenarios at367(active probe retained across last-owner gap/rejoin) and417(disposed active success caches). Old contract permits these; proposed new contract requires fresh request after final-owner cancellation/no obsolete cache. Preserve separate shared-with-live-owner/live-completion/cache/TTL controls and replace only with equally strict lifecycle/resource assertions under routed Test Integrity Note. No test changes made now. +- Future acceptance must include pre-start/at-add cancellation, synchronous/late wire/error callbacks, missing/ignored abort cooperation, same-turn/later replacement identity, cross-feed ownership, repeated release, queue error/cancellation cleanup, live timeout and deferred teardown exception/event-unwind safety. Current scratch does NOT establish these future cases, real WebTorrent network byte/resource behavior, browser/peer playback, CPU improvement, HLS/RangeGET or wholeStage3. +- DONE for this investigation: current-HEAD measured gap, preserved failed baseline+controls, smallest boundary/contract proposal. WAITING for dispatch routing/independent reproduction before any implementation or retained tests. Item9 remains open; evidence commit is local, not landed/qualified product. diff --git a/todo/TODO_2026-10-26_15-25-00_client-reliability-9-torrent.md b/todo/TODO_2026-10-26_15-25-00_client-reliability-9-torrent.md new file mode 100644 index 00000000..146f0d6e --- /dev/null +++ b/todo/TODO_2026-10-26_15-25-00_client-reliability-9-torrent.md @@ -0,0 +1,8 @@ +- [x] Read mailbox/current rules and write source plan. +- [x] Measure actual current-HEAD grid/probe lifecycle offline. +- [x] Preserve first fixture result; classify JSDOM storage timer confound; corrected IO-isolated fixture12=7pass/5fail. +- [x] Preserve old-contract suite11/11 and enumerate required spec correction. +- [x] Save scripts/rawlogs/hashes and narrow fix proposal. +- [ ] Independent dispatch reproduction/explicit implementation routing. +- [ ] Product fix, strict regressions+mutants+lint, later resource-routed full/build/browser/normal landing. +- [ ] Remaining live/network/wholeStage3 qualification.