Skip to content

fix: regressions in the sweep surfaced by adversarial code review - #250

Merged
Xiddoc merged 1 commit into
masterfrom
claude/beetroot-sweep-optimize-fnq7r0
Jun 30, 2026
Merged

fix: regressions in the sweep surfaced by adversarial code review#250
Xiddoc merged 1 commit into
masterfrom
claude/beetroot-sweep-optimize-fnq7r0

Conversation

@Xiddoc

@Xiddoc Xiddoc commented Jun 30, 2026

Copy link
Copy Markdown
Owner

Summary

An adversarial code-review workflow over the two merged sweep PRs (#248, #249) found four high/med regressions that passed CI at 100% coverage because the existing tests had blind spots. This PR fixes them and closes the test gaps.

HIGH — the default binder: vm boot was broken (#162 / #174 / #176)

QemuProcess._pid_is_qemu() matched str(instance_dir) in /proc/<pid>/cmdline, but the default plain up argv (boot_cache: false, the shipped default) resolves kernel/rootfs from a shared artifacts cache outside the instance dir and references nothing under it. So is_running() was always False on the plain path, which:

The e2e tier missed it because it forces boot_cache: true (where the overlay/monitor do live under the instance dir). Fix: key identity on the instance-unique hostfwd ADB port, which every launch argv carries; the config-gone orphan teardown falls back to a best-effort qemu-system check. Tests now drive a real build_qemu_argv with paths outside the instance dir.

HIGH — frida accepted a truncated download (#228)

The incremental LZMA loop never checked decompressor.eof, so a stream that ended before its end-of-stream marker (a truncated download) was silently accepted as a complete binary — the one-shot lzma.decompress it replaced would have raised. Now rejects truncation, and caps per-call output (max_length) so a single compressed chunk can't expand without bound.

MED — gapps_vendor override note re-emitted per construction (#220)

The note was an Android model_validator firing on every construction, so a fleet scan reprinted it once per pinned-vendor instance — the repeated-note anti-pattern #202 had just fixed for its sibling. Moved to load_yaml, deduped per resolved path.

MED — ls/modes off-TTY table still folded wide cells (#204)

rich clamps a print(width=…) request to the console width (80 off-TTY), so a load-bearing cell wider than 80 was folded across lines. The render width is now set on the console so it stays on one physical line.

Also

Testing

Full local gate green: ruff, ruff format --check, mypy --strict (src+tests), pytest -p no:randomly at 100% line+branch coverage (1837 passed, 6 docker-daemon skips), shellcheck/shfmt, codespell, changelog lint. New tests drive the real plain-path argv, a truncated .xz, the per-path note dedup, the >80-col table cell, and module.sha256 rejection.

🤖 Generated with Claude Code

https://claude.ai/code/session_01P1YsNMpGizhSDDPCBu5cut


Generated by Claude Code

… of the sweep

An adversarial code-review pass over the merged sweep PRs (#248, #249) found
four high/med regressions that passed CI at 100% coverage because the tests
had blind spots. This fixes them and closes the test gaps.

binder:vm default boot was broken (HIGH, #162/#174/#176):
- _pid_is_qemu() matched the instance dir in /proc/<pid>/cmdline, but the
  DEFAULT plain `up` argv (boot_cache=false) resolves kernel/rootfs from a
  shared artifacts cache OUTSIDE the instance dir and references nothing under
  it. So is_running() was always False on the plain path, which made
  _wait_for_adb_connect() abort instantly on a healthy boot (#176) and made
  terminate() orphan the QEMU instead of killing it (#174). e2e missed it
  because it forces boot_cache=true (where overlay/monitor live under the
  instance dir). Identity is now keyed on the instance-unique hostfwd ADB port,
  present in EVERY launch argv; the config-gone orphan teardown falls back to a
  best-effort qemu-system check. Tests now drive a real build_qemu_argv with
  paths outside the instance dir.

frida truncated-download accepted (HIGH, #228):
- The incremental LZMA loop never checked decompressor.eof, so a stream that
  ended before its end-of-stream marker (a truncated download) was silently
  accepted as a complete binary — the one-shot lzma.decompress this replaced
  raised. Now rejects truncation, and caps per-call output (max_length) so a
  single compressed chunk can't expand without bound.

gapps_vendor override note re-emitted (MED, #220):
- The note was an Android model_validator firing on every construction, so a
  fleet scan reprinted it once per pinned-vendor instance. Moved to load_yaml,
  deduped per resolved path (the #202 pattern).

ls/modes off-TTY table still folded wide cells (MED, #204):
- rich clamps a print(width=…) request to the console width (80 off-TTY), so a
  load-bearing cell wider than 80 was folded across lines. The render width is
  now set on the console so it stays on one line.

Also completes module.sha256 shape validation (#194, the deferred half) and
fixes the sha256 regex to reject a trailing newline (fullmatch, not match).

Full gate green: ruff, mypy --strict src+tests, pytest 100% line+branch
(1837 passed), shellcheck/shfmt, codespell, changelog lint.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P1YsNMpGizhSDDPCBu5cut
@Xiddoc
Xiddoc merged commit 2075c97 into master Jun 30, 2026
12 checks passed
@Xiddoc
Xiddoc deleted the claude/beetroot-sweep-optimize-fnq7r0 branch June 30, 2026 21:27
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