← Back to Pull requests

test(host): cover the disk-size threshold in fetch_host_extend (#721) #762

Open
unknown opened this pull request with 214 lines diff across 2 files
View on GitHub
unknown unknown commented on Sep 21, 2026 06:06 UTC
Author

What this adds

Regression tests for #721's disk-size threshold, which landed as a2b4643 with
no test coverage. The fix itself is already on 4.0; this PR only adds tests,
rebased onto current 4.0.

Two cases, one per probe path in fetch_host_extend():

  • lsblk path — an 8GB and an exactly-10GB disk are collected alongside

  • 40GB/512GB.
  • /proc/partitions fallback — a 5GB disk and an exactly-10GB disk are

  • collected, and the partition entry (sda1) is still filtered out by
    WHOLE_DISK_REGEX.

    The exactly-10GB case is the one the old if size > 10 guard dropped in both
    paths, which is why it is asserted explicitly rather than folded into a "small
    disk" case.

    Verification

    Both tests fail against the pre-fix guard and pass against the merged fix —
    checked by editing only apps/host/utils.py back to if size > 10 and running
    them again:

    assert [40, 512] == [8, 10, 40, 512]
    assert [120] == [120, 5, 10]
    

    $ python -m pytest tests/test_host_extend_disk.py -q
    2 passed
    

    The SSH layer is stubbed (FakeSSH.exec_command_raw returns preset output per
    command), so no host, database or network is involved. tests/conftest.py only
    puts spug_api on sys.path — the repo ships no test infrastructure, and the
    suite is small enough to run with just Django>=4.2,<4.3 installed.

    Relation to my earlier PR #753

    #753 proposed removing the size filter entirely, on the same issue. a2b4643
    took the >= 1 form instead and also added the -e 1,7,11 device exclusion,
    which is the better fix — it keeps a floor and stops virtual devices from
    eating the ten display slots. I've closed #753 in favour of this; the fixtures
    here use the merged -e 1,7,11 command.

    Diff: 214 lines (+160 / -54) across 2 files Reviewer: Huang-404-Q Review duration: 101740m
    All Vouch review confidence checks passed
    Residual risk 0.24 = Change Risk (0.44) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.44 · 214 lines diff across 2 files
    0.44
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.321
    Real PR Conversation Timeline
    1 comments
    "Review active on #762"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% 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: 43.6% (MEDIUM) · Higher = larger blast radius
    43.6%
    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: 44.7% · Lower = rushed or shallow review
    44.7%
    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: 24.1% · Safe to merge
    24.1%
    Repository