# M00-QAR-CAPTURE-SHUTDOWN-001 — Capture shutdown drain ## Ownership - Target: M00 - Program: QAR - Owner/Agent ID: sindo-main-codex - Branch: `work/sindo-main-codex/m00-capture-shutdown` - Lease expires UTC: 2026-07-14 - Integrator: milestone integrator ## Outcome Eliminate the reproducible capture-tool ObjectDB leak by completing owned threaded resource requests and draining deferred scene deletion before process exit. ## Non-goals - Refactoring renderer resource ownership. - Hiding genuine RID or worker-task leaks. - Changing capture images, metrics, or streaming behavior. ## Paths - Exclusive: capture tool shutdown sequence - Shared/hotspots: renderer baseline documentation - Generated/ignored: verbose Godot logs ## Contracts and data - Public API/events: none - Schema/format version: unchanged - Migration/compatibility: none - Consumers: M00 baseline runner ## Dependencies - Requires: reproducible verbose leak diagnostic - Blocks: clean M00 capture shutdown evidence - External state: none ## Verification - Commands: identical verbose dry-run before/after, M00 dry-run, repository gates - Fixtures: ADT-boundary filtered capture - Fidelity evidence: no visual behavior change - Performance budget: blocking resource completion is restricted to shutdown; two SceneTree drain frames only ## Documentation deliverables - Inline public API docs: shutdown rationale comment - Module specification: recovery/known-risk update - Data-flow diagram: unchanged - Sequence/state/dependency diagrams: shutdown sequence documented in baseline - Source map/status updates: baseline evidence ## Simplicity and naming - Important names introduced: none - Simplest considered solution: await two SceneTree frames after `queue_free` and finish registered in-flight ResourceLoader requests during loader shutdown - Rejected complexity/abstractions: resource registry or manual child traversal - Unavoidable complexity and justification: deferred deletion requires frame drain - Measured optimization evidence: not applicable ## Status - State: ready-for-review - Done: one leaked RefCounted reproduced; isolation attributed it to `StreamingWorldLoader`; active threaded tile request was confirmed as the retained object; all owned threaded resource registries now finish in-progress requests before clearing; two identical verbose ADT-boundary runs and the full M00 dry-run completed without ObjectDB leak diagnostics - Next: integrator review and merge - Blocked by: ## Handoff - Commit: this work-package commit - Results: verbose filtered capture returned one report and zero `Leaked instance`/`ObjectDB instances leaked` lines on two consecutive runs; `run_render_baseline.ps1 -DryRun` passed all gates and seven checkpoints - Remaining risks: - Documentation updated: `docs/modules/world-renderer.md` shutdown sequence, ownership contract, recovery table and known-risk status