Skip to content

fix(tests): a repro artifact can be regenerated after its input bytes move - #384

Merged
PhysShell merged 2 commits into
mainfrom
fix/repro-regeneration-moved-input
Oct 1, 2026
Merged

PhysShell merged 2 commits into
mainfrom
fix/repro-regeneration-moved-input

Conversation

@PhysShell

Copy link
Copy Markdown
Owner

Что и зачем

Документированная перегенерация repro-артефактов в два прохода (python tests/test_repro_fixtures.py --write → OWN_SHADOW_WRITE=1 cargo test -p own-shadow --test engine → снова --write) не могла начаться, если изменились входные байты закоммиченного артефакта. Python переносил закоммиченную запись Rust-движка как есть; она свидетельствует о старых байтах, артефакт не проходил проверку, и писатель отказывался (код 1). Rust-писатель, в свою очередь, отказывается, пока байты артефакта не совпадут с файлом на диске (код 101). Выход был один — удалить артефакт руками.

Теперь писатель не переносит чужую запись о других байтах: она отбрасывается с пометкой, как запись до v3, и порт заново пишет свою. Режим проверки ничего не отбрасывает, так что сдвинувшийся вход по-прежнему читается как устаревший артефакт.

Тип изменения

  • feat — новая возможность
  • fix — исправление бага
  • docs — документация
  • refactor / chore / test / ci — без изменения поведения

Как проверено

  • python tests/run_tests.py
  • ruff check . и mypy
  • селфтесты затронутых скриптов (python scripts/<...>.py --selftest)

Linux (WSL), ruff 0.15.8, mypy 1.19.1.

Сквозное воспроизведение: к tests/fixtures/repro/canonical_key_order.facts.json дописан перевод строки.

Шаг main с исправлением
Python --write, проход 1 код 1, «refusing to write an artifact that does not verify» код 0, NOTE: … attests other bytes …
OWN_SHADOW_WRITE=1 cargo test -p own-shadow --test engine код 101 код 0
Python --write, проход 2 — код 0
проверка, cargo test -p own-shadow — зелёные
  • Новый контроль carry-moved-input без исправления падает тремя способами (запись перенесена; причина не названа; артефакт не проходит проверку).
  • tests/test_checkpoint_status.py зелёный: якоря мутационных кампаний на месте (carry_foreign в ownlang/repro.py не тронут, правка в писателе теста).
  • Полный python tests/run_tests.py гонялся на дереве с обоими исправлениями до коммита; единственное падение там — контроль P-037 «dirty tree», который на закоммиченном дереве проходит.

Связанные issue

Нет. Найдено при перегенерации фикстур в исследовательской ветке.

Чеклист

  • изменение покрыто тестом/селфтестом (или объяснено, почему нет)
  • README/docs обновлены при необходимости
  • коммиты в conventional-commit стиле (feat:, fix:, docs: …)

Документация не требуется: порядок из docs/notes/p022-shadow-acceptance.md теперь работает как написан.

🤖 Generated with Claude Code

… move

The documented two-pass regeneration (reference `--write`, port
`OWN_SHADOW_WRITE=1`, reference `--write`) could not start once the input of a
committed artifact changed. The reference carried the port's committed capture
through verbatim; that capture attests the OLD bytes, so the artifact failed
to verify and the writer refused (exit 1). The port's writer in turn refuses
until the artifact's bytes equal the file on disk (exit 101). Each side waited
for the other, and the only way out was to delete the artifact by hand.

The writer no longer carries a foreign capture of other bytes into a rewritten
artifact: it is dropped with its reason, exactly like a pre-v3 entry, and the
port re-runs and authors its own. Verify mode drops nothing, so a moved input
still reads as a stale artifact.

The control `carry-moved-input` drives a state no committed fixture can reach
(an artifact and its input are always regenerated together). Without the fix
it fails three ways: the stale capture is carried, nothing says why, and the
rewritten artifact does not verify.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@PhysShell
PhysShell merged commit 464de8d into main Oct 1, 2026
68 checks passed
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