Files
lg-smtv-mcp/docs/adr/0004-sequenced-temp-captures-with-cleanup-and-sweep.md
T
kiskaadee 1d3e40126d
Core Architecture & Invariant CI / validate (push) Successful in 15s
docs(designs,adr): align M2 implementation plan and resolve egm-review findings
- Update ADR-0003 and ADR-0004 Status lines from closed placeholder #5 to active M2 capture issue #12
- Fix LG Developer Mode documentation URLs from developer.lg.com to developer.lge.com in docs/designs/lg-smtv-mcp.md
- Clarify Developer Mode asyncssh/SFTP session lifecycle (lazily opened on first capture, reused while online, swept on connect/reconnect, and closed on STANDBY_OFFLINE), define FastMCP, and align state-diagram backoff terminology
- Document trusted home-LAN transport boundary, wss://:3001 self-signed TLS + client-key model, known_hosts=None vs. SSH_KNOWN_HOSTS_PATH host-key pinning trade-offs, and single-TV-per-daemon scalability limit
- Separate completed M1 baseline (#1-#4, matching actual tests/ layout and mime_type="image/jpeg") from actionable M2 specifications (#12 CaptureClient/AsyncSshCaptureTransport contracts and shielded cleanup, #13 systemd unit, #11 E2E hardening)
2026-11-16 16:28:15 -05:00

22 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ADR-0004: Sequenced Temp Captures with Cleanup and Sweep
- Status: Accepted (Implementation planned in M2 `#12`)
- Date: 2026-11-15
- Deciders: kiskaadee
## Context and Problem Statement
`ssap://com.webos.service.capture/executeOneShot` writes screenshots to a path on the TV's `/tmp` filesystem (~1.2 GB RAM). Writing to a fixed path risks reading stale frames on silent failure, while uncleaned unique paths can exhaust TV RAM.
## Decision Outcome
Chosen option: "Capture to `/tmp/lg_smtv_cap_<seq>.jpg`, pull bytes into memory only on `returnValue: true`, delete via `finally: sftp.remove()` under a `1–2s` grace period, and sweep `/tmp/lg_smtv_cap_*.jpg` on SFTP connect/reconnect", because it prevents both stale-frame reads and `/tmp` memory exhaustion.
## Consequences
- Positive: Guarantees fresh frame reads per sequence number and bounds `/tmp` usage even when captures fail or time out.
- Negative: Requires a `6s` shared capture deadline plus `1–2s` cleanup grace inside the `25s` `ui_lock` budget.
## Alternatives Considered
- Fixed `/tmp/test.jpg` overwrite path: Rejected because if `executeOneShot` fails silently or races, SFTP pull can read a stale screenshot from an earlier step.
## Related Decisions
- Documented in [docs/designs/lg-smtv-mcp.md](../designs/lg-smtv-mcp.md) (Alternative D) and [ADR-0003](0003-asyncssh-protocol-boundary-for-dev-mode-capture.md).