Skip to content

3.2.0 maintenance — code quality sweep - #72

Open
Dan-StrategicAutomation wants to merge 5 commits into
masterfrom
fix/code-quality-sweep
Open

3.2.0 maintenance — code quality sweep#72
Dan-StrategicAutomation wants to merge 5 commits into
masterfrom
fix/code-quality-sweep

Conversation

@Dan-StrategicAutomation

Copy link
Copy Markdown
Collaborator

Overview

Maintenance release 3.2.0 with focused code-quality improvements derived from the 20260815_code-review-fixes.md plan.

This PR contains two committed sweeps:

  1. 48dfe02 — Priority A correctness fixes + version bump to 3.2.0
  2. 9f6e86c — Priority C/D non-pythonic cleanup + dead code removal

Priority A — Correctness (committed in 48dfe02)

Item Bug Fix
A1 code_execution_audit.py:314receipt_file.parents[2] resolves to . on relative path .resolve().parents[2]
A2 exec_handlers.py:226–240 — sync-credit reservation leak on mid-burst kill try/finally guard
A3 adapters.py:298int(None) on omitted --port explicit presence check
A4 history.py:24replace("\r\n") misses bare \r splitlines()

Plus: version bump to 3.2.0 across all surfaces, README reference count 17→18.

Priority C/D — Cleanup (committed in 9f6e86c)

Item Change
C1 hashlib.file_digest() in receipt_integrity.py
C2 datetime.fromisoformat() ×2 in command.py
C3 argparse.ArgumentParser in score.py
C5 re.sub() for HTML comment removal in hypotheses.py
D1 Removed unreachable RuntimeError("unreachable") in state.py
D2 Renamed findingsfinding_files in findings.py (avoids module shadow)

Deferred (not in this PR)

Item Reason
C4 TemporaryDirectory() — pytest basetemp spans subprocess + finally
C6 FindingModel Pydantic v2 rewrite — validates findings, schema-sensitive
C7 yarl.URL for scope classifier — validation boundary
C8 Comprehension modernizations — trivial but widespread
B1–B3 Parser consolidation — needs score delta proof (benchmark verification)
D2 proof.py Param is clean (no module shadow in scope)

Verification

  • pytest: 443 passed, 1 skipped ✅
  • ruff check: clean ✅
  • ruff format --check: clean ✅
  • scripts/violin_guard.py check-release: all gates pass ✅

No behavioral changes in scoring, PTT, or guard logic — only the A1–A4 correctness fixes have semantic effect, and they are covered by the existing test suite.

Violin added 3 commits August 15, 2026 20:38
Collapse 72 development commits into a single coherent release commit.

Benchmark & evaluation:
- Automated benchmark runner (benchmark/run.py) with OpenRouter/Docker support
- Evidence-gated scorer, proof verifier, AI judge, and bounded artifact indexer
- Duck Store calibration suite (known-good / known-bad baselines)

Guard & scope policy:
- AST-based scope parsing (bashlex + yarl + netaddr) eliminating false positives
- Receipt integrity verifier, fail-closed state parsers, record-as-you-go recency gates
- Hypothesis disposition deadlock resolution; case-insensitive REPORTING phase gate
- Block messages name remediation tools with concrete parameter templates

Skills & methodology:
- 31 playbooks / 17 references / 12 templates routed across pentest, web-attacks, access-control
- De-benchmarked production code (no scorer/challenge references leak into the framework)
- Evidence-path and open-redirect routing corrections; single-step win formalization

Docs:
- Corrected benchmark results to measured values (best 17/20, stable 14-17)
- Sourced Duck Store ranking table with citations and model-agnostic cost/speed comparison

Tests: 443 passed, 1 skipped; ruff clean.
Address correctness bugs identified in code review:

- code_execution_audit.py: resolve receipt path before parents[2] so
  abandon_execution history lands in the engagement root, not ".".
- exec_handlers.py: release sync-credit reservation in a try/finally so a
  mid-burst process kill (BaseException) cannot leak the reservation.
- adapters.py: validate listener port presence before int() coercion,
  returning a clear "port is required" error instead of TypeError.
- history.py: use splitlines() so legacy CR line breaks normalize correctly.
- README: correct reference count (17 -> 18) in banner and tree.

Version bump 3.1.0 -> 3.2.0 across pyproject.toml, distribution.yaml,
plugin.yaml, CHANGELOG.md, and the release-surface test.

Tests: 443 passed, 1 skipped; ruff check + format clean; check-release OK.
… C/D)

Safe cosmetic improvements per code-review-fixes plan:
- C1: hashlib.file_digest() in receipt_integrity.py
- C2: datetime.fromisoformat() ×2 in command.py
- C3: argparse.ArgumentParser in score.py (replaces manual argv loop)
- C5: re.sub() for HTML comment removal in hypotheses.py (adds module-level import)
- D1: removed unreachable RuntimeError in state.py
- D2: renamed `findings` → `finding_files` in findings.py (avoids module shadowing)

Deferred (carry regression risk or need benchmark verification):
- C4: tempfile.TemporaryDirectory() (pytest basetemp spans subprocess + finally)
- C6: FindingModel Pydantic v2 rewrite (validates findings — schema-sensitive)
- C7: yarl.URL for scope classifier (validation boundary)
- C8: comprehension modernizations (trivial but widespread)
- B1–B3: parser consolidation (score.py↔ptt.py, chunked reader) — needs score delta proof
- D2 (proof.py): param is clean, no module shadow

All 443 tests pass; ruff + format + check-release clean.
Comment thread plugins/violin_guard/command.py Fixed
Comment thread plugins/violin_guard/command.py Fixed
Comment thread benchmark/run.py
shutil.rmtree(item, ignore_errors=True)
else:
item.unlink(missing_ok=True)
except Exception:
Violin added 2 commits August 15, 2026 21:39
Phase 1 per codebase standardisation plan:
- adapter_handlers: remove os.environ["ENG_DIR"] mutation in handle_ffuf;
  pass eng_dir directly to resolve_ffuf_wordlist. Remove dynamic sys.modules
  lookup in _get_handle_exec; direct import of exec_handlers.handle_exec.
  Drop now-unused os/sys imports.
- ptt_handlers: remove dynamic sys.modules lookup in _get_skill_view_adapter;
  return HermesSkillViewAdapter directly. Drop unused sys import.
- base: acquire lock_file before appending to framework_feedback.md in
  _log_guard_friction (concurrent write safety).
- AGENTS.md: add spelling/naming, timestamp, concurrency, sys.modules,
  and domain-driven test naming policies.
- CHANGELOG: document 3.2.0 code-quality and concurrency sections.

Tests updated to clean dependency injection (patch the module where the
symbol resolves, not the handlers package):
- exec_handlers.handle_exec for listener tests
- ptt_handlers.HermesSkillViewAdapter for skill-view / PTT tests
- resolve_ffuf_wordlist now receives eng_dir kwarg in ffuf handler tests

All 443 tests pass; ruff check/format clean; check-release passes.
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