Skip to content

power: retain bounded asynchronous battery evidence (#439) - #446

Draft
adrianwedd wants to merge 1 commit into
masterfrom
fix/439-bounded-battery-evidence
Draft

adrianwedd wants to merge 1 commit into
masterfrom
fix/439-bounded-battery-evidence

Conversation

@adrianwedd

Copy link
Copy Markdown
Owner

Related to #439; prerequisite evidence retention only, not a shutdown fix. Do not close the parent issue.

Records timestamped unrounded ADC voltage, existing rounded voltage, and rejected_adc/warmup/accepted classification. Reuses StallProofLineWriter with a 64-line bounded queue and two files capped at 256 KiB each; appended lines capped at 512 bytes. No filesystem work on the new evidence producer path. Cumulative dropped/error counters become visible after recovery.

Charging detector, ADC floor, counters, battery.json schema, and shutdown policy are unchanged. No new dependencies or service changes. Best-effort only: no fsync; queued/partial final records can be lost at power failure. Existing synchronous state/health/alert paths are unchanged. Compatibility, limits, and a later operator verification recipe are in docs/operations/battery-evidence-retention.md.

Validation: 15 targeted tests passed (new synthetic storage/clock/voltage tests plus existing battery trend tests); bash -n bin/px-battery-poll and git diff --check passed. Slow storage is held blocked while the producer completes; ENOSPC, EACCES and EROFS are injected. The poller integration test parses AST only. No poller, hardware, GPIO, audio, sudo, service, deployment, or fault induction was executed. No live evidence or brownout diagnosis is claimed.

Self-reviewed exact four-file patch for scope and privacy. Reviewed commit and verified remote branch head: 9e27f8d. Open PR ownership rechecked; no overlap with existing PRs. Pending independent review and hosted checks; do not merge or deploy as part of this delivery.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying spark with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9e27f8d
Status: ✅  Deploy successful!
Preview URL: https://cf5090a3.spark-e11.pages.dev
Branch Preview URL: https://fix-439-bounded-battery-evid.spark-e11.pages.dev

View logs

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant