Skip to content

Proof: замкнуть single-operation replay - #511

Closed
lemone112 wants to merge 11 commits into
agent/mpfi-source-materializationfrom
agent/mpfi-build-closure
Closed

Proof: замкнуть single-operation replay#511
lemone112 wants to merge 11 commits into
agent/mpfi-source-materializationfrom
agent/mpfi-build-closure

Conversation

@lemone112

@lemone112 lemone112 commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Срез

  • Общая provenance-граница создаёт один owned source-operation snapshot для Arb и MPFI: lock, replayed archives и file-byte materialization принадлежат одной операции.
  • Arb receipt повторно выводит source → BUILD → RUN только из этого snapshot; public evidence не получает capability или operation наружу.
  • Replay verifier фиксирует raw coordinates и требует согласованности всех используемых identity-cache с заново восстановленным canonical wire до source replay. Подмена cache с «починкой» во время replay отклоняется без второй materialization.
  • Каноническая source-coordinate сериализация теперь имеет один внутренний leaf; transport identity больше не зависит от изменяемого enum payload.
  • Не вводятся compatibility aliases, клиентская семантика или новые runtime fallback.

Причина

Замороженные Python-объекты всё ещё могут быть испорчены через __dict__. Ранее можно было отравить вложенный cached identity, восстановить его во время source replay и получить ложное принятие evidence. Также source-coordinate wire существовал в нескольких расходящихся копиях.

Проверка

  • Proof fast gate: 231 тест в normal и optimized режимах; exact manifest: 11 объявленных environment-skips.
  • Shared proof suite: 177 тестов в normal и optimized режимах; 1 объявленный environment-skip.
  • Shared build-contract: 42 теста в normal и optimized режимах.
  • Характеризационные, mutation и hostile tests покрывают replacement, raw-field repair, cached-identity repair, source replay и single-materialization.
  • git diff --check чист; генерируемые __pycache__ удалены.

Ограничение доставки

Локальные Python-проверки пройдены. Rust workspace gate также пройден локально: cargo test --workspace --locked, форматирование, clippy с -D warnings и intra-doc проверка. Реальный disposable VM/Docker gate не заявлен пройденным и остаётся внешним CI-gate; PR намеренно draft.

Summary by CodeRabbit

  • Новые возможности

    • Добавлена надёжная подготовка запечатанных исходных данных для MPFI с проверкой целостности, происхождения и соответствия разрешённым источникам.
    • Введены детерминированные снимки операций сборки для согласованной проверки исходных данных и результатов.
    • Поддержаны дополнительные режимы файлов, включая 0700.
  • Исправления

    • Усилена защита от подмены, изменения или повторного использования исходных данных во время сборки и проверки.
    • Добавлена проверка лимитов до формирования архивов и улучшена диагностика ошибок входных данных.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 711c799e-949b-44e9-9430-9b26a72c0652

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

PR добавляет каноническое MPFI source sealing, typed boundary errors и operation-owned source snapshots. Arb pipeline и receipt replay используют единый detached snapshot. Source replay разделяет metadata replay и materialization. Proof fast gate включает MPFI-контракты.

Changes

Source replay и snapshots

Layer / File(s) Summary
Канонический source replay и snapshots
proof/region/v1/provenance.py, proof/region/v1/region_proof_protocol.py, proof/region/v1/tests/test_source_lock.py
Replay повторно проверяет locks, archives, manifests и identities. Closure возвращает operation-owned snapshots. Тесты покрывают mutation, counterfeit coordinates и отсутствие materialization при metadata replay.

MPFI sealed input

Layer / File(s) Summary
MPFI sealed source input
proof/region/v1/mpfi/*, proof/region/v1/build/input.py, proof/region/v1/build/transport.py, proof/region/v1/tests/test_mpfi_input.py, proof/region/v1/tests/test_mpfi_source_lock.py
MPFI input канонизирует admitted sources и limits, материализует role-based closure в USTAR, сохраняет binding identity и возвращает typed errors. USTAR принимает mode 0700. Transport policy использует фиксированное wire-представление DockerUserModeV1.

Arb operation snapshot

Layer / File(s) Summary
Arb operation snapshot и build flow
proof/region/v1/arb/pipeline.py, proof/region/v1/region_proof_protocol.py, proof/region/v1/arb/tests/test_pipeline.py, proof/region/v1/arb/tests/test_transport.py
Pipeline создаёт один detached operation snapshot. Input sealing, comparator derivation, FLINT partition и BUILD используют его без повторного чтения caller-owned данных. Тесты проверяют reentrancy, retained capabilities и host-trust serialization.

Receipt replay

Layer / File(s) Summary
Receipt identity и evidence replay
proof/region/v1/arb/receipt.py, proof/region/v1/arb/tests/test_receipt.py, proof/region/v1/arb/tests/test_build_identity_v2.py
Verifier повторно выводит source/build identities и проверяет стабильность request, BUILD observation, comparator data и cached identities. Replay отклоняет forged или изменённые evidence coordinates.

Proof fast gate

Layer / File(s) Summary
Общий Proof fast gate
proof/region/v1/arb/tests/gate.py, proof/region/v1/arb/tests/test_build_recipe.py, proof/region/v1/tests/test_build.py
Fast gate обнаруживает общие test suites, проверяет уникальность их включения и выполняет MPFI suite без skipped, failures или errors. Inventory pins обновлены.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Controller
  participant PipelineOperationSnapshot
  participant SourceReplay
  participant MPFISealing
  participant ReceiptVerifier
  Controller->>PipelineOperationSnapshot: создать detached operation snapshot
  PipelineOperationSnapshot->>SourceReplay: replay source closure
  SourceReplay-->>PipelineOperationSnapshot: owned locks, archives и materializations
  PipelineOperationSnapshot->>MPFISealing: передать admitted sources и limits
  MPFISealing-->>Controller: sealed input и binding identity
  ReceiptVerifier->>PipelineOperationSnapshot: повторно получить snapshot-bound coordinates
  ReceiptVerifier->>SourceReplay: повторно проверить source closure
  SourceReplay-->>ReceiptVerifier: validated replay data
  ReceiptVerifier-->>Controller: принять или отклонить evidence
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок связан с изменениями: PR действительно вводит единый снимок операции и замыкает replay, но основная цель также включает sealing MPFI source input.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/mpfi-build-closure

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Проверьте текущую голову 93c12a7d3ff195253c23498a8913aae56f120eb5. Важны: capability boundary, ошибка/ресурсные границы, exact-byte USTAR, отсутствие зависимости MPFI input от build/run/receipt.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== HEAD =='
git rev-parse HEAD
git status --short
git show -s --format='%H%n%P%n%s' 93c12a7d3ff195253c23498a8913aae56f120eb5

echo '== merge base / changed files =='
base="$(git merge-base 93c12a7d3ff195253c23498a8913aae56f120eb5 origin/main 2>/dev/null || true)"
if [ -n "$base" ]; then
  echo "BASE=$base"
  git diff --stat "$base" 93c12a7d3ff195253c23498a8913aae56f120eb5
  git diff --name-status "$base" 93c12a7d3ff195253c23498a8913aae56f120eb5
else
  echo 'No origin/main merge base available; showing commit files.'
  git show --stat --oneline --no-renames 93c12a7d3ff195253c23498a8913aae56f120eb5
fi

echo '== candidate files =='
fd -HI -t f . | rg -i '(mpfi|sealed.?input|ustar|archive|closure|proof)'

echo '== focused symbols =='
rg -n -i -C 3 '(SealedInputV1|MPFI|MPFR|USTAR|ustar|materializ|resource.{0,30}limit|limit.{0,30}resource|Build|Receipt)' \
  -g '!node_modules' -g '!dist' -g '!build' .

Length of output: 199803


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit='93c12a7d3ff195253c23498a8913aae56f120eb5'
echo '== commit and files =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$commit"
git show --format='' --name-status --find-renames "$commit"
echo '== patch: proof files =='
git show --format='' --find-renames "$commit" -- proof/region/v1/arb | sed -n '1,2600p'

echo '== module outlines =='
for f in \
  proof/region/v1/arb/build/input.py \
  proof/region/v1/arb/pipeline.py \
  proof/region/v1/arb/provenance.py \
  proof/region/v1/arb/receipt.py \
  proof/region/v1/arb/build/transport.py
do
  if [ -f "$f" ]; then
    echo "--- $f"
    ast-grep outline "$f" --items all 2>/dev/null || true
  fi
done

echo '== input.py =='
cat -n proof/region/v1/arb/build/input.py | sed -n '1,780p'

echo '== pipeline sealing and imports =='
rg -n -C 8 '(^import |^from |def _seal_build_input_bundle_v1|SealedInputV1|canonical_ustar_v1|materialize_admitted_source_files_v1|MPFI)' \
  proof/region/v1/arb/pipeline.py

echo '== provenance materialization and source roles =='
rg -n -C 8 '(^import |^from |def materialize_admitted_source_files_v1|def admit|MPFI|archive|role|Source)' \
  proof/region/v1/arb/provenance.py

echo '== prohibited dependency search in input/provenance =='
rg -n -i -C 3 '(import .*build|from .*build|import .*receipt|from .*receipt|import .*executor|from .*executor|import .*pipeline|from .*pipeline|run)' \
  proof/region/v1/arb/build/input.py proof/region/v1/arb/provenance.py

Length of output: 12152


🏁 Script executed:

#!/bin/bash
set -euo pipefail

commit='93c12a7d3ff195253c23498a8913aae56f120eb5'

echo '== complete commit patch =='
git diff --find-renames "${commit}^" "$commit" -- \
  proof/region/v1/build/input.py \
  proof/region/v1/mpfi/__init__.py \
  proof/region/v1/mpfi/input.py \
  proof/region/v1/tests/test_mpfi_input.py \
  proof/region/v1/arb/tests/test_transport.py \
  proof/region/v1/PROTOCOL.md

echo '== shared input module outline and source =='
ast-grep outline proof/region/v1/build/input.py --items all 2>/dev/null || true
cat -n proof/region/v1/build/input.py | sed -n '1,900p'

echo '== MPFI modules outline and source =='
for f in proof/region/v1/mpfi/__init__.py proof/region/v1/mpfi/input.py proof/region/v1/tests/test_mpfi_input.py; do
  echo "--- $f"
  ast-grep outline "$f" --items all 2>/dev/null || true
  cat -n "$f" | sed -n '1,1200p'
done

echo '== imports and forbidden coupling =='
rg -n -C 3 '^(import|from) |(arb|pipeline|receipt|executor|transport|run|build)' \
  proof/region/v1/mpfi proof/region/v1/build/input.py

echo '== use sites of MPFI sealing and shared primitives =='
rg -n -C 5 '(seal_mpfi|MPFI.*[Ii]nput|mpfi.*[Ii]nput|canonical_ustar_v1|SealedInputV1|CanonicalInputLimitsV1)' \
  proof/region/v1 -g '*.py'

Length of output: 176299


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== package initializers and direct imports =='
for f in \
  proof/region/v1/build/__init__.py \
  proof/region/v1/mpfi/__init__.py \
  proof/region/v1/build/input.py \
  proof/region/v1/provenance.py
do
  if [ -f "$f" ]; then
    echo "--- $f"
    sed -n '1,180p' "$f"
  fi
done

echo '== test runners and inventories =='
fd -HI -t f 'gate\.py|native_gate\.py|test_build\.py|test_.*\.py' proof/region/v1 | sort
rg -n -C 5 '(test_mpfi_input|unittest\.discover|loadTestsFrom|TEST_COUNT|inventory|skip|test_.*\.py)' \
  proof/region/v1/tests proof/region/v1/arb/tests \
  -g '*.py'

echo '== static import graph from shared input and MPFI input =='
python3 - <<'PY'
import ast
from pathlib import Path

root = Path("proof/region/v1")
for relative in ("build/input.py", "mpfi/input.py", "provenance.py"):
    path = root / relative
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=str(path))
    imports = []
    for node in ast.walk(tree):
        if isinstance(node, ast.Import):
            imports.extend(alias.name for alias in node.names)
        elif isinstance(node, ast.ImportFrom):
            imports.append(node.module or "<relative>")
    print(f"{path}: {', '.join(imports)}")
PY

echo '== MPFI test references in current commit and parent =='
git grep -n 'test_mpfi_input\|MpfiSourceInputTests' 93c12a7d3ff195253c23498a8913aae56f120eb5 -- proof/region/v1 || true

Length of output: 47787


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== workflow and documented test commands =='
fd -HI -t f .github README.md CONTRIBUTING.md Makefile justfile 2>/dev/null | sort
rg -n -i -C 4 \
  '(proof/region/v1|test_mpfi_input|unittest|pytest|arb/tests/gate\.py|test_executor\.py|python3)' \
  .github README.md CONTRIBUTING.md Makefile justfile proof \
  -g '*.yml' -g '*.yaml' -g '*.md' -g 'Makefile' -g 'justfile' -g '*.sh' -g '*.py' \
  2>/dev/null

echo '== all explicit load/discover calls for shared proof tests =='
rg -n -C 5 \
  '(discover\(|loadTestsFrom|test_mpfi_input\.py|proof/region/v1/tests)' \
  . -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g 'Makefile' -g 'justfile' \
  -g '!node_modules' -g '!target' -g '!dist' -g '!build'

echo '== gate constants and parent comparison =='
sed -n '1,170p' proof/region/v1/arb/tests/gate.py
git diff "${commit:-93c12a7d3ff195253c23498a8913aae56f120eb5}^" \
  93c12a7d3ff195253c23498a8913aae56f120eb5 -- \
  .github proof/region/v1/arb/tests/gate.py proof/region/v1/tests/test_build.py \
  2>/dev/null || true

Length of output: 1405


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== repository root candidates =='
fd -HI -t f . | rg '(^|/)([^/]*\.(ya?ml|md|sh|py)|Makefile|justfile)$' | \
  rg -i '(^|/)(\.github/|readme|contributing|makefile|justfile|.*workflow|.*ci|.*test)' | \
  sort | sed -n '1,800p'

echo '== every source-level reference to the MPFI test or proof test directory =='
rg -n -i -C 5 \
  '(test_mpfi_input|proof/region/v1/tests|arb/tests/gate\.py|python3.*gate\.py|unittest.*discover|unittest\.discover|loadTestsFrom)' \
  . \
  -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g '*.md' -g 'Makefile' -g 'justfile' \
  -g '!node_modules' -g '!target' -g '!dist' -g '!build'

echo '== gate composition =='
sed -n '1,170p' proof/region/v1/arb/tests/gate.py
sed -n '1,330p' proof/region/v1/tests/test_build.py

Length of output: 25844


@lemone112: Нашёл одно замечание.

Тесты MPFI input не входят в обязательный gate.
proof/region/v1/arb/tests/gate.py на Line 78–80 обнаруживает в общей директории только test_executor.py. Новый контракт находится в proof/region/v1/tests/test_mpfi_input.py, и в repository нет отдельного CI entry point для него.

Из-за этого регрессия в MPFI capability boundary, resource limits или exact-byte USTAR может пройти обязательный Arb gate. Добавьте test_mpfi_input.py в exact inventory этого gate или создайте отдельный обязательный exact gate с закреплённым inventory.

Остальную целевую поверхность я проверил статически. mpfi/input.py не импортирует ARB pipeline, transport, executor или receipt. Общий build.input не содержит таких зависимостей. Режим 0700 сохраняется в USTAR bytes. Binding повторно допускает closure и связывает точные bytes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

lemone112 commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Новая точная голова 7e78a70d9e8f5650214e1b23f60ca203ef288b13 закрывает найденный пробел без MPFI→Arb coupling: engine-neutral exact inventory, outer oracle, anti-vacuum (removal / same-count replacement / skip / expectedFailure). Проверьте только этот инкремент.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='93c12a7d3ff195253c23498a8913aae56f120eb5'
head='7e78a70d9e8f5650214e1b23f60ca203ef288b13'

echo '== commits =='
git show -s --format='base=%H%nsubject=%s' "$base"
git show -s --format='head=%H%nparents=%P%nsubject=%s' "$head"
git merge-base --is-ancestor "$base" "$head" && echo 'base is ancestor of head'

echo '== incremental files =='
git diff --name-status --find-renames "$base" "$head"
echo '== incremental patch =='
git diff --find-renames --unified=80 "$base" "$head" -- proof/region/v1

echo '== outlines of changed Python files =='
git diff --name-only "$base" "$head" -- 'proof/region/v1/**/*.py' 'proof/region/v1/*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

echo '== gate, inventory, and oracle references =='
rg -n -C 8 \
  '(test_mpfi_input|exact.?inventory|inventory|outer.?oracle|expectedFailure|expected_failure|skip|TestLoader|loadTestsFrom|discover\(|gate\.py)' \
  proof/region/v1 -g '*.py'

echo '== static imports for modified proof modules =='
python3 - <<'PY'
import ast
import subprocess
from pathlib import Path

base = "93c12a7d3ff195253c23498a8913aae56f120eb5"
head = "7e78a70d9e8f5650214e1b23f60ca203ef288b13"
files = subprocess.check_output(
    ["git", "diff", "--name-only", base, head, "--", "proof/region/v1"],
    text=True,
).splitlines()
for name in files:
    path = Path(name)
    if path.suffix != ".py" or not path.is_file():
        continue
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    imports = []
    for node in ast.walk(tree):
        if isinstance(node, ast.Import):
            imports.extend(a.name for a in node.names)
        elif isinstance(node, ast.ImportFrom):
            imports.append("." * node.level + (node.module or ""))
    print(f"{name}: {', '.join(imports)}")
PY

echo '== prohibited MPFI-to-Arb imports =='
rg -n -P -C 3 \
  '^\s*(from|import)\s+(proof\.region\.v1\.arb|arb(?:\.|\s|$))' \
  proof/region/v1/mpfi proof/region/v1/tests/test_mpfi_input.py -g '*.py' || true

echo '== relevant execution/documentation entry points changed or referencing gates =='
rg -n -C 5 \
  '(arb/tests/gate\.py|test_mpfi_input|exact.?inventory|outer.?oracle)' \
  .github proof README.md Makefile justfile \
  -g '*.yml' -g '*.yaml' -g '*.md' -g 'Makefile' -g 'justfile' -g '*.py' \
  2>/dev/null || true

Length of output: 89987


@lemone112: Нашёл одно замечание.

Новый exact inventory не выполняется обязательным CI gate.
proof/region/v1/tests/gate.py и outer oracle в proof/region/v1/tests/test_build.py существуют, но .github/workflows/arb.yml запускает только proof/region/v1/arb/tests/gate.py. Этот gate на Line 78–80 по-прежнему обнаруживает только test_executor.py из shared test directory.

Следовательно, удаление, same-count replacement, skip или expectedFailure в test_mpfi_input.py не изменят inventory обязательного Arb gate. Новые anti-vacuum проверки также не будут выполнены.

Добавьте обязательную CI точку входа для proof/region/v1/tests/gate.py, либо включите весь shared exact suite в уже обязательный gate без создания MPFI→Arb зависимости.

Я не нашёл MPFI→Arb import coupling в этом инкременте.

You are interacting with an AI system.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

old='93c12a7d3ff195253c23498a8913aae56f120eb5'
new='7e78a7006ddf3e614d4d4d5d0a5de3751e1654cf'

echo '== Commit range =='
git rev-parse "$old"
git rev-parse "$new"
git log --oneline --decorate "${old}..${new}"
echo '== Changed files =='
git diff --name-status --find-renames "$old" "$new"
echo '== Incremental patch =='
git diff --find-renames --unified=80 "$old" "$new"

echo '== Outline of changed Python files =='
git diff --name-only "$old" "$new" -- '*.py' | while IFS= read -r f; do
  echo "--- $f"
  ast-grep outline "$f" --items all 2>/dev/null || true
done

echo '== Focused gate and inventory references =='
rg -n -C 12 \
  '(inventory|outer.oracle|oracle|anti.vacuum|expectedFailure|skip(Test|If)?|test_mpfi_input|test_executor|discover\(|loadTestsFrom|unittest)' \
  proof/region/v1 \
  -g '*.py'

echo '== MPFI import boundary after increment =='
for f in proof/region/v1/mpfi/__init__.py proof/region/v1/mpfi/input.py; do
  if [ -f "$f" ]; then
    echo "--- $f"
    sed -n '1,260p' "$f"
  fi
done

Length of output: 1739


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Checked-out revision =='
git rev-parse HEAD
git status --short
echo '== Local and remote refs relevant to PR 511 =='
git branch -a --contains HEAD || true
git show-ref | rg '(^|/)(511|pull|HEAD|main)$|refs/pull/511|93c12a7d3ff195253c23498a8913aae56f120eb5|7e78a7006ddf3e614d4d4d5d0a5de3751e1654cf' || true

echo '== Fetch GitHub pull-request head into a temporary remote-tracking ref =='
git fetch --no-tags origin '+refs/pull/511/head:refs/remotes/origin/pr-511-head' || true

echo '== Candidate PR head =='
if git rev-parse --verify --quiet refs/remotes/origin/pr-511-head >/dev/null; then
  git rev-parse refs/remotes/origin/pr-511-head
  git show -s --format='commit=%H%nparents=%P%nsubject=%s' refs/remotes/origin/pr-511-head
  git merge-base --is-ancestor 93c12a7d3ff195253c23498a8913aae56f120eb5 refs/remotes/origin/pr-511-head && echo 'old commit is an ancestor' || echo 'old commit is not an ancestor'
  git diff --name-status --find-renames 93c12a7d3ff195253c23498a8913aae56f120eb5 refs/remotes/origin/pr-511-head
else
  echo 'PR head ref is unavailable'
fi

Length of output: 2068


🏁 Script executed:

#!/bin/bash
set -euo pipefail

old='93c12a7d3ff195253c23498a8913aae56f120eb5'
new='7e78a70d9e8f5650214e1b23f60ca203ef288b13'

echo '== Complete incremental patch =='
git diff --find-renames --unified=120 "$old" "$new" -- \
  proof/region/v1/tests/gate.py \
  proof/region/v1/tests/test_build.py

echo '== New gate: full file =='
cat -n proof/region/v1/tests/gate.py

echo '== Modified test_build.py: full file =='
cat -n proof/region/v1/tests/test_build.py

echo '== AST maps =='
ast-grep outline proof/region/v1/tests/gate.py --items all
ast-grep outline proof/region/v1/tests/test_build.py --items all

echo '== Static imports and package context =='
for f in \
  proof/region/v1/tests/__init__.py \
  proof/region/v1/tests/test_mpfi_input.py \
  proof/region/v1/tests/test_executor.py \
  proof/region/v1/mpfi/input.py \
  proof/region/v1/build/input.py
do
  if [ -f "$f" ]; then
    echo "--- $f"
    sed -n '1,300p' "$f"
  fi
done

echo '== References to the new gate and exact inventory =='
rg -n -C 8 \
  '(proof/region/v1/tests/gate\.py|EXPECTED|INVENTORY|test_mpfi_input|test_executor|expectedFailure|skip(Test|If)?)' \
  . \
  -g '*.py' -g '*.sh' -g '*.md' -g 'Makefile' -g '*.yml' -g '*.yaml' \
  -g '!node_modules' -g '!dist' -g '!build'

Length of output: 144017


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== New shared gate, exact source =='
nl -ba proof/region/v1/tests/gate.py

echo '== Outer-oracle and anti-vacuum test bodies =='
sed -n '260,365p' proof/region/v1/tests/test_build.py | nl -ba -v260

echo '== All source-level invocations of shared gate or test_build =='
rg -n -C 6 \
  '(proof/region/v1/tests/gate\.py|tests/gate\.py|test_build\.py|ExistingSharedProofGateTests|proof_gate\.(full_suite_v1|inventory_is_exact_v1))' \
  . \
  -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g 'Makefile' -g 'justfile' -g '*.md' \
  -g '!node_modules' -g '!dist' -g '!build'

echo '== Workflow and CI command candidates =='
fd -HI -t f . .github proof | sort | rg '(\.github/workflows/.*\.(yml|yaml)$|(^|/)(Makefile|justfile|.*\.(sh|ya?ml))$)' | while IFS= read -r f; do
  echo "--- $f"
  rg -n -C 4 \
    '(proof/region/v1|arb/tests/gate\.py|native_gate\.py|runtime_gate\.py|unittest|python3)' \
    "$f" || true
done

echo '== Arb gate composition, exact source =='
sed -n '70,152p' proof/region/v1/arb/tests/gate.py | nl -ba -v70

Length of output: 1442


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== New shared gate =='
cat -n proof/region/v1/tests/gate.py

echo '== Outer-oracle and anti-vacuum tests =='
cat -n proof/region/v1/tests/test_build.py | sed -n '260,365p'

echo '== All source-level invocations of shared gate or test_build =='
rg -n -C 6 \
  '(proof/region/v1/tests/gate\.py|tests/gate\.py|test_build\.py|ExistingSharedProofGateTests|proof_gate\.(full_suite_v1|inventory_is_exact_v1))' \
  . \
  -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g 'Makefile' -g 'justfile' -g '*.md' \
  -g '!node_modules' -g '!dist' -g '!build'

echo '== Workflow and CI command candidates =='
fd -HI -t f . .github proof | sort | rg '(\.github/workflows/.*\.(yml|yaml)$|(^|/)(Makefile|justfile|.*\.(sh|ya?ml))$)' | while IFS= read -r f; do
  echo "--- $f"
  rg -n -C 4 \
    '(proof/region/v1|arb/tests/gate\.py|native_gate\.py|runtime_gate\.py|unittest|python3)' \
    "$f" || true
done

echo '== Arb gate composition =='
sed -n '70,152p' proof/region/v1/arb/tests/gate.py | cat -n

Length of output: 29847


@lemone112: Проверил только инкремент от 93c12a7d3ff195253c23498a8913aae56f120eb5 до доступной PR head 7e78a70d9e8f5650214e1b23f60ca203ef288b13.

Новых замечаний нет.

proof/region/v1/tests/gate.py фиксирует полный engine-neutral inventory. .github/workflows/ci.yml запускает полный shared suite в normal и PYTHONOPTIMIZE=2 режимах. Поэтому выполняются и MPFI contract tests, и внешний oracle из test_build.py.

Проверки отклоняют:

  • удаление test_mpfi_input тестов;
  • замену с тем же числом тестов;
  • skip;
  • expectedFailure;
  • unexpectedSuccess.

mpfi/input.py не получил зависимостей от ARB pipeline, transport, executor или receipt.

Примечание: указанный hash 7e78a7006ddf3e614d4d4d5d0a5de3751e1654cf недоступен в PR. Проверенная head имеет hash 7e78a70d9e8f5650214e1b23f60ca203ef288b13.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@proof/region/v1/tests/gate.py`:
- Around line 19-39: Вынесите дублирующиеся хелперы _iter_tests_v1,
_inventory_preimage_v1 и test_inventory_sha256_v1 из обоих gate-модулей в общий
модуль и обновите оба потребителя для их импорта. Оставьте test_count_v1 только
в общем gate-модуле, сохранив независимыми ожидаемые константы и engine-specific
проверки.

In `@proof/region/v1/tests/test_build.py`:
- Around line 345-361: Update test_mpfi_input_contract_cannot_green_by_skipping
to include failing test identifiers and their failure/error text in assertion
messages when validating result.failures and result.errors. Preserve the
existing checks for skipped, expected-failure, and unexpected-success
collections while ensuring a nested MPFI test failure reports its original
diagnostic details.
- Around line 310-343: Publish a public iter_tests_v1 wrapper in gate.py that
delegates to the existing _iter_tests_v1 implementation, then update all
references in test_build.py to use proof_gate.iter_tests_v1 instead of the
private symbol while preserving the current test enumeration behavior.

In `@proof/region/v1/tests/test_mpfi_input.py`:
- Around line 310-335: Move both mpfi_source_input_is_bound_v1 assertions
outside their corresponding assertRaises context managers so they execute after
the expected exception is captured. Preserve the existing cleanup in each
finally block and keep the assertions validating the unbound state for both lock
drift and foreign tree identity cases.
- Around line 79-109: Remove the unused value_mode parameter from
_fixture_release and update every call site, including the fixture invocation
around the referenced lines, to stop passing it. Keep the SourceReleaseLockV1
construction and all other fixture arguments unchanged.
- Around line 486-519: Update test_source_input_owner_has_no_engine_dependency
to read source_path once into a local text variable and reuse it for both
ast.parse and _imported_module_names. Add explicit parentheses around the mixed
and/or condition that identifies __import__ calls and import_module attributes,
preserving the current matching semantics and resolving Ruff RUF021.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1b552d8e-1f56-44ad-a324-a6513d8f05a4

📥 Commits

Reviewing files that changed from the base of the PR and between 57c4817 and 7e78a70.

📒 Files selected for processing (8)
  • proof/region/v1/PROTOCOL.md
  • proof/region/v1/arb/tests/test_transport.py
  • proof/region/v1/build/input.py
  • proof/region/v1/mpfi/__init__.py
  • proof/region/v1/mpfi/input.py
  • proof/region/v1/tests/gate.py
  • proof/region/v1/tests/test_build.py
  • proof/region/v1/tests/test_mpfi_input.py

Comment thread proof/region/v1/tests/gate.py Outdated
Comment thread proof/region/v1/tests/test_build.py Outdated
Comment on lines +310 to +343
def test_exact_inventory_rejects_a_missing_mpfi_input_contract(self) -> None:
suite = proof_gate.full_suite_v1()
without_mpfi_input = unittest.TestSuite(
test
for test in proof_gate._iter_tests_v1(suite)
if not test.id().startswith("test_mpfi_input.")
)

self.assertLess(
proof_gate.test_count_v1(without_mpfi_input),
proof_gate.test_count_v1(suite),
)
self.assertFalse(proof_gate.inventory_is_exact_v1(without_mpfi_input))

def test_exact_inventory_rejects_same_count_contract_replacement(self) -> None:
class ReplacementTest(unittest.TestCase):
def test_replacement(self) -> None:
pass

suite = proof_gate.full_suite_v1()
tests = tuple(proof_gate._iter_tests_v1(suite))
replaced = next(
test for test in tests if test.id().startswith("test_mpfi_input.")
)
replacement = unittest.defaultTestLoader.loadTestsFromTestCase(ReplacementTest)
same_count_replacement = unittest.TestSuite(
(*tuple(test for test in tests if test is not replaced), replacement)
)

self.assertEqual(
proof_gate.test_count_v1(same_count_replacement),
proof_gate.test_count_v1(suite),
)
self.assertFalse(proof_gate.inventory_is_exact_v1(same_count_replacement))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Обращение к приватному proof_gate._iter_tests_v1 нарушает границу модуля.

Строки 314, 330 и 350 используют приватный символ другого модуля. gate.py уже публикует test_count_v1, test_inventory_sha256_v1 и inventory_is_exact_v1, но не публикует перечисление тестов. Переименование приватной функции сломает три теста без предупреждения.

Опубликуйте в gate.py явную функцию перечисления и используйте её.

♻️ Предлагаемое изменение

Добавьте в proof/region/v1/tests/gate.py:

def iter_tests_v1(suite: unittest.TestSuite) -> Iterator[unittest.TestCase]:
    """Публичное перечисление: oracle в другом модуле не зависит от приватного имени."""

    return _iter_tests_v1(suite)

Затем в test_build.py:

-            for test in proof_gate._iter_tests_v1(suite)
+            for test in proof_gate.iter_tests_v1(suite)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@proof/region/v1/tests/test_build.py` around lines 310 - 343, Publish a public
iter_tests_v1 wrapper in gate.py that delegates to the existing _iter_tests_v1
implementation, then update all references in test_build.py to use
proof_gate.iter_tests_v1 instead of the private symbol while preserving the
current test enumeration behavior.

Comment thread proof/region/v1/tests/test_build.py Outdated
Comment on lines +345 to +361
def test_mpfi_input_contract_cannot_green_by_skipping(self) -> None:
suite = unittest.defaultTestLoader.discover(
str(proof_gate.TEST_DIRECTORY),
pattern="test_mpfi_input.py",
)
test_ids = tuple(test.id() for test in proof_gate._iter_tests_v1(suite))
result = unittest.TestResult()

suite.run(result)

self.assertTrue(test_ids)
self.assertEqual(result.testsRun, len(test_ids))
self.assertFalse(result.skipped)
self.assertFalse(result.failures)
self.assertFalse(result.errors)
self.assertFalse(result.expectedFailures)
self.assertFalse(result.unexpectedSuccesses)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Вложенный запуск набора скрывает причину отказа.

Строка 353 запускает весь test_mpfi_input.py внутри одного теста. Строки 358-361 проверяют только пустоту коллекций. При падении любого MPFI-теста отчёт покажет AssertionError: [...] is not false, а не исходную ошибку. Диагностика потребует ручного повторного запуска.

Включите в сообщение об отказе идентификаторы тестов и текст ошибок.

♻️ Предлагаемое изменение
         self.assertTrue(test_ids)
         self.assertEqual(result.testsRun, len(test_ids))
-        self.assertFalse(result.skipped)
-        self.assertFalse(result.failures)
-        self.assertFalse(result.errors)
-        self.assertFalse(result.expectedFailures)
-        self.assertFalse(result.unexpectedSuccesses)
+        self.assertEqual(
+            [test.id() for test, _reason in result.skipped],
+            [],
+        )
+        self.assertEqual(
+            [(test.id(), trace) for test, trace in result.failures + result.errors],
+            [],
+        )
+        self.assertEqual(
+            [test.id() for test, _trace in result.expectedFailures],
+            [],
+        )
+        self.assertEqual(
+            [test.id() for test in result.unexpectedSuccesses],
+            [],
+        )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def test_mpfi_input_contract_cannot_green_by_skipping(self) -> None:
suite = unittest.defaultTestLoader.discover(
str(proof_gate.TEST_DIRECTORY),
pattern="test_mpfi_input.py",
)
test_ids = tuple(test.id() for test in proof_gate._iter_tests_v1(suite))
result = unittest.TestResult()
suite.run(result)
self.assertTrue(test_ids)
self.assertEqual(result.testsRun, len(test_ids))
self.assertFalse(result.skipped)
self.assertFalse(result.failures)
self.assertFalse(result.errors)
self.assertFalse(result.expectedFailures)
self.assertFalse(result.unexpectedSuccesses)
def test_mpfi_input_contract_cannot_green_by_skipping(self) -> None:
suite = unittest.defaultTestLoader.discover(
str(proof_gate.TEST_DIRECTORY),
pattern="test_mpfi_input.py",
)
test_ids = tuple(test.id() for test in proof_gate._iter_tests_v1(suite))
result = unittest.TestResult()
suite.run(result)
self.assertTrue(test_ids)
self.assertEqual(result.testsRun, len(test_ids))
self.assertEqual(
[test.id() for test, _reason in result.skipped],
[],
)
self.assertEqual(
[(test.id(), trace) for test, trace in result.failures + result.errors],
[],
)
self.assertEqual(
[test.id() for test, _trace in result.expectedFailures],
[],
)
self.assertEqual(
[test.id() for test in result.unexpectedSuccesses],
[],
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@proof/region/v1/tests/test_build.py` around lines 345 - 361, Update
test_mpfi_input_contract_cannot_green_by_skipping to include failing test
identifiers and their failure/error text in assertion messages when validating
result.failures and result.errors. Preserve the existing checks for skipped,
expected-failure, and unexpected-success collections while ensuring a nested
MPFI test failure reports its original diagnostic details.

Comment thread proof/region/v1/tests/test_mpfi_input.py
Comment thread proof/region/v1/tests/test_mpfi_input.py
Comment thread proof/region/v1/tests/test_mpfi_input.py

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Пожалуйста, проверь incremental diff на commit 5b10da657e382433ad6bf377fef93cb6a10c3ce8: фактический mandatory proof gate для MPFI source-input, anti-vacuum против удаления/замены/allowlist skip и границу source-input ↔ build authority.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='5b10da657e382433ad6bf377fef93cb6a10c3ce8'

echo '== requested commit =='
if ! git cat-file -e "${head}^{commit}" 2>/dev/null; then
  git fetch --no-tags origin '+refs/pull/511/head:refs/remotes/origin/pr-511-head' || true
fi
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"

base="$(git rev-parse "${head}^")"
echo "base=${base}"

echo '== incremental files =='
git diff --name-status --find-renames "$base" "$head"

echo '== incremental patch: relevant files =='
git diff --find-renames --unified=100 "$base" "$head" -- \
  .github/workflows \
  proof/region/v1/tests \
  proof/region/v1/mpfi \
  proof/region/v1/build \
  proof/region/v1/PROTOCOL.md

echo '== changed Python outlines =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

echo '== workflow proof invocations =='
fd -HI -t f .github/workflows |
while IFS= read -r file; do
  echo "--- $file"
  rg -n -C 6 \
    '(proof/region/v1|tests/gate\.py|test_mpfi_input|unittest|PYTHONOPTIMIZE|python)' \
    "$file" || true
done

echo '== exact-suite and anti-vacuum implementation =='
for file in \
  proof/region/v1/tests/gate.py \
  proof/region/v1/tests/test_build.py \
  proof/region/v1/tests/test_mpfi_input.py \
  proof/region/v1/mpfi/input.py \
  proof/region/v1/build/input.py
do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C 8 \
      '(EXPECTED|inventory|allowlist|skip|expectedFailure|unexpectedSuccess|discover\(|loadTestsFrom|seal_mpfi|SealedInputV1|Build|Receipt|Pipeline|Executor)' \
      "$file" || true
  fi
done

echo '== source-input imports and direct build-authority references =='
python3 - <<'PY'
import ast
from pathlib import Path

for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    if not path.is_file():
        continue
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    imports = []
    for node in ast.walk(tree):
        if isinstance(node, ast.Import):
            imports.extend(alias.name for alias in node.names)
        elif isinstance(node, ast.ImportFrom):
            imports.append("." * node.level + (node.module or ""))
    print(f"{name}:")
    for module in imports:
        print(f"  {module}")
PY

rg -n -P -C 4 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi proof/region/v1/build/input.py -g '*.py' || true

echo '== all references to shared proof gate =='
rg -n -C 5 \
  '(proof/region/v1/tests/gate\.py|tests\.gate|full_suite_v1|inventory_is_exact_v1|test_mpfi_input)' \
  . -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g 'Makefile' -g 'justfile' -g '*.md' \
  -g '!node_modules' -g '!dist' -g '!build'

Length of output: 64260


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='5b10da657e382433ad6bf377fef93cb6a10c3ce8'
base="$(git rev-parse "${head}^")"

echo '== Arb mandatory gate: complete source =='
cat -n proof/region/v1/arb/tests/gate.py

echo '== Incremental Arb gate patch =='
git diff --unified=120 "$base" "$head" -- proof/region/v1/arb/tests/gate.py

echo '== Gate test bodies =='
cat -n proof/region/v1/arb/tests/test_build_recipe.py

echo '== Mandatory workflow commands =='
fd -HI -t f . .github/workflows | sort |
while IFS= read -r file; do
  echo "--- $file"
  rg -n -C 8 \
    '(arb/tests/gate\.py|proof/region/v1|python[0-9]*|PYTHONOPTIMIZE|unittest)' \
    "$file" || true
done

echo '== All local invocations of the Arb gate =='
rg -n -C 6 \
  '(arb/tests/gate\.py|gate\.main\(\)|run_exact_suite_v1|full_suite_v1)' \
  . -g '*.py' -g '*.sh' -g '*.yml' -g '*.yaml' -g 'Makefile' -g 'justfile' -g '*.md' \
  -g '!node_modules' -g '!dist' -g '!build'

echo '== Gate API call sites and test discovery patterns =='
rg -n -C 5 \
  '(SHARED_FAST_TEST_PATTERNS_V1|EXPECTED_SKIPS|EXPECTED_TEST_INVENTORY_SHA256|discover\(|loadTestsFrom|skip|expectedFailure|unexpectedSuccess|testsRun)' \
  proof/region/v1/arb/tests -g '*.py'

echo '== Source-input direct imports and name references =='
sed -n '1,270p' proof/region/v1/mpfi/input.py
rg -n -P -C 4 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|SourceBoundArbControllerV1|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi/input.py proof/region/v1/build/input.py -g '*.py' || true

echo '== Source-input dependency closure: direct importing modules =='
python3 - <<'PY'
import ast
from pathlib import Path

for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    print(f"--- {name}")
    for node in tree.body:
        if isinstance(node, ast.Import):
            for alias in node.names:
                print("import", alias.name)
        elif isinstance(node, ast.ImportFrom):
            print("from", "." * node.level + (node.module or ""))
PY

echo '== Current tree status at requested commit =='
git diff --check "$base" "$head"

Length of output: 95082


@lemone112: Проверил инкремент 5b10da657e382433ad6bf377fef93cb6a10c3ce8 относительно 7e78a70d9e8f5650214e1b23f60ca203ef288b13.

Новых замечаний нет.

  • .github/workflows/arb.yml запускает proof/region/v1/arb/tests/gate.py в normal и PYTHONOPTIMIZE=2 режимах.
  • Gate включает test_mpfi_input.py ровно один раз вместе с test_executor.py и Arb suite.
  • Gate отклоняет пустой suite, дубликаты, inventory drift, удаление тестов и same-count replacement.
  • Gate требует точный skip manifest. MPFI test IDs не входят в allowlist.
  • Gate отклоняет skip, expectedFailure, unexpectedSuccess, failures и errors.
  • test_build_recipe.py проверяет включение MPFI suite и anti-vacuum свойства отдельно.
  • mpfi/input.py сохраняет границу source-input ↔ build authority. Он зависит только от provenance и engine-neutral build.input. Импортов Arb pipeline, transport, executor или receipt нет.
  • git diff --check не выявил ошибок whitespace.
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Финальный delta на commit 4ebc290c068ffee471d23e00ca2ec4dbb194e157: устранены доказанные carryover P2 в test fixture/import guard. Проверь только этот инкремент и отсутствие регрессии обязательного MPFI proof-gate.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='4ebc290c068ffee471d23e00ca2ec4dbb194e157'

if ! git cat-file -e "${head}^{commit}" 2>/dev/null; then
  git fetch --no-tags origin '+refs/pull/511/head:refs/remotes/origin/pr-511-head' || true
fi

echo '== Requested commit =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
base="$(git rev-parse "${head}^")"
echo "base=$base"

echo '== Incremental changed files =='
git diff --name-status --find-renames "$base" "$head"

echo '== Incremental patch =='
git diff --find-renames --unified=120 "$base" "$head" -- \
  .github/workflows \
  proof/region/v1/tests \
  proof/region/v1/mpfi \
  proof/region/v1/build \
  proof/region/v1/arb/tests

echo '== Changed Python structure =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

echo '== Mandatory workflow commands =='
fd -HI -t f .github/workflows |
while IFS= read -r file; do
  echo "--- $file"
  rg -n -C 8 \
    '(proof/region/v1/arb/tests/gate\.py|proof/region/v1/tests/gate\.py|PYTHONOPTIMIZE|python[0-9]*|unittest)' \
    "$file" || true
done

echo '== Mandatory gate composition and anti-vacuum checks =='
for file in \
  proof/region/v1/arb/tests/gate.py \
  proof/region/v1/arb/tests/test_build_recipe.py \
  proof/region/v1/tests/gate.py \
  proof/region/v1/tests/test_build.py \
  proof/region/v1/tests/test_mpfi_input.py
do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C 8 \
      '(test_mpfi_input|fixture|import.guard|import_guard|allowlist|skip|expectedFailure|unexpectedSuccess|inventory|duplicate|empty|full_suite_v1|run_exact_suite_v1)' \
      "$file" || true
  fi
done

echo '== Import boundary of MPFI source input =='
python3 - <<'PY'
import ast
from pathlib import Path

for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    if not path.is_file():
        continue
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    print(f"--- {name}")
    for node in tree.body:
        if isinstance(node, ast.Import):
            for alias in node.names:
                print(f"import {alias.name}")
        elif isinstance(node, ast.ImportFrom):
            print(f"from {'.' * node.level}{node.module or ''}")
PY

rg -n -P -C 4 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|SourceBoundArbControllerV1|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi/input.py proof/region/v1/build/input.py -g '*.py' || true

echo '== Diff whitespace check =='
git diff --check "$base" "$head"

Length of output: 24963


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='4ebc290c068ffee471d23e00ca2ec4dbb194e157'
base="$(git rev-parse "${head}^")"

echo '== Workflow files and mandatory proof invocations =='
fd -HI -t f . .github/workflows | sort |
while IFS= read -r file; do
  echo "--- $file"
  rg -n -C 10 \
    '(proof/region/v1/arb/tests/gate\.py|proof/region/v1/tests/gate\.py|PYTHONOPTIMIZE|python[0-9]*|unittest)' \
    "$file" || true
done

echo '== Arb mandatory gate: source =='
cat -n proof/region/v1/arb/tests/gate.py

echo '== Gate-focused tests: relevant sections =='
for file in \
  proof/region/v1/arb/tests/test_build_recipe.py \
  proof/region/v1/tests/gate.py \
  proof/region/v1/tests/test_build.py \
  proof/region/v1/tests/test_mpfi_input.py
do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C 10 \
      '(test_mpfi_input|allowlist|skip|expectedFailure|unexpectedSuccess|inventory|duplicate|empty|full_suite_v1|run_exact_suite_v1)' \
      "$file" || true
  fi
done

echo '== MPFI source-input imports =='
python3 - <<'PY'
import ast
from pathlib import Path

for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    print(f"--- {name}")
    for node in tree.body:
        if isinstance(node, ast.Import):
            for alias in node.names:
                print(f"import {alias.name}")
        elif isinstance(node, ast.ImportFrom):
            print(f"from {'.' * node.level}{node.module or ''}")
PY

echo '== Prohibited source-input dependency references =='
rg -n -P -C 4 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|SourceBoundArbControllerV1|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi/input.py proof/region/v1/build/input.py -g '*.py' || true

echo '== Final delta integrity =='
git diff --check "$base" "$head"

Length of output: 38541


@lemone112: Проверил только delta 4ebc290c068ffee471d23e00ca2ec4dbb194e157 относительно 5b10da657e382433ad6bf377fef93cb6a10c3ce8.

Новых замечаний нет.

  • Delta изменяет только proof/region/v1/tests/test_mpfi_input.py.
  • Fixture cleanup удаляет неиспользуемый параметр value_mode из _fixture_release. Проверяемый режим файла продолжает поступать из archive fixture и остаётся частью expected USTAR entries.
  • Import guard читает source один раз. Он сохраняет проверку imports и обоих путей dynamic import: __import__ и import_module.
  • .github/workflows/arb.yml запускает mandatory proof/region/v1/arb/tests/gate.py в normal и PYTHONOPTIMIZE=2 режимах.
  • Gate включает test_mpfi_input.py. Gate отклоняет empty suite, дубликаты, inventory drift, неразрешённый skip, expectedFailure, unexpectedSuccess, failures и errors.
  • test_build_recipe.py отдельно проверяет включение MPFI suite и отсутствие allowlist skip для MPFI tests.
  • mpfi/input.py не импортирует Arb pipeline, transport, executor или receipt. Граница source-input ↔ build authority сохранена.
  • git diff --check не выявил ошибок whitespace.

Тесты не выполнялись. Проверка была статической.

You are interacting with an AI system.

@lemone112
lemone112 force-pushed the agent/mpfi-source-materialization branch from 57c4817 to dda9e73 Compare August 1, 2026 11:11
@lemone112
lemone112 force-pushed the agent/mpfi-source-materialization branch from dda9e73 to 7155024 Compare August 1, 2026 14:08
@lemone112
lemone112 force-pushed the agent/mpfi-build-closure branch from 4ebc290 to e588d43 Compare August 1, 2026 14:17

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@lemone112 lemone112 changed the title Proof: запечатать MPFI source input Proof: замкнуть single-operation replay Aug 1, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
proof/region/v1/arb/tests/test_build_identity_v2.py (1)

34-47: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Свяжите _POLICY_FIELDS с координатами DockerBuildPolicyV1.

DockerBuildPolicyV1 является подклассом tuple, а не dataclass или NamedTuple. Поэтому используйте имена параметров DockerBuildPolicyV1.__new__ без cls. Иначе новое поле может потеряться в _policy_with, а тест мутаций останется зелёным.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@proof/region/v1/arb/tests/test_build_identity_v2.py` around lines 34 - 47,
Свяжите `_POLICY_FIELDS` с именами параметров `DockerBuildPolicyV1.__new__`,
исключив параметр `cls`, вместо ручного дублирования списка. Проверьте, что
`_policy_with` использует этот источник полей, чтобы любые новые поля
`DockerBuildPolicyV1` автоматически учитывались и не терялись в тестах мутаций.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@proof/region/v1/arb/tests/test_receipt.py`:
- Around line 397-427: Rename the loop tuple variable select in the targets
iteration to a non-conflicting name, and update its uses within the loop while
preserving the existing behavior and the imported select.select call.
- Around line 938-948: Update the preimage construction in the test around
ArbComparatorPreimagesV1 to locate the build_identity field by dataclass field
name rather than assuming index 5 or a fixed range of 10 fields. Import
dataclasses.fields if needed, derive the field list from
pipeline.ArbComparatorPreimagesV1, preserve the existing build_identity
preimage, and forge all other positions while retaining the uniqueness
assertion.

In `@proof/region/v1/mpfi/input.py`:
- Around line 73-91: Вынесите проверку значения и вызов _fail для
source_lock_identity из try/except в явный поток после безопасного получения
свойства. Не допускайте, чтобы except Exception перехватывал
MpfiSourceInputErrorV1, поднятый внутри проверки; сохраните преобразование
неожиданных ошибок доступа к admitted_sources.source_lock_identity в
FOREIGN_SOURCE_CAPABILITY.

In `@proof/region/v1/provenance.py`:
- Around line 585-598: Remove the quotes from the return annotation of the
SourceReleaseLockV1.parse classmethod, changing it to the unquoted
SourceReleaseLockV1 annotation to resolve Ruff UP037 and match the existing
annotation style.

In `@proof/region/v1/tests/test_mpfi_input.py`:
- Around line 306-318: Remove the cached_lock_identity assignment and both
lock.__dict__ identity restoration operations from the test cleanup; in the
finally block around seal_mpfi_source_input_v1, restore only
lock.sources[0].version to original_version.

---

Outside diff comments:
In `@proof/region/v1/arb/tests/test_build_identity_v2.py`:
- Around line 34-47: Свяжите `_POLICY_FIELDS` с именами параметров
`DockerBuildPolicyV1.__new__`, исключив параметр `cls`, вместо ручного
дублирования списка. Проверьте, что `_policy_with` использует этот источник
полей, чтобы любые новые поля `DockerBuildPolicyV1` автоматически учитывались и
не терялись в тестах мутаций.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f56b2a6-f994-48c8-9584-0da7991fa567

📥 Commits

Reviewing files that changed from the base of the PR and between 7e78a70 and ec13060.

📒 Files selected for processing (19)
  • proof/region/v1/PROTOCOL.md
  • proof/region/v1/arb/pipeline.py
  • proof/region/v1/arb/receipt.py
  • proof/region/v1/arb/tests/gate.py
  • proof/region/v1/arb/tests/test_build_identity_v2.py
  • proof/region/v1/arb/tests/test_build_recipe.py
  • proof/region/v1/arb/tests/test_pipeline.py
  • proof/region/v1/arb/tests/test_receipt.py
  • proof/region/v1/arb/tests/test_transport.py
  • proof/region/v1/build/input.py
  • proof/region/v1/build/transport.py
  • proof/region/v1/mpfi/__init__.py
  • proof/region/v1/mpfi/input.py
  • proof/region/v1/provenance.py
  • proof/region/v1/region_proof_protocol.py
  • proof/region/v1/tests/test_build.py
  • proof/region/v1/tests/test_mpfi_input.py
  • proof/region/v1/tests/test_mpfi_source_lock.py
  • proof/region/v1/tests/test_source_lock.py

Comment thread proof/region/v1/arb/tests/test_receipt.py Outdated
Comment thread proof/region/v1/arb/tests/test_receipt.py
Comment on lines +73 to +91
try:
source_lock_identity = admitted_sources.source_lock_identity
if (
type(source_lock_identity) is not bytes
or len(source_lock_identity) != 32
or source_lock_identity == bytes(32)
or source_lock_identity != source_lock.identity
):
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)
except Exception:
# Exact type не делает retained capability неуязвимой к post-admission
# подмене; ordinary hostile failure обязан остаться typed rejection.
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Вынесите typed rejection из блока try.

_fail на строках 81-84 поднимает MpfiSourceInputErrorV1. Этот класс наследует ValueError, поэтому except Exception на строке 85 перехватывает его и повторяет _fail. Сейчас результат совпадает, потому что reason и field одинаковы. Если позже вы добавите другой reason внутри блока try, он будет молча заменён на FOREIGN_SOURCE_CAPABILITY. Сделайте поток управления явным.

♻️ Предлагаемое изменение
     try:
         source_lock_identity = admitted_sources.source_lock_identity
-        if (
-            type(source_lock_identity) is not bytes
-            or len(source_lock_identity) != 32
-            or source_lock_identity == bytes(32)
-            or source_lock_identity != source_lock.identity
-        ):
-            _fail(
-                MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
-                "admitted_sources",
-            )
+        bound = (
+            type(source_lock_identity) is bytes
+            and len(source_lock_identity) == 32
+            and source_lock_identity != bytes(32)
+            and source_lock_identity == source_lock.identity
+        )
     except Exception:
         # Exact type не делает retained capability неуязвимой к post-admission
         # подмене; ordinary hostile failure обязан остаться typed rejection.
         _fail(
             MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
             "admitted_sources",
         )
+    if not bound:
+        _fail(
+            MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
+            "admitted_sources",
+        )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
try:
source_lock_identity = admitted_sources.source_lock_identity
if (
type(source_lock_identity) is not bytes
or len(source_lock_identity) != 32
or source_lock_identity == bytes(32)
or source_lock_identity != source_lock.identity
):
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)
except Exception:
# Exact type не делает retained capability неуязвимой к post-admission
# подмене; ordinary hostile failure обязан остаться typed rejection.
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)
try:
source_lock_identity = admitted_sources.source_lock_identity
bound = (
type(source_lock_identity) is bytes
and len(source_lock_identity) == 32
and source_lock_identity != bytes(32)
and source_lock_identity == source_lock.identity
)
except Exception:
# Exact type не делает retained capability неуязвимой к post-admission
# подмене; ordinary hostile failure обязан остаться typed rejection.
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)
if not bound:
_fail(
MpfiSourceInputReasonV1.FOREIGN_SOURCE_CAPABILITY,
"admitted_sources",
)
🧰 Tools
🪛 Ruff (0.16.0)

[warning] 85-85: Do not catch blind exception: Exception

(BLE001)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@proof/region/v1/mpfi/input.py` around lines 73 - 91, Вынесите проверку
значения и вызов _fail для source_lock_identity из try/except в явный поток
после безопасного получения свойства. Не допускайте, чтобы except Exception
перехватывал MpfiSourceInputErrorV1, поднятый внутри проверки; сохраните
преобразование неожиданных ошибок доступа к
admitted_sources.source_lock_identity в FOREIGN_SOURCE_CAPABILITY.

Comment thread proof/region/v1/provenance.py
Comment thread proof/region/v1/tests/test_mpfi_input.py Outdated

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Проверьте текущую голову bd7ddbaafa3698571f3843a4e9757b31e31f5d69. В этом delta устранены только подтверждённые замечания по stale test scaffolding, хрупкой индексации preimage и границе typed MPFI error; fast-gate inventory обновлён независимыми значениями. Проверьте именно текущий delta и отсутствие новых проблем.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='bd7ddbaafa3698571f3843a4e9757b31e31f5d69'

if ! git cat-file -e "${head}^{commit}" 2>/dev/null; then
  git fetch --no-tags origin '+refs/pull/511/head:refs/remotes/origin/pr-511-head' || true
fi

echo '== requested commit =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
base="$(git rev-parse "${head}^")"
echo "base=$base"

echo '== changed files =='
git diff --name-status --find-renames "$base" "$head"

echo '== incremental patch =='
git diff --find-renames --unified=100 "$base" "$head" -- \
  .github/workflows \
  proof/region/v1/arb/tests \
  proof/region/v1/tests \
  proof/region/v1/mpfi \
  proof/region/v1/build \
  proof/region/v1/provenance.py \
  proof/region/v1/arb

echo '== changed Python outlines =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

echo '== relevant symbols in changed files =='
git diff --name-only "$base" "$head" -- |
while IFS= read -r file; do
  case "$file" in
    *.py)
      echo "--- $file"
      rg -n -C 8 \
        '(preimage|Preimage|index|typed|MpfiSourceInputErrorV1|MpfiSourceInputReasonV1|Error|fixture|inventory|SHA256|test_mpfi_input|skip|expectedFailure|unexpectedSuccess)' \
        "$file" || true
      ;;
  esac
done

echo '== mandatory workflow and gate composition =='
for file in .github/workflows/arb.yml proof/region/v1/arb/tests/gate.py proof/region/v1/arb/tests/test_build_recipe.py proof/region/v1/tests/test_build.py; do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C 10 \
      '(arb/tests/gate\.py|PYTHONOPTIMIZE|test_mpfi_input|SHARED_FAST_TEST_PATTERNS_V1|inventory|SHA256|skip|expectedFailure|unexpectedSuccess|full_suite_v1)' \
      "$file" || true
  fi
done

echo '== MPFI source-input direct import graph and prohibited references =='
python3 - <<'PY'
import ast
from pathlib import Path
for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    if not path.is_file():
        continue
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    print(f"--- {name}")
    for node in tree.body:
        if isinstance(node, ast.Import):
            for alias in node.names:
                print(f"import {alias.name}")
        elif isinstance(node, ast.ImportFrom):
            print(f"from {'.' * node.level}{node.module or ''}")
PY

rg -n -P -C 4 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|SourceBoundArbControllerV1|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi/input.py proof/region/v1/build/input.py -g '*.py' || true

echo '== diff integrity =='
git diff --check "$base" "$head"

Length of output: 213304


@lemone112: Проверил только delta bd7ddbaafa3698571f3843a4e9757b31e31f5d69 относительно ec13060d380d7e322db69ff31461902fe7f8f690.

Новых замечаний нет.

  • test_receipt.py больше не использует позиционный индекс preimage. Тест выбирает поле build_identity через dataclasses.fields(). Это устраняет зависимость от порядка полей ArbComparatorPreimagesV1.
  • mpfi/input.py сохраняет typed boundary. Ошибка доступа к публичному admitted_sources.source_lock_identity становится MpfiSourceInputErrorV1. Ошибки replay archive сохраняют taxonomy ProvenanceErrorV1.
  • Удаление stale test scaffolding не изменяет проверяемые свойства MPFI fixture.
  • Mandatory fast gate по-прежнему запускается из .github/workflows/arb.yml в normal и PYTHONOPTIMIZE=2 режимах.
  • Gate включает test_mpfi_input.py и отклоняет empty suite, duplicate IDs, inventory drift, неразрешённые skips, expectedFailure, unexpectedSuccess, failures и errors.
  • test_build.py содержит отдельные literal values для inventory hash и order hash.
  • mpfi/input.py не импортирует Arb pipeline, transport, executor или receipt.
  • git diff --check не выявил whitespace errors.

Тесты не выполнялись. Проверка была статической.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Проверьте текущую голову 6cd4f1b. Исправлен единственный новый подтверждённый комментарий: _POLICY_FIELDS теперь выводится из параметров DockerBuildPolicyV1.__new__, ручного дубля больше нет. Fast-gate normal/optimized и shared suite normal/optimized зелёные.

@coderabbitai

coderabbitai Bot commented Aug 1, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='6cd4f1b'

if ! git rev-parse --verify --quiet "${head}^{commit}" >/dev/null; then
  git fetch --no-tags origin '+refs/pull/511/head:refs/remotes/origin/pr-511-head' || true
fi

echo '== requested commit =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$head"
base="$(git rev-parse "${head}^")"
echo "base=$base"

echo '== incremental files =='
git diff --name-status --find-renames "$base" "$head"
echo '== incremental patch =='
git diff --find-renames --unified=120 "$base" "$head"

echo '== changed Python outlines =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  ast-grep outline "$file" --items all 2>/dev/null || true
done

echo '== DockerBuildPolicyV1 and _POLICY_FIELDS definitions and uses =='
rg -n -C 12 \
  'class\s+DockerBuildPolicyV1\b|def\s+__new__\b|_POLICY_FIELDS\b|DockerUserModeV1|policy.*identity|identity.*policy|canonical' \
  proof/region/v1/build proof/region/v1/arb proof/region/v1/tests \
  -g '*.py'

echo '== focused transport source =='
transport_file="$(fd -HI -t f '^transport\.py$' proof/region/v1/build | head -n 1 || true)"
if [ -n "$transport_file" ]; then
  cat -n "$transport_file" | sed -n '1,420p'
fi

echo '== tests that cover DockerBuildPolicyV1 fields and identity =='
rg -n -C 8 \
  'DockerBuildPolicyV1|_POLICY_FIELDS|DockerUserModeV1|policy.*identity|identity.*policy' \
  proof/region/v1 -g 'test_*.py'

echo '== mandatory MPFI proof-gate static composition =='
for file in \
  .github/workflows/arb.yml \
  proof/region/v1/arb/tests/gate.py \
  proof/region/v1/arb/tests/test_build_recipe.py \
  proof/region/v1/tests/test_mpfi_input.py
do
  if [ -f "$file" ]; then
    echo "--- $file"
    rg -n -C 8 \
      '(arb/tests/gate\.py|PYTHONOPTIMIZE|test_mpfi_input|SHARED_FAST_TEST_PATTERNS_V1|inventory|allowlist|skip|expectedFailure|unexpectedSuccess|full_suite_v1)' \
      "$file" || true
  fi
done

echo '== source-input authority boundary =='
python3 - <<'PY'
import ast
from pathlib import Path
for name in ("proof/region/v1/mpfi/input.py", "proof/region/v1/build/input.py"):
    path = Path(name)
    if not path.is_file():
        continue
    tree = ast.parse(path.read_text(encoding="utf-8"), filename=name)
    print(f"--- {name}")
    for node in tree.body:
        if isinstance(node, ast.Import):
            for alias in node.names:
                print(f"import {alias.name}")
        elif isinstance(node, ast.ImportFrom):
            print(f"from {'.' * node.level}{node.module or ''}")
PY
rg -n -P -C 3 \
  '^\s*(from|import)\s+.*(arb|pipeline|transport|executor|receipt|run)|\b(BuildAuthority|SourceBoundArbControllerV1|Receipt|Executor|Pipeline)\b' \
  proof/region/v1/mpfi/input.py proof/region/v1/build/input.py -g '*.py' || true

echo '== diff integrity =='
git diff --check "$base" "$head"

Length of output: 174031


🏁 Script executed:

#!/bin/bash
set -euo pipefail

head='6cd4f1b'
base="$(git rev-parse "${head}^")"

echo '== commit =='
git show -s --format='commit=%H%nparent=%P%nsubject=%s' "$head"

echo '== changed files =='
git diff --name-status --find-renames "$base" "$head"

echo '== exact incremental patch =='
git diff --find-renames --unified=80 "$base" "$head"

echo '== changed test source =='
git diff --name-only "$base" "$head" -- '*.py' |
while IFS= read -r file; do
  [ -n "$file" ] || continue
  echo "--- $file"
  cat -n "$file" | sed -n '1,150p'
  rg -n -C 12 \
    '_POLICY_FIELDS\b|def _policy_with\b|def _policy_mutants\b|test_every_admitted_policy_mutation' \
    "$file" || true
done

echo '== constructor parameters, public properties, and policy test field set =='
python3 - <<'PY'
import ast
import inspect
import sys
from pathlib import Path

root = Path("proof/region/v1")
sys.path.insert(0, str(root))
from build import transport

parameters = tuple(
    name
    for name in inspect.signature(transport.DockerBuildPolicyV1.__new__).parameters
    if name != "cls"
)
properties = tuple(
    name
    for name, member in vars(transport.DockerBuildPolicyV1).items()
    if isinstance(member, property)
)
print("constructor_parameters=", parameters)
print("public_properties=", properties)
print("same_order_and_set=", parameters == properties)

test_path = root / "arb/tests/test_build_identity_v2.py"
tree = ast.parse(test_path.read_text(encoding="utf-8"), filename=str(test_path))
for node in tree.body:
    if isinstance(node, ast.Assign) and any(
        isinstance(target, ast.Name) and target.id == "_POLICY_FIELDS"
        for target in node.targets
    ):
        print("policy_fields_assignment_ast=", ast.dump(node.value, include_attributes=False))
PY

echo '== no whitespace errors =='
git diff --check "$base" "$head"

Length of output: 15653


@lemone112 Проверил delta 6cd4f1b относительно bd7ddbaafa3698571f3843a4e9757b31e31f5d69.

Новых замечаний нет.

  • Commit изменяет только proof/region/v1/arb/tests/test_build_identity_v2.py.
  • _POLICY_FIELDS теперь берёт порядок и имена из DockerBuildPolicyV1.__new__.
  • Исключение cls корректно. Остальные параметры соответствуют полям, которые _policy_with читает через public properties и передаёт в positional constructor order.
  • Проверка мутаций продолжает требовать mutant для каждого допускаемого policy field. platform и user_mode остаются исключениями с singleton admitted domain.
  • Mandatory MPFI proof gate не изменён. .github/workflows/arb.yml продолжает запускать его в normal и PYTHONOPTIMIZE=2 режимах.
  • Gate по-прежнему включает test_mpfi_input.py и отклоняет inventory drift, неразрешённые skips, expectedFailure, unexpectedSuccess, failures и errors.
  • git diff --check для delta прошёл без ошибок.

Я не выполнял тесты. Попытка import-based inspection не выполнилась из-за Python 3.9 в sandbox: этот runtime не содержит enum.StrEnum.

You are interacting with an AI system.

…n' into agent/mpfi-build-closure

# Conflicts:
#	proof/region/v1/arb/pipeline.py
#	proof/region/v1/tests/test_build.py

Copy link
Copy Markdown
Collaborator Author

Этот replay/source-closure-срез поглощён терминальным PR #514 (base main, exact head 6e8bb6445cf5564bad1b590690a43a235f4dbfbd). Полезные изменения сохранены в единой terminal ветке. Закрываю как superseded; код не удалён.

@lemone112 lemone112 closed this Aug 2, 2026
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