Skip to content

Add decoding regression coverage for all idle-detector readers - #89

Open
Marsu6996 wants to merge 1 commit into
CodeAbra:mainfrom
Marsu6996:fix/pmset-unicode-decode
Open

Add decoding regression coverage for all idle-detector readers#89
Marsu6996 wants to merge 1 commit into
CodeAbra:mainfrom
Marsu6996:fix/pmset-unicode-decode

Conversation

@Marsu6996

@Marsu6996 Marsu6996 commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Repointed against current main as requested after the production fix shipped in v2.6.1. This PR now contains regression coverage only; it makes no production-code changes.

The shared lenient-decoding helper serves four system readers. The test coverage now exercises all four paths:

  • ioreg HID idle output (existing invalid-UTF-8 test retained);
  • pmset -g log, strengthened so the invalid byte occurs inside an otherwise valid sleep-event line;
  • pmset -g responsiveness output;
  • Linux busctl JSON output.

This is regression coverage for #86.

Type of change

  • Bug fix
  • New feature
  • Refactor (no behaviour change)
  • Documentation
  • Build / tooling
  • Other: regression tests

Affected areas

  • Capture path
  • Recall / retrieval
  • Consolidation / sleep cycles
  • Daemon lifecycle / FSM
  • Storage / encryption at rest
  • MCP wrapper (TypeScript)
  • Bench harness
  • Other: macOS and Linux idle detection

Testing

  • pytest passes locally
  • ruff check src/ tests/ clean
  • New tests added for changed behaviour, or rationale below for why not

Targeted validation:

  • pytest -q tests/test_idle_detector.py: 37 passed
  • ruff check tests/test_idle_detector.py: passed
  • git diff --check: passed

Full local suite:

  • 5511 passed, 216 skipped, 4 xfailed, 2 failed

Both failures are checkout-environment mismatches unrelated to this test-only diff:

  • the local installed distribution is still 2.6.0 while current main declares 2.6.1;
  • the checkout contains both Python 3.11 and Python 3.12 native extension binaries, while the test requires exactly one.

The pull-request CI will validate the branch in a clean environment. The repository-wide Ruff baseline is not currently clean; the touched file introduces no Ruff diagnostics.

Benchmarks

Not applicable: this PR changes tests only.

Notes for reviewers

The previous implementation change has been removed because v2.6.1 already ships the shared _run_captured fix. The branch is rebased onto current main and now preserves only the stronger regression coverage requested in review.

@CodeAbra

Copy link
Copy Markdown
Owner

#88 is merged — thanks.

This one collided. The same fix went out in v2.6.1 a few minutes ago; it was written and gate-tested before your PR opened, and you had no way to see it — our work happens in a private tree first. Ours routes all four readers through one lenient-decoding helper, including the Linux busctl probe you scoped out.

Your tests are better than what shipped, though. Ours assert end behaviour; your fake run asserts that encoding and errors are actually passed, which catches someone quietly dropping them later. If you repoint this PR at just those tests against current main, I'll take it.

@Marsu6996
Marsu6996 force-pushed the fix/pmset-unicode-decode branch from 79dab27 to 1d231d1 Compare July 26, 2026 05:02
@Marsu6996 Marsu6996 changed the title Tolerate invalid UTF-8 in macOS idle probes Add decoding regression coverage for all idle-detector readers Jul 26, 2026
@Marsu6996
Marsu6996 marked this pull request as ready for review July 26, 2026 06:04
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.

2 participants