Skip to content

Core: атомизировать конечные Paint-кандидаты - #485

Merged
lemone112 merged 6 commits into
mainfrom
agent/v3b-atomic-paint-candidates
Jul 28, 2026
Merged

Core: атомизировать конечные Paint-кандидаты#485
lemone112 merged 6 commits into
mainfrom
agent/v3b-atomic-paint-candidates

Conversation

@lemone112

@lemone112 lemone112 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Результат

Finite target больше не хранит цвет отдельно от opacity: каждый допустимый кандидат — одна атомарная EncodedPointPaintValueV1 { source, opacity }. Это запрещает solver-у образовывать Cartesian-product комбинации, которых клиент не объявлял.

Контракт

  • admission создаёт конечный PaintValueV1 и канонизирует signed zero;
  • дубликат определяется по полной паре source+opacity; один source с разными alpha допустим;
  • hot selection применяет всю пару одной операцией и затем проходит обычные output/fresh-recheck gates;
  • terminal attachment переносит ту же пару в sink snapshot и render authority;
  • fixed target остаётся opaque;
  • Program identity hard-cut: V3 удалён, V4 включает canonical opacity bits каждого кандидата;
  • старые signal-only constructors/accessors и V3 aliases удалены;
  • public package/WASM surface и point-support mathematical claim не меняются.

Hostile witness: white@0.25 и #404040@1 оба дают #404040 на чёрном, но только выдуманный split-кандидат white@1 прошёл бы hard-white constraint. Реальный atomic domain корректно возвращает conflict с двумя проверенными состояниями.

Проверка

Exact head: f1bbe6940ae48efc75d1d2729eb9c7f9fe727f49.

  • cargo +1.96.0 test -p labcolors-core --locked: PASS; Core 928 passed, 6 ignored, integration и doctests PASS;
  • fmt: PASS; final-head workspace/MSRV/clippy/rustdoc/WASM/native checks выполняются в CI;
  • clean-set product receipt be3f324c6931d7aa967c5941c3b7c841711e36cef75468dea636662a9e7b0a9b, hostile verifier 31/31: PASS;
  • point-support source binding 5/5 и independent verifier: PASS;
  • property admission roundtrip, anti-Cartesian differential и targeted manual mutants: PASS;
  • terminal alpha-loss mutant дал RED: sink 1.0 против выбранного 0.5; после возврата production path end-to-end test GREEN.

Refs #419.

Summary by CodeRabbit

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

    • Значения конечных кандидатов теперь учитывают исходный цвет и прозрачность, обеспечивая более точное сопоставление и сохранение альфа-канала при обработке.
    • Обновлена версия контентной идентичности программы до V4; изменения прозрачности влияют на идентификатор.
  • Исправления

    • Уточнено обнаружение дубликатов физических кандидатов.
    • Обновлены проверки совместимости и контрольные данные для новой версии идентичности.
  • Документация

    • Уточнено описание обработки цветов, прозрачности и композиции в документации.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

PR переводит контентную идентичность программы labcolors-core с V3 на V4 (новый доменный преимидж, ContentIdentityV4, compile_program_content_identity_v4), а кандидатов таргетов — с сигналов Srgb8/ColorSignal на физическое значение PaintValueV1/EncodedPointPaintValueV1 (source + straight alpha). Переименована ошибка дублей кандидатов, обновлены тесты, receipt-контракты и whitepaper.

Changes

V4 Content Identity и PaintValue кандидаты

Layer / File(s) Summary
Доменная схема V4 и её экспонирование
crates/labcolors-core/src/program_identity.rs, src/program.rs, src/program_session.rs, src/generic_boundary_tests.rs
Domain/версионный преимикс переключён на V4, добавлена compile_program_content_identity_v4, введён ContentIdentityV4, методы content_identity() у Owner/сертификатов/отчётов возвращают новый тип; граничные тесты проверяют отсутствие legacy V1-V3 идентификаторов и наличие V4.
TargetCandidate: переход на PaintValue
src/program.rs, src/program_session.rs, src/program_identity.rs
TargetCandidateV1::new и внутреннее представление переведены на PaintValueV1/EncodedPointPaintValueV1; DuplicateTargetCandidateSignal переименован в DuplicateTargetCandidateValue; compile_targets/apply_joint_candidate и кодирование кандидата в identity-preimage используют encoded value.
Тесты PaintValueV1 API
src/program_api_tests.rs
Добавлены тесты на ошибки try_new (NaN/Infinity/диапазон), каноникализацию -0.0 и property-based round-trip source/opacity.
Attachment-тесты
src/program/attachment/tests.rs
Кандидаты переведены на PaintValueV1::opaque, добавлен тест на atomic доставку полупрозрачного paint в sink.
Граничные тесты
src/program_boundary_tests.rs
Обновлён импорт ContentIdentityV4, кандидаты переведены на PaintValueV1, добавлен тест на отсутствие декартова произведения source/opacity.
Тесты чистого набора
src/program_clean_set_tests.rs
Кандидаты переведены на PaintValueV1::opaque, хелпер идентичности возвращает ContentIdentityV4.
Golden/opacity-тесты идентичности
src/program_identity_tests.rs
Golden-тесты переименованы под V4, добавлена параметризация по opacity и тест влияния opacity на content identity.
Интеграционные тесты admitted opacity
src/program_joint_integration_tests.rs, src/program_mixed_evaluator_tests.rs, src/program_point_causality_tests.rs
Кандидаты переведены на EncodedPointPaintValueV1, переименован тест дублей, добавлены тесты на opacity-различие и content identity.
Receipt-контракты
crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.json, receipt-v1.sha256
Обновлены bytes/sha256 изменённых исходников и итоговый хэш receipt-файла.
Whitepaper
docs/whitepaper.md
Уточнено описание Target как неделимой пары source+alpha и запрет декартовых комбинаций.

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

Sequence Diagram(s)

sequenceDiagram
  participant Test
  participant TargetCandidateV1
  participant compile_targets
  participant program_identity
  participant ProgramContentIdentityV4
  Test->>TargetCandidateV1: new(id, PaintValueV1)
  TargetCandidateV1->>compile_targets: value (source + opacity_bits)
  compile_targets->>compile_targets: sort/detect duplicates by encoded value
  compile_targets->>program_identity: candidate_color(candidate.value())
  program_identity->>ProgramContentIdentityV4: sha256(DOMAIN_V4 preimage)
  ProgramContentIdentityV4-->>Test: content_identity()
Loading

Possibly related issues

Possibly related PRs

  • Labpics-Team/lab-colors#162: обновляет тот же раздел docs/whitepaper.md, описывающий point-domain модель.
  • Labpics-Team/lab-colors#361: вводит те же физические типы EncodedPointPaint*, заменяющие сигнальные представления.
  • Labpics-Team/lab-colors#470: продолжает версионирование ProgramContentIdentity (V3→V4), начатое в этом PR.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 Заголовок кратко и точно отражает основное изменение: атомизацию конечных Paint-кандидатов в Core.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/v3b-atomic-paint-candidates

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

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 28, 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.

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

🤖 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/program_api_tests.rs`:
- Around line 97-99: В тесте с параметром opacity_numerator вынесите значение
1024 в именованную константу, используемую и в диапазоне генератора, и при
вычислении opacity; добавьте комментарий, фиксирующий инвариант шага сетки,
чтобы эти значения оставались согласованными.

In `@crates/labcolors-core/src/program_joint_integration_tests.rs`:
- Around line 2114-2132: Усильте тест
equal_sources_with_distinct_opacity_are_distinct_admitted_candidates: после
проверки успешной компиляции выполните instantiate и commit для состояний FIRST
и SECOND, затем проверьте в output.paint().opacity_bits(), что сохранены разные
значения opacity_bits, соответствующие opacity 0.25 и 0.75. Следуйте паттерну
selected_atomic_candidate_preserves_opacity_through_fresh_recheck_and_output,
сохранив проверку distinct admission.

In `@docs/whitepaper.md`:
- Around line 96-104: В абзаце, описывающем реализованный point-домен приватного
appearance-графа, замените пояснительные англоязычные термины на русские:
используйте «точечный домен», «граф внешнего вида», «источник» и «исходная
прямая альфа», а также русское обозначение host. Сохраните кодовые
идентификаторы Paint::Input, Paint::Opacity, Occurrence и
Surface::FromOccurrence.
🪄 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: 3d9202b5-6e8e-422c-be1f-23dc93cc44d8

📥 Commits

Reviewing files that changed from the base of the PR and between 7d358fd and 6269902.

📒 Files selected for processing (15)
  • 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/program.rs
  • crates/labcolors-core/src/program/attachment/tests.rs
  • crates/labcolors-core/src/program_api_tests.rs
  • crates/labcolors-core/src/program_boundary_tests.rs
  • crates/labcolors-core/src/program_clean_set_tests.rs
  • crates/labcolors-core/src/program_identity.rs
  • crates/labcolors-core/src/program_identity_tests.rs
  • crates/labcolors-core/src/program_joint_integration_tests.rs
  • crates/labcolors-core/src/program_mixed_evaluator_tests.rs
  • crates/labcolors-core/src/program_point_causality_tests.rs
  • crates/labcolors-core/src/program_session.rs
  • docs/whitepaper.md

Comment thread crates/labcolors-core/src/program_api_tests.rs Outdated
Comment thread crates/labcolors-core/src/program_joint_integration_tests.rs
Comment thread docs/whitepaper.md Outdated
@lemone112
lemone112 merged commit cc8245f into main Jul 28, 2026
10 checks passed
@lemone112
lemone112 deleted the agent/v3b-atomic-paint-candidates branch July 28, 2026 05:31
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