Skip to content

feat(colors): prove incremental re-resolve parity - #572

Merged
lemone112 merged 8 commits into
mainfrom
feat/incremental-parity
Aug 12, 2026
Merged

feat(colors): prove incremental re-resolve parity#572
lemone112 merged 8 commits into
mainfrom
feat/incremental-parity

Conversation

@lemone112

@lemone112 lemone112 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

Slice contract — PR F: incremental parity

Scope

  • Reuse prior certified per-case evidence only when the canonical physical case is unchanged.
  • Recompute every changed case through the existing graph/evaluator path.
  • Keep whole-snapshot SetAll | RevokeAll | ConfirmExact publication and ABI v2 unchanged.
  • Preserve deterministic receipts: incremental outcome must be byte-identical to a fresh full resolve.
  • No public exports, second client, workflow-pin changes, or observable semantic change versus PR E.

RED

  • unchanged_cases_skip_evaluator_work_on_revision_only_update: PR E dispatched 2 evaluator calls; PR F requires 0.
  • single_changed_case_recomputes_only_the_affected_case: PR E dispatched 2 evaluator calls; PR F requires 1.
  • Differential oracle compares incremental update bytes with a fresh full resolve.
  • Hostile cases cover all cases changed, out-of-order/conflicting revisions, and Unknown → recovery.
  • incremental-invalidation-skip mutates the exact physical-case equality predicate to unconditional reuse; browser proof must kill it when a changed backdrop should invalidate Ready and revoke output.

Exit

  • Core/private-fixture suites and clippy are green.
  • Seven packed-browser semantic mutants are killed on canonical Linux.
  • Private Program WASM budget follows the canonical two-phase cycle: observation run expected RED, then zero-headroom budget from that exact run id, then exact-head full green rerun.
  • CodeRabbit findings triaged on the final head.
  • PR remains unmerged.

Local evidence

  • Base post-merge CI: run 31592768178, exact SHA 479769ff9564d0bfd8eae5d5211519e1d0ff538f, success.
  • RED observed: unchanged-case witness failed left: 2, right: 0 before implementation.
  • cargo test -p labcolors-core --lib --features private-fixture --locked: 1098 passed, 0 failed, 7 ignored.
  • cargo clippy -p labcolors-core --all-targets --features private-fixture --locked -- -D warnings: PASS.
  • Mutation contract: 14 passed, 0 failed; seven exact source transformations bound.
  • LSP daemon timed out twice; compiler+clippy are the current static proof. Canonical package/browser/build gates run in GitHub Actions.

Budget cycle

  • Observation head: 0382196 (budget intentionally still pinned to PR E until canonical Linux observation).
  • Observation run id: pending.
  • Budget head/run id: pending.

Summary by CodeRabbit

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

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

    • Расширены проверки браузерных сценариев, мутаций и переходов состояний.
    • Актуализированы метаданные артефактов и контрольные хэши.

lemone112 and others added 3 commits August 12, 2026 17:23
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 85e91bb0-4a81-4ac1-9735-a6f3d85cefbf

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

Добавлена инкрементальная оценка Program Session. Предыдущий verified report передаётся в evaluation pipeline. Совместимые неизменённые сценарии переиспользуют evidence и outputs. Изменённые сценарии переоцениваются. Добавлены Rust, browser и mutation-тесты.

Changes

Инкрементальная оценка

Layer / File(s) Summary
Контракты и копирование evidence
crates/labcolors-core/src/session.rs, crates/labcolors-core/src/program_session.rs, crates/labcolors-core/src/point_support.rs, crates/labcolors-core/src/session_tests.rs, crates/labcolors-core/src/generic_boundary_tests.rs
SessionPlanV1::evaluate получает предыдущий verified report. Evidence, constraint results и report cells поддерживают копирование.
Переиспользование и инвалидация
crates/labcolors-core/src/program_session.rs
Pipeline проверяет совместимость предыдущего report. Неизменённые физические случаи копируют evidence, relation members, causal replay и outputs. Изменённые случаи проходят полную оценку.
Проверка обновлений
crates/labcolors-core/src/private_fixture.rs, fixtures/private-program-browser/proof.mjs, packages/colors/test/private-program-mutation-contract.test.mjs, scripts/test-private-program-mutations.mjs, scripts/test-private-program-browser.mjs
Тесты проверяют пропуск неизменённых сценариев, переоценку изменённых сценариев, конфликты ревизий, восстановление после Unknown и инвалидацию browser-результата.
Контрольные артефакты
crates/labcolors-core/contracts/..., scripts/verify_point_support_surplus.py, packages/colors/bench/private-program-wasm.json
Обновлены SHA-256-хэши receipts, proof-артефакта и исходного конуса. Обновлены источник сборки и размеры WASM-артефакта.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SessionState
  participant SessionPlanV1
  participant ProgramSession
  participant ProgramConstraintEvaluatorSetV1
  SessionState->>SessionPlanV1: передаёт last_verified()
  SessionPlanV1->>ProgramSession: запускает evaluate с previous
  ProgramSession->>ProgramSession: проверяет совместимость report
  ProgramSession->>ProgramConstraintEvaluatorSetV1: копирует evidence неизменённых случаев
  ProgramSession->>ProgramConstraintEvaluatorSetV1: переоценивает изменённые случаи
  ProgramSession-->>SessionState: возвращает обновлённый report
Loading

Possibly related PRs

  • Labpics-Team/lab-colors#568 — изменяет те же private-program fixtures и тесты инкрементальной инвалидации.
  • Labpics-Team/lab-colors#477 — связан с передачей предыдущего evidence и session flow.
  • Labpics-Team/lab-colors#474 — связан с revision-aware данными и повторным использованием evidence.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.76% 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 Заголовок точно отражает основное изменение: доказательство паритета инкрементального повторного разрешения.
✨ 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 feat/incremental-parity

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

@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

🤖 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 `@crates/labcolors-core/src/generic_boundary_tests.rs`:
- Around line 1326-1328: Update the source assertion for
CanonicalObservationSchemaV1 so the derive attributes and the struct declaration
are validated as one contiguous or otherwise uniquely associated declaration,
rather than using independent global OBSERVATION_SOURCE.contains checks. Ensure
removing any required Debug, PartialEq, Eq, or test-only Clone derive from
CanonicalObservationSchemaV1 causes the test to fail.

In `@crates/labcolors-core/src/private_fixture.rs`:
- Around line 2208-2234: Добавьте комментарий непосредственно перед функцией
two_case_opaque_authored, документирующий инвариант: при opacity: 1.0 разные
backdrop меняют физический case, но не expected_final_visible, поэтому fixture
проверяет reuse и invalidation без изменения certified render.
- Around line 2408-2433: Расширьте тест
unknown_transition_preserves_the_ready_baseline_for_later_reuse: сбросьте
CORE_PROGRAM_ASSESSMENT_CALLS непосредственно перед recovery update и после него
проверьте, что счётчик равен 0, сохранив существующие проверки состояния,
revision и content_identity.

In `@crates/labcolors-core/src/program_session.rs`:
- Around line 754-766: Уберите преобразование неподдерживаемого копирования
evidence в panic: обновите реализации Clone, использующие copy_pass_evidence и
copy_violation_evidence, чтобы они возвращали типизированную ошибку
EvidenceCopyUnsupported через fallible API. Сохраните None из базового
ProgramConstraintEvaluatorSetV1 и обеспечьте одинаковое поведение во всех
отмеченных реализациях, включая прямые вызовы Clone независимо от
supports_evidence_copy().

In `@packages/colors/bench/private-program-wasm.json`:
- Around line 24-29: Replace the canonical benchmark metadata in the policy
section with results from a new successful exact-head rerun, ensuring the
recorded run matches the current HEAD and passes the expected budget check
before setting the zero-headroom maxRawBytes value.
🪄 Autofix

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: 29209774-8a47-4d37-8e8b-7f2ba788ddee

📥 Commits

Reviewing files that changed from the base of the PR and between 479769f and cf9a99d.

📒 Files selected for processing (14)
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.json
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256
  • crates/labcolors-core/contracts/point-support-reference-surplus-q55-bps-proof-v1.json
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/point_support.rs
  • crates/labcolors-core/src/private_fixture.rs
  • crates/labcolors-core/src/program_session.rs
  • crates/labcolors-core/src/session.rs
  • crates/labcolors-core/src/session_tests.rs
  • fixtures/private-program-browser/proof.mjs
  • packages/colors/bench/private-program-wasm.json
  • packages/colors/test/private-program-mutation-contract.test.mjs
  • scripts/test-private-program-mutations.mjs
  • scripts/verify_point_support_surplus.py

Comment thread crates/labcolors-core/src/generic_boundary_tests.rs Outdated
Comment thread crates/labcolors-core/src/private_fixture.rs
Comment thread crates/labcolors-core/src/private_fixture.rs
Comment thread crates/labcolors-core/src/program_session.rs
Comment thread packages/colors/bench/private-program-wasm.json Outdated

@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: 1

Caution

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

⚠️ Outside diff range comments (1)
crates/labcolors-core/src/private_fixture.rs (1)

2304-2324: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Проверьте идентификаторы переоценённых physical cases.

CORE_PROGRAM_ASSESSMENT_CALLS проверяет только количество вызовов. В scan_program_candidate переиспользование выполняется по case_index; ScenarioId хранится отдельно как provenance. При одинаковом opaque render неправильный case может остаться незамеченным. Добавьте test-only witness и проверьте наборы [ScenarioId::new(1)] для частичного обновления, [ScenarioId::new(1), ScenarioId::new(2)] для полного обновления и пустой набор для неизменённого обновления.

🤖 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 `@crates/labcolors-core/src/private_fixture.rs` around lines 2304 - 2324,
Extend the test-only instrumentation around scan_program_candidate to record the
ScenarioId values of re-evaluated physical cases, not just
CORE_PROGRAM_ASSESSMENT_CALLS. Update
single_changed_case_recomputes_only_the_affected_case to assert the witness
contains [ScenarioId::new(1)], and add coverage asserting [ScenarioId::new(1),
ScenarioId::new(2)] for a full update and an empty set for an unchanged update.
🤖 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 `@packages/colors/bench/private-program-wasm.json`:
- Around line 24-29: Обновите запись бюджета в секции policy: замените source на
успешный exact-head run для текущего PR head
4f99f1edb03c81cee302ffc65016561a5fe13dee и установите rawBytes по данным этого
run, не используя данные failed run 31637406587.

---

Outside diff comments:
In `@crates/labcolors-core/src/private_fixture.rs`:
- Around line 2304-2324: Extend the test-only instrumentation around
scan_program_candidate to record the ScenarioId values of re-evaluated physical
cases, not just CORE_PROGRAM_ASSESSMENT_CALLS. Update
single_changed_case_recomputes_only_the_affected_case to assert the witness
contains [ScenarioId::new(1)], and add coverage asserting [ScenarioId::new(1),
ScenarioId::new(2)] for a full update and an empty set for an unchanged update.
🪄 Autofix

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: f2819101-2c0c-4678-a412-c63b2838f29b

📥 Commits

Reviewing files that changed from the base of the PR and between cf9a99d and 4f99f1e.

📒 Files selected for processing (8)
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.json
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/private_fixture.rs
  • crates/labcolors-core/src/program_session.rs
  • packages/colors/bench/private-program-wasm.json
  • packages/colors/test/private-program-mutation-contract.test.mjs
  • scripts/test-private-program-browser.mjs

Comment thread packages/colors/bench/private-program-wasm.json
@lemone112

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

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 merged commit b07178e into main Aug 12, 2026
10 checks passed
@lemone112
lemone112 deleted the feat/incremental-parity branch August 12, 2026 21:33
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