← Back to Pull requests

fix(ack): preserve archive bytes in Kubernetes downloads #3144

Open
unknown opened this pull request with 224 lines diff across 2 files
View on GitHub
unknown unknown commented on Sep 09, 2026 02:08 UTC
Author

ACK downloads currently decode tar stdout as UTF-8 per WebSocket frame. Binary bytes and UTF-8 characters split across frames are replaced irreversibly, corrupting file contents and potentially hiding later archive members such as reward.json.

Set binary=True for both download streams and consume stdout directly as bytes. Accumulate directory stderr as bytes and decode it after collection so the existing missing-directory diagnostics still work. This keeps the fix within the two download methods; extraction behavior and retry policy are unchanged.

Regression tests feed real tar archives through the Kubernetes WSClient decoder with a mocked socket and deterministic 1,021-byte frames. They check Chinese/emoji text, arbitrary binary data, a trailing reward file, benign stderr, and a split UTF-8 directory error.

Validation (Python 3.13):

  • Kubernetes 32.0.1: all five new tests fail against the original implementation and pass with this patch; 158 ACK/GKE/tar-transfer unit tests pass.

  • Locked dependencies (Kubernetes 35.0.0): uv run --no-sync pytest tests/unit/environments/ — 1,862 passed, 16 skipped.

  • uv run --no-sync ruff check --fix ., uv run --no-sync ruff format ., uv run --no-sync ty check, and git diff --check pass.

  • No live ACK cluster validation was performed in this contribution run.
  • Fixes #3143.

    This PR was developed with AI assistance.

    <!-- devin-review-badge-begin -->

    ---

    <a href="https://app.devin.ai/review/harbor-framework/harbor/pull/3144" target="_blank">
    <picture>
    <source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=3">
    <img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=3" alt="Devin Review">
    </picture>
    </a>
    <!-- devin-review-badge-end -->

    Diff: 224 lines (+168 / -56) across 2 files Reviewer: KunWuLuan Review duration: 32331m
    All Vouch review confidence checks passed
    Residual risk 0.34 = Change Risk (0.60) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.60 · 224 lines diff across 2 files
    0.60
    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%
    42%
    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.324
    Sensitive Paths sensitive_paths
    0.060
    Real PR Conversation Timeline
    1 comments
    "Review active on #3144"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed sensitive_module
    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: 60% (MEDIUM) · Higher = larger blast radius
    60%
    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: 43.0% · Lower = rushed or shallow review
    43.0%
    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: 34.2% · Safe to merge
    34.2%