Skip to content

Pingora runtime policy scan decodes valid HWPX evidence as UTF-8 and blocks review #2116

Closed

Description

@seonghobae

Failure and consumer impact

Private consumer ContextualWisdomLab/late-life-anxiety-reanalysis, PR #10 head 41a11ba6fcae431b4d22f29834cea39242cffdb1, fails the required OpenCode bootstrap before review:

Pingora edge policy could not establish complete evidence: Runtime policy candidate evidence/reviewer_response_draft.hwpx is not valid UTF-8

Actual check annotation: https://github.com/ContextualWisdomLab/late-life-anxiety-reanalysis/actions/runs/34696894954/job/103561804112 . Retrieved through GraphQL checkRun annotations on 2026-09-12; REST job logs were rate-limited, so no other failure is classified here.

The consumer HWPX passes unzip -t; its archive contains mimetype, version.xml, Contents/header.xml, Contents/section0.xml, and META-INF/manifest.xml. No document body, participant data, or private artifact is attached.

Root-cause candidate and owner

Read-only inspection of the canonical scripts/ci/pingora_edge_policy.py in the local .github checkout finds binary documentation handling for PDF/PNG, followed by strict UTF-8 decoding for other candidate formats. HWPX is a ZIP-based document and reaches that text path. The observed failure is consistent with this classification gap. The loaded workflow's exact source revision still needs confirmation before claiming a deployed root-cause fix.

Canonical owner: .github Pingora policy maintainers. Consumer tracking: late-life-anxiety-reanalysis PR #10 and issue #9. Existing related PDF/PNG handling should be reused; do not remove the document, suppress errors, or bypass actual runtime policy violations.

Next action and acceptance

  1. Confirm the failed run's loaded policy revision and reproduce the decoding failure with a minimal non-sensitive HWPX archive in the owner's existing tests.
  2. Validate HWPX as a binary document with magic/archive checks in the existing classification boundary, preserving strict validation of real policy/configuration inputs.
  3. Add focused tests for valid HWPX, malformed ZIP, and text renamed to .hwpx; run the existing Pingora test suite.
  4. Publish through the owner's coordinated PR and rerun exact-head consumer bootstrap/review. Local tests do not establish that the hosted check is repaired.

Internal investigation/review date: 2026-09-13, because this blocks mandatory review for a current manuscript PR. This is a next-action deadline, not a promise of deployment. No source modification or review bypass has been made in the consumer or central owner.

Activity

  1. seonghobae commented on Sep 12, 2026

    @seonghobae
    ContributorAuthor

    RCA reproduction completed against the reviewed canonical owner policy at local SHA 58e63c211a0199ca0d5d3f40794d4c460af0295b.

    A minimal synthetic HWPX ZIP containing mimetype and Contents/content.hpf was supplied through an in-memory Contents API opener to _load_file_content(). The stdlib-only path made no network/credential calls and raised:

    PolicyError: Runtime policy candidate evidence/reviewer_response_draft.hwpx is not valid UTF-8
    

    The binary-document classification currently recognizes PDF/PNG, and HWPX falls through to strict UTF-8 decoding. This confirms the defect on that owner source revision; the failed hosted run's loaded revision remains to be established. Existing owner untracked agent metadata was preserved. No source edit or hosted repair is claimed.

  2. added
    bugSomething isn't working
    priority: criticalImmediate blocker, P0, urgent deadlock, or critical incident
    on Sep 12, 2026
  3. seonghobae commented on Sep 12, 2026

    @seonghobae
    ContributorAuthor

    Validated, unapplied owner candidate for #2116 at source baseline 58e63c211a0199ca0d5d3f40794d4c460af0295b.

    The supervisor reviewed and simplified the isolated patch, then ran:

    python3 test_hwpx_candidate.py
    # hwpx candidate checks passed
    python3 -m pytest -q tests/test_pingora_edge_policy.py
    # 67 passed in 0.19s
    

    New checks call the production evaluate_pull_request: valid HWPX accepted; malformed bytes, truncated ZIP, wrong MIME and missing manifest rejected; harmless plaintext still scanned normally; runtime-policy text disguised as .hwpx still produces nginx_runtime_path. Existing 67 owner regressions pass. The helper reads only the fixed HWPX MIME length plus one byte and does not decompress the manifest. Existing fallback policy scanning is reused without a duplicate branch.

    Patch SHA-256: 3467966cf0c0fb8e1ad51dc75ded02de01834e29dd1fb98966faaac6ff9dacb7. This is a local review candidate, not an applied owner change or hosted consumer fix. Please coordinate the canonical source writer, apply with focused tests, and revalidate the loaded release and exact consumer head before closing #2116.

    --- a/scripts/ci/pingora_edge_policy.py
    +++ b/scripts/ci/pingora_edge_policy.py
    @@ -11,10 +11,12 @@
     
     import argparse
     import base64
    +import io
     import json
     import os
     import re
     import sys
    +import zipfile
     import zlib
     from dataclasses import dataclass
     from pathlib import PurePosixPath
    @@ -42,6 +44,7 @@
     BINARY_DOCUMENT_MAGIC = {
         ".pdf": (b"%PDF-",),
         ".png": (b"\x89PNG\r\n\x1a\n",),
    +    ".hwpx": (b"PK\x03\x04",),
     }
     PNG_SIGNATURE = BINARY_DOCUMENT_MAGIC[".png"][0]
     SOURCE_TEST_SUFFIXES = frozenset({".py", ".pyi", ".js", ".mjs", ".cjs", ".ts", ".tsx", ".rs"})
    @@ -453,6 +456,21 @@
         suffix = PurePosixPath(changed.path).suffix.lower()
         if suffix == ".png":
             return _is_complete_png(raw)
    +    if suffix == ".hwpx":
    +        try:
    +            with zipfile.ZipFile(io.BytesIO(raw)) as archive:
    +                mimetype_info = archive.getinfo("mimetype")
    +                manifest_info = archive.getinfo("Contents/content.hpf")
    +                if mimetype_info.flag_bits & 0x1 or manifest_info.flag_bits & 0x1:
    +                    return False
    +                expected_mimetype = b"application/hwp+zip"
    +                if mimetype_info.file_size > len(expected_mimetype):
    +                    return False
    +                with archive.open(mimetype_info) as stream:
    +                    mimetype = stream.read(len(expected_mimetype) + 1)
    +                return mimetype == expected_mimetype
    +        except (KeyError, UnicodeError, OSError, zipfile.BadZipFile):
    +            return False
         return raw.startswith(BINARY_DOCUMENT_MAGIC[suffix])
     
     
  4. moved this from Todo to In Progress in naruon Platform Roadmapon Sep 12, 2026
  5. seonghobae commented on Sep 12, 2026

    @seonghobae
    ContributorAuthor

    Focused #2116 follow-up; this corrects the earlier candidate evidence and does not claim deployment.

    • Failed run 34696894954 resolved .github/workflows/opencode-review.yml@refs/heads/main to fb17ef556f94f673234aa557254ae52779e9a7b0 in its immutable-source log. The policy step then exited 2 on evidence/reviewer_response_draft.hwpx. Current main has the same policy/test bytes as earlier local baseline 58e63c211....
    • The previous candidate misses the actual consumer path: _is_known_documentation_path recognizes only doc/docs/documentation. Adding .hwpx alone leaves evidence/reviewer_response_draft.hwpx on the failing UTF-8 path. The previous candidate also allows ZIP prefixes/trailers because ZipFile accepts them.
    • Revised isolated candidate narrowly admits HWPX under evidence/ without exempting evidence text/config files. It verifies ZIP boundaries, unique members, the stored MIME marker and unencrypted nonempty package manifest. It retains the existing runtime-path guard and fallback scan; this is format classification, not document rendering or malware inspection.
    • Baseline acceptance tests: 3 failed / 17 passed. Revised main candidate: 89 passed (67 existing + 22 new). Isolated composition with fix(pingora): read Contents-API-oversized files through the Git Blobs API #1946 head 1cb8cceb8719eb054979d84141cda9a95c0c6873: 106 passed with GITHUB_ACTIONS=true (84 existing + 22 new). No private document body was read or published for these tests.
    • Commands: python3 -m pytest -q tests/test_pingora_edge_policy.py tests/test_pingora_hwpx_evidence.py; the fix(pingora): read Contents-API-oversized files through the Git Blobs API #1946 composition uses the same command prefixed by GITHUB_ACTIONS=true.
    • The existing scoped writer request on fix(pingora): read Contents-API-oversized files through the Git Blobs API #1946 remains pending; this candidate is unapplied to canonical source and no branch was pushed. Project Add Palette journal for profile repo #1 now tracks Pingora runtime policy scan decodes valid HWPX evidence as UTF-8 and blocks review #2116 In Progress. Next action: coordinated source integration, exact-head gates, then a new consumer bootstrap bound to the adopted central SHA. The consumer head observed this pass is e972b804824bdda9f56886503132c5c623883743; re-fetch before retry. Internal next review remains 2026-09-13.

    Format source: Hancom, “한/글 문서 파일 형식: HWPX 포맷 구조 살펴보기,” https://tech.hancom.com/hwpxformat/ (MIME marker and Contents/content.hpf package role).

    Graphify 0.9.58 actually generated the two-file AST graph/report/HTML: 175 nodes, 253 edges. Explicit extract --code-only --no-cluster and cluster-only --no-label avoid the default labeler's unintended Claude invocation (the initial invocation failed its stop hook). This is local AST evidence only; no approved CO document-semantic extraction or hosted graph gate is claimed. Repeated callback names in inferred edges remain graph interpretation limits, not runtime proof.

    Combined source/test patch SHA-256: 1556073bc8e8ecaac5a4169e2c68a1fb4646a3b0560a3357239d0772154bd249.

    Coverage: python3 -m coverage run --branch --source=scripts/ci -m pytest -q tests/test_pingora_edge_policy.py tests/test_pingora_hwpx_evidence.py then python3 -m coverage report -m: 388/388 statements and 174/174 branches, 100%. An initial incorrect --source=scripts/ci/pingora_edge_policy.py selector emitted module-not-imported/no-data-collected; correcting the selector produced actual data with no warnings. No suppression was used.

    Full-repository collection exposed a test-packaging defect hidden by the minimal isolated corpus: the new test imported test_pingora_edge_policy without the repository's tests. package prefix. Corrected to from tests.test_pingora_edge_policy import policy, matching existing repository tests. The complete GITHUB_ACTIONS=true python3 -m pytest tests -q rerun passed: 3061 passed, 1 skipped, 36 subtests passed in 149.56 s. The one skip was independently identified with -rs: test_helper_admits_the_reviewed_llvm_19_tools_when_present requires reviewed LLVM 19 tools not installed on this host; that host-tool integration remains unverified. No warning/deprecation diagnostics appeared in the complete captured output. Previous 89/106 focused counts describe the earlier packaging revision; this full result covers the corrected package import.

    Full configured coverage gate on the corrected candidate also passed: GITHUB_ACTIONS=true python3 -m coverage run -m pytest tests -q -rs → 3061 passed, 1 skipped, 36 subtests passed; python3 -m coverage report -m → 13,244 statements, zero missed; 5,356 branches, zero partial; 100%. python3 -m interrogate scripts/ci -q passed the configured docstring gate. The same LLVM 19 host-tool skip remains; no warning/deprecation diagnostics appeared in the captured coverage run. These are isolated candidate results, not canonical adoption or consumer hosted success.

    Integration validation on the main tree with PR #1946 policy/test delta (1cb8cceb8719eb054979d84141cda9a95c0c6873) plus the corrected HWPX candidate passed 3078 tests, 1 LLVM19 host-tool skip, 36 subtests. Configured coverage: 13,269 statements, zero missed; 5,368 branches, zero partial; 100%. No warning/deprecation diagnostics appeared in the captured full run. Separately, two additional cross-boundary regressions passed: a valid HWPX ZIP over 1 MiB at the exact consumer path follows Contents → Git Blobs and is admitted only when the returned blob SHA matches. This is combined local evidence, not a merged branch or hosted consumer success.

    Actual consumer artifact acceptance: fetched exact Git revision a1cd5bc6783c6510dfcf937f523c733366e82213, bound the 19,821-byte HWPX to Git blob c576cc11b73531a11987e2cdd54cfe50a6f15d11 (independently confirmed via GraphQL), and passed those bytes through the combined candidate production evaluate_pull_request using an offline API fixture: zero violations, exit 0. This supersedes historical-head artifact observations; no private document contents are published or supplied to a model/graph. This proves actual-file local acceptance, not hosted workflow adoption.

    Unapplied source and executable pytest candidate
    --- a/scripts/ci/pingora_edge_policy.py
    +++ b/scripts/ci/pingora_edge_policy.py
    @@ -11,10 +11,12 @@
     
     import argparse
     import base64
    +import io
     import json
     import os
     import re
     import sys
    +import zipfile
     import zlib
     from dataclasses import dataclass
     from pathlib import PurePosixPath
    @@ -40,6 +42,7 @@
     # (this org's own "attach the relevant paper PDF" convention) for a reason
     # that has nothing to do with the Nginx runtime policy this module enforces.
     BINARY_DOCUMENT_MAGIC = {
    +    ".hwpx": (b"PK\x03\x04",),
         ".pdf": (b"%PDF-",),
         ".png": (b"\x89PNG\r\n\x1a\n",),
     }
    @@ -229,7 +232,7 @@
         pure = PurePosixPath(changed.path)
         return (
             pure.suffix.lower() in BINARY_DOCUMENT_MAGIC
    -        and _is_known_documentation_path(pure)
    +        and (_is_known_documentation_path(pure) or (pure.suffix.lower() == ".hwpx" and "evidence" in (part.lower() for part in pure.parts)))
             and _runtime_path_rule(changed.path) is None
         )
     
    @@ -453,7 +456,46 @@
         suffix = PurePosixPath(changed.path).suffix.lower()
         if suffix == ".png":
             return _is_complete_png(raw)
    +    if suffix == ".hwpx":
    +        return _is_complete_hwpx(raw)
         return raw.startswith(BINARY_DOCUMENT_MAGIC[suffix])
    +
    +
    +def _is_complete_hwpx(raw: bytes) -> bool:
    +    """Confirm a bounded HWPX container without extracting document content.
    +
    +    Require an unprefixed ZIP, its exact end record, unique members, and the
    +    stored HWPX MIME marker plus an unencrypted package manifest. This is
    +    format evidence, not XML document validation or malware inspection.
    +    """
    +    if not raw.startswith(BINARY_DOCUMENT_MAGIC[".hwpx"][0]):
    +        return False
    +    try:
    +        with zipfile.ZipFile(io.BytesIO(raw)) as archive:
    +            archive_entries = archive.infolist()
    +            member_names = [member_info.filename for member_info in archive_entries]
    +            end_offset = len(raw) - 22 - len(archive.comment)
    +            if end_offset < 0 or raw[end_offset:end_offset + 4] != b"PK\x05\x06":
    +                return False
    +            if int.from_bytes(raw[end_offset + 20:end_offset + 22], "little") != len(archive.comment):
    +                return False
    +            if not archive_entries or archive_entries[0].header_offset != 0:
    +                return False
    +            if member_names[0] != "mimetype" or len(member_names) != len(set(member_names)):
    +                return False
    +            mimetype_info = archive.getinfo("mimetype")
    +            manifest_info = archive.getinfo("Contents/content.hpf")
    +            expected_mimetype = b"application/hwp+zip"
    +            if mimetype_info.flag_bits & 1 or manifest_info.flag_bits & 1:
    +                return False
    +            if mimetype_info.compress_type != zipfile.ZIP_STORED or mimetype_info.file_size != len(expected_mimetype):
    +                return False
    +            if manifest_info.is_dir() or manifest_info.file_size == 0:
    +                return False
    +            with archive.open(mimetype_info) as mimetype_stream:
    +                return mimetype_stream.read(len(expected_mimetype) + 1) == expected_mimetype
    +    except (KeyError, UnicodeError, OSError, ValueError, NotImplementedError, zipfile.BadZipFile):
    +        return False
     
     
     def _png_unfilter_row(filtered: bytes, previous: bytes, filter_type: int, bytes_per_pixel: int) -> bytes:
    --- /dev/null
    +++ b/tests/test_pingora_hwpx_evidence.py
    @@ -0,0 +1,104 @@
    +"""Exercise HWPX admission through the production policy boundary offline."""
    +import base64
    +import io
    +import zipfile
    +
    +import pytest
    +from tests.test_pingora_edge_policy import policy
    +
    +
    +def hwpx_archive(*, mime_value=b"application/hwp+zip", manifest_value=b"<package/>", compression_type=zipfile.ZIP_STORED):
    +    """Create a deterministic, non-sensitive format-boundary fixture."""
    +    archive_buffer = io.BytesIO()
    +    with zipfile.ZipFile(archive_buffer, "w") as archive_file:
    +        mime_info = zipfile.ZipInfo("mimetype")
    +        mime_info.compress_type = compression_type
    +        archive_file.writestr(mime_info, mime_value)
    +        if manifest_value is not None:
    +            archive_file.writestr(zipfile.ZipInfo("Contents/content.hpf"), manifest_value)
    +    return archive_buffer.getvalue()
    +
    +
    +def evaluate_bytes(file_path, file_bytes, *, patch_value=None, file_status="added"):
    +    """Supply only in-memory GitHub metadata and exact-head content."""
    +    def open_evidence(request_url, request_token):
    +        assert request_token == "offline-fixture"
    +        if "/files?" in request_url:
    +            file_entry = {"filename": file_path, "status": file_status}
    +            if patch_value is not None:
    +                file_entry["patch"] = patch_value
    +            return [file_entry]
    +        assert "?ref=" + "a" * 40 in request_url
    +        return {"type": "file", "encoding": "base64", "size": len(file_bytes),
    +                "content": base64.b64encode(file_bytes).decode("ascii")}
    +    return policy.evaluate_pull_request(api_url="https://api.github.com",
    +        repository="ContextualWisdomLab/example", pull_request=2116, head_sha="a" * 40,
    +        event_action="opened", token="offline-fixture", opener=open_evidence)
    +
    +
    +@pytest.mark.parametrize("file_path", ["evidence/reviewer_response_draft.hwpx", "docs/paper.hwpx", "Evidence/PAPER.HWPX"])
    +def test_valid_hwpx_is_admitted_at_document_and_consumer_paths(file_path):
    +    """Recognize HWPX at the exact consumer directory, without renaming it."""
    +    assert evaluate_bytes(file_path, hwpx_archive()) == ()
    +
    +
    +@pytest.mark.parametrize("file_bytes", [
    +    b"PK\x03\x04\xff", hwpx_archive()[:-10],
    +    b"#!/bin/sh\ncat /etc/nginx/nginx.conf\n" + hwpx_archive(),
    +    hwpx_archive() + b"\ncat /etc/nginx/nginx.conf\n",
    +    hwpx_archive(mime_value=b"application/zip"),
    +    hwpx_archive(manifest_value=None), hwpx_archive(manifest_value=b""),
    +    hwpx_archive(compression_type=zipfile.ZIP_DEFLATED),
    +])
    +def test_malformed_or_disguised_archive_is_not_exempt(file_bytes):
    +    """Unsupported format evidence fails closed instead of bypassing scanning."""
    +    with pytest.raises(policy.PolicyError):
    +        evaluate_bytes("evidence/reviewer_response_draft.hwpx", file_bytes)
    +
    +
    +@pytest.mark.parametrize("file_path", ["evidence/paper.hwpx", "docs/paper.hwpx", "scripts/paper.hwpx"])
    +@pytest.mark.parametrize("patch_value", [None, "+cat /etc/nginx/nginx.conf"])
    +def test_text_renamed_to_hwpx_preserves_runtime_scan(file_path, patch_value):
    +    """Neither the suffix nor patch absence hides actual Nginx runtime text."""
    +    violations = evaluate_bytes(file_path, b"cat /etc/nginx/nginx.conf\n", patch_value=patch_value)
    +    assert [violation.rule for violation in violations] == ["nginx_runtime_path"]
    +
    +
    +def test_hwpx_does_not_expand_text_document_exemptions():
    +    """The consumer evidence directory does not exempt ordinary configuration."""
    +    violations = evaluate_bytes("evidence/config.txt", b"cat /etc/nginx/nginx.conf\n")
    +    assert [violation.rule for violation in violations] == ["nginx_runtime_path"]
    +
    +
    +def test_hwpx_in_runtime_path_remains_unavailable():
    +    """A format exception cannot exempt an active runtime location."""
    +    with pytest.raises(policy.PolicyError):
    +        evaluate_bytes("docs/nginx/paper.hwpx", hwpx_archive())
    +
    +
    +def test_removed_hwpx_does_not_load_deleted_content():
    +    """Deletion does not require unavailable final-head bytes."""
    +    assert evaluate_bytes("evidence/paper.hwpx", b"", file_status="removed") == ()
    +
    +
    +def test_hwpx_rejects_inconsistent_comment_and_shifted_zip():
    +    """EOCD declarations and member offsets must bind to the actual bytes."""
    +    archive_bytes = hwpx_archive()
    +    invalid_comment = archive_bytes[:-2] + b"\x01\x00"
    +    for file_bytes in (invalid_comment, b"PK\x03\x04" + archive_bytes):
    +        with pytest.raises(policy.PolicyError):
    +            evaluate_bytes("evidence/paper.hwpx", file_bytes)
    +
    +
    +def test_hwpx_rejects_nonfirst_marker_and_encrypted_manifest():
    +    """A named marker alone cannot admit a reordered or encrypted package."""
    +    archive_buffer = io.BytesIO()
    +    with zipfile.ZipFile(archive_buffer, "w") as archive_file:
    +        archive_file.writestr(zipfile.ZipInfo("Contents/content.hpf"), b"<package/>")
    +        archive_file.writestr(zipfile.ZipInfo("mimetype"), b"application/hwp+zip")
    +    encrypted_bytes = bytearray(hwpx_archive())
    +    manifest_header = encrypted_bytes.rfind(b"PK\x01\x02")
    +    encrypted_bytes[manifest_header + 8] |= 1
    +    for file_bytes in (archive_buffer.getvalue(), bytes(encrypted_bytes)):
    +        with pytest.raises(policy.PolicyError):
    +            evaluate_bytes("evidence/paper.hwpx", file_bytes)
    Additional PR1946-dependent HWPX blob integration regression

    RED on main-based HWPX candidate without PR1946: 2 failed (size contract before blob retrieval). GREEN with PR1946: 2 passed. Keep this test with the combined implementation; it deliberately requires the blob retrieval dependency. AST-only graph refreshed for all four code files: 243 nodes; clustered graph SHA256 45e1b036f856b9a3db8c30ec1d88bc40c34b6c9c48515f96065d1972a4c31c26. Inferred same-name callback edges are not runtime proof.

    Save as tests/test_hwpx_blob_integration.py:

    """Cross-boundary HWPX regression for #2116 and PR1946 blob retrieval."""
    
    import base64
    import io
    import zipfile
    
    import pytest
    
    from tests.test_pingora_edge_policy import policy
    from tests.test_pingora_hwpx_evidence import hwpx_archive
    
    
    BLOB_SHA = "d" * 40
    OTHER_SHA = "e" * 40
    HEAD_SHA = "a" * 40
    REPOSITORY = "ContextualWisdomLab/example"
    API_URL = "https://api.github.test"
    PATH = "evidence/reviewer_response_draft.hwpx"
    
    
    def oversized_hwpx_archive() -> bytes:
        """Build a real HWPX ZIP over the Contents inline ceiling."""
    
        source_archive = hwpx_archive()
        output_buffer = io.BytesIO()
        with zipfile.ZipFile(io.BytesIO(source_archive), "r") as source_zip:
            with zipfile.ZipFile(output_buffer, "w") as target_zip:
                for member_info in source_zip.infolist():
                    target_zip.writestr(member_info, source_zip.read(member_info.filename))
                target_zip.writestr("BinData/large.bin", b"\0" * (policy.MAX_FILE_BYTES + 1))
        archive_bytes = output_buffer.getvalue()
        assert len(archive_bytes) > policy.MAX_FILE_BYTES
        return archive_bytes
    
    
    def blob_response(blob_bytes: bytes, blob_identifier: str) -> dict[str, object]:
        """Build GitHub's wrapped base64 Git Blobs response."""
        encoded = base64.b64encode(blob_bytes).decode("ascii")
        return {
            "sha": blob_identifier,
            "size": len(blob_bytes),
            "encoding": "base64",
            "content": "\n".join(encoded[i : i + 60] for i in range(0, len(encoded), 60)) + "\n",
        }
    
    
    @pytest.mark.parametrize("returned_sha, expected_error", [(BLOB_SHA, None), (OTHER_SHA, "different blob")])
    def test_oversized_hwpx_uses_exact_contents_blob_and_binds_sha(returned_sha, expected_error):
        """A valid oversized consumer artifact passes only with its named blob."""
    
        archive_bytes = oversized_hwpx_archive()
        requested_urls: list[str] = []
    
        def evidence_opener(request_url: str, request_token: str) -> object:
            assert request_token == "offline-fixture"
            requested_urls.append(request_url)
            if "/pulls/2116/files" in request_url:
                return [{"filename": PATH, "status": "added"}]
            if "/contents/" in request_url:
                assert request_url == f"{API_URL}/repos/{REPOSITORY}/contents/{PATH}?ref={HEAD_SHA}"
                return {"type": "file", "encoding": "none", "size": len(archive_bytes), "content": "", "sha": BLOB_SHA}
            assert request_url == f"{API_URL}/repos/{REPOSITORY}/git/blobs/{BLOB_SHA}"
            return blob_response(archive_bytes, returned_sha)
    
        def evaluate_candidate() -> tuple[object, ...]:
            """Evaluate the synthetic PR through the production boundary."""
            return policy.evaluate_pull_request(
            api_url=API_URL, repository=REPOSITORY, pull_request=2116,
            head_sha=HEAD_SHA, event_action="opened", token="offline-fixture", opener=evidence_opener,
            )
        if expected_error:
            with pytest.raises(policy.PolicyError, match=expected_error):
                evaluate_candidate()
        else:
            assert evaluate_candidate() == ()
        assert requested_urls == [
            f"{API_URL}/repos/{REPOSITORY}/pulls/2116/files?per_page=100&page=1",
            f"{API_URL}/repos/{REPOSITORY}/contents/{PATH}?ref={HEAD_SHA}",
            f"{API_URL}/repos/{REPOSITORY}/git/blobs/{BLOB_SHA}",
        ]
  6. seonghobae commented on Sep 13, 2026

    @seonghobae
    ContributorAuthor

    The validated candidate above is now published as #2144 (branch fix/pingora-hwpx-evidence-2116, head 81a2cc61ae898974f8294a6e0c3c665857021ba9, based on main fb17ef556f94f673234aa557254ae52779e9a7b0). It carries the main-based source + tests/test_pingora_hwpx_evidence.py only; the PR1946-dependent blob-integration regression is deliberately left out until #1946 lands.

    Branch evidence: RED 3 failed / 19 passed with only the test file applied; GREEN 90 passed across the three Pingora test modules; pingora_edge_policy.py branch coverage 100% (388 stmts, 174 branches); interrogate 100%; full suite 3061 passed, 1 pre-existing LLVM-19 host-tool skip, no warnings.

    Hosted acceptance remains: a newly loaded central SHA must re-run late-life-anxiety-reanalysis PR #10's exact head bootstrap. This issue stays open until that is observed.

  7. seonghobae commented on Sep 13, 2026

    @seonghobae
    ContributorAuthor

    Re-verification status, 2026-09-13 09:10Z — not closing yet, consumer evidence is still missing for the HWPX condition specifically:

    • Central fix is on protected main: fix(pingora): admit bounded HWPX evidence documents without UTF-8 decoding #2144 merged at 04:38Z (64f483db9), tests/test_pingora_hwpx_evidence.py present.
    • First consumer run on that exact central SHA: late-life-anxiety-reanalysis PR No UX changes required (No UI Codebase) #10, Required OpenCode Review run 34748173771 (08:38Z, WORKFLOW_SHA/TRUSTED_SOURCE_REF = 64f483db9…). It still fails at Enforce Cloudflare Pingora edge policy, but on a different file: Runtime policy candidate evidence/manuscript_revision_pages/page_001.png is not valid UTF-8. The policy raises on the first non-admitted candidate, and that PNG path sorts before evidence/reviewer_response_draft.hwpx, so this run neither proves nor disproves the HWPX admission on the consumer head.
    • The PNG case is already owned by open PR fix: enforce Pingora edge policy for evidence and runtime forms #2149 ("fix: admit validated publication evidence PNGs"); no second lane opened here.

    Closure condition for this issue: a consumer run on a central main that includes both #2144 and #2149's successor (or any run where the policy step passes/fails past the HWPX candidate) shows the HWPX file admitted. Until then the local RED→GREEN in #2144 is the only evidence.

  8. seonghobae commented on Sep 14, 2026

    @seonghobae
    ContributorAuthor

    Evidence separating the two conditions, 2026-09-14 05:2xZ (central main@7f0702938, which contains #2144's 64f483db9).

    A coordinator session for the consumer repo late-life-anxiety-reanalysis reported being blocked on committing .hwpx review evidence. That premise does not match the code on main. Read-only probe of scripts/ci/pingora_edge_policy.py at origin/main, calling _is_binary_documentation_asset directly with patch_available=False:

    candidate path admitted as binary documentation asset
    evidence/reviewer_response_draft.hwpx True
    evidence/revised_manuscript.hwpx True
    evidence/manuscript_revision_pages/page_001.png False
    docs/evidence/page_001.png True

    So #2144's admission rule (pingora_edge_policy.py:235: suffix in BINARY_DOCUMENT_MAGIC and (_is_known_documentation_path or .hwpx with an evidence path part)) does admit HWPX under evidence/ today. The PNG fails because DOCUMENTATION_DIRECTORIES is {doc, docs, documentation} (:52) and evidence is not in it, so a PNG outside a docs path part gets no exemption and falls through to the UTF-8 content scan.

    This does not by itself close this issue — the stated closure condition is still a consumer run where the policy step reaches and admits the HWPX candidate, and the policy raises on the first non-admitted candidate (the PNG sorts first). It does mean the remaining work is entirely the PNG case in #2149, not the HWPX case here.

    Consumer-side note for anyone blocked right now: a publication figure committed under a path containing docs/ (e.g. docs/evidence/manuscript_revision_pages/page_001.png) is admitted by the current rule with no central change. That is the policy's existing documentation-asset convention, not a suppression; the general evidence/**/*.png case remains #2149's to land.

  9. seonghobae commented on Sep 14, 2026

    @seonghobae
    ContributorAuthor

    Progress toward this issue's stated closure condition: PR #2149 (the PNG lane that blocks the consumer run before it reaches the HWPX candidate) is restacked on current main at 18f6baebd and verified — 110 passed in tests/test_pingora_edge_policy.py/tests/test_pingora_hwpx_evidence.py, and the admission prefilter now returns True for both evidence/manuscript_revision_pages/page_001.png and evidence/reviewer_response_draft.hwpx while runtime forms (src/runtime/nginx.conf, evidence/startup.sh) stay blocked.

    Once #2149 merges, the consumer re-run on late-life-anxiety-reanalysis PR #10 becomes the missing evidence this issue asks for: the policy step will pass the PNG candidate and reach the .hwpx one, which is the first run able to confirm or refute HWPX admission on a consumer head. The session coordinating that repository is standing by to re-run and report from the consumer side.

    🤖 Addressed by Claude Code

  10. seonghobae commented on Sep 14, 2026

    @seonghobae
    ContributorAuthor

    Correction/extension to my previous comment — the docs/ path convention covers .png and .pdf only, not .svg. Verified against origin/main:

    candidate (with a docs/ path part) _is_binary_documentation_asset _is_documentation_or_source_fixture
    docs/figures/fig1.png True False
    docs/figures/fig1.pdf True False
    docs/figures/fig1.svg False False

    BINARY_DOCUMENT_MAGIC is {.hwpx, .pdf, .png} (:44-48) and DOCUMENT_SUFFIXES is {.md, .mdx, .rst, .adoc, .txt} (:34); .svg is in neither, so it receives no exemption anywhere.

    An SVG currently passes only incidentally: _needs_content_scan (:645-661) returns False when patch_available is true and the path matches no runtime rule, so a small SVG is never loaded. GitHub omits patch for very large text files too (this module's own comment at :437-443 says so), and in that case the SVG is loaded; over the Contents API ceiling that raises ContentSizeExceededError, which is caught only inside _binary_documentation_evidence_confirms (:454) and only forgiven for .pdf (:455). A non-asset SVG never reaches that handler, so the error propagates and fails the check.

    Practical consequence: .svg admission is size-dependent and therefore unstable as a review-evidence format. Page renders should be committed as .png or .pdf. This is adjacent to #2149's scope (that PR owns the general evidence/** image case); recording it here so the constraint is in the repo rather than only in session messages.

  11. seonghobae commented on Sep 17, 2026

    @seonghobae
    ContributorAuthor

    Triage (2026-09-18): close-as-done candidate

    Unique delta appears on protected main via merged #2144 (bounded HWPX admission). Doctoring: docs/doctoring/pingora-hwpx-evidence-admission.md.

    Ranked backlog: #2251. Spot-check one consumer head with evidence/*.hwpx before closing.

  12. seonghobae commented on Sep 17, 2026

    @seonghobae
    ContributorAuthor

    Closing after spot-check: unique valid delta is on protected main.

    Merged fix: #2144 (merged 2026-09-13, 64f483db9d052322c65bcdf1675d66138156f306)

    Tree evidence on origin/main:

    • scripts/ci/pingora_edge_policy.py admits bounded .hwpx (BINARY_DOCUMENT_MAGIC, _is_complete_hwpx, evidence-path gate)
    • docs/doctoring/pingora-hwpx-evidence-admission.md pins the #2116 incident and repair

    Verified with git grep on origin/main (not redundancy alone).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: criticalImmediate blocker, P0, urgent deadlock, or critical incident

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions