← Back to Pull requests

Remove the environment-loaded human-only classifier (class b) #9

Open
unknown opened this pull request with 417 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 30, 2026 23:28 UTC
Author

Finding

REVIEW-2026-10.md, pile one, class (b): scripts/store.py 1710-1728 at e480bbd. From the 27 October shortlist: "PARSICA_HUMAN_ONLY_CLASSIFIER imports whatever module the variable names (store.py:1718-1725), and from then on that module is handed every piece of text and every record before it is stored. In Weave's code it can only add refusals, never remove the built-in ones. But it would be a perfect place to copy everything out, and if the import fails, that is swallowed without a word (store.py:1726-1727). It has been there since the first commit, 459bd6b."

Fix

_optional_classifier() and its module-level cache are removed. is_human_only_text and is_human_only_record keep exactly the two open-code floors, the [[human-only]] sentinel and the configured human_only_terms substring match, and consult nothing else. Nothing is loaded from the environment; a classifier, if one is ever wanted, is a module in this tree and is reviewed with it. The README's Environment paragraph no longer names the variable.

Lines closed: scripts/store.py 1689-1699 (the comment and the cache), 1710-1728 (the import), 1757-1760 and 1779-1782 (the two call sites); README.md 469-471.

Tests

New scripts/test_no_environment_loaded_code.py, four tests, which run under pytest and standalone:

  • blocked: a real, importable canary module named by PARSICA_HUMAN_ONLY_CLASSIFIER is never imported while the fence is evaluated (its import marker never appears, and it is not in sys.modules). Run against the unchanged store.py this test fails with "the module named by the environment was imported", which is the finding;

  • allowed and blocked with the variable set: the sentinel refuses, a configured term refuses, clean text passes, and the five answers are identical with and without the variable;

  • structural: no production script under scripts/ imports importlib, calls import_module or __import__, or reads the variable; discovered, not hand-listed;

  • a scanner self-test.
  • Changed: test_human_only_fence.py (its docstring described the optional classifier, and test_configured_term_blocks_without_any_classifier asserted the variable was unset as a precondition of the old design; both now describe the two floors) and test_isolation_nowrite.py (stops clearing a variable that no longer exists). No test was removed or weakened.

    Full suite in the sandbox, python -m pytest scripts -q on Python 3.13.17: 443 passed, 22 skipped, 3 failed. The three failures are the same pre-existing ones recorded in #8 (test_metadata_preflight.py mid-read swap on 3.13, its suite-bridge echo, and test_promote_preview.py exiting 1 standalone without Spirit). Standalone: test_no_environment_loaded_code.py 4/4, test_human_only_fence.py 10/10.

    Calls made

  • CHANGELOG.md line 161 still describes the variable as part of what v1.0.x shipped; it is left as the record of that release, and REVIEW-2026-10.md is the running record of the fix.

  • The session's guard blocked my first attempt to apply these edits from the shell (rule G10: the heredoc carried backtick characters inside Python strings). I applied the same edits with the editor tool instead; the diff is the one described above.
  • ---
    _Generated by Claude Code_

    Diff: 417 lines (+312 / -105) across 5 files Reviewer: claude[bot] Review duration: 2m
    All Vouch review confidence checks passed
    Residual risk 0.38 = Change Risk (0.45) × (1 − Review Confidence (0.16)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.45 · 417 lines diff across 5 files
    0.45
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 26% · Reviewer familiarity: 35%
    15%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.361
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #9"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: medium confidence: 15.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 45.0% (MEDIUM) · Higher = larger blast radius
    45.0%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 15.8% · Lower = rushed or shallow review
    15.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 37.9% · Moderate risk
    37.9%