Core: атомизировать конечные Paint-кандидаты - #485
Conversation
WalkthroughPR переводит контентную идентичность программы labcolors-core с V3 на V4 (новый доменный преимидж, ChangesV4 Content Identity и PaintValue кандидаты
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()
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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
📒 Files selected for processing (15)
crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.jsoncrates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256crates/labcolors-core/src/generic_boundary_tests.rscrates/labcolors-core/src/program.rscrates/labcolors-core/src/program/attachment/tests.rscrates/labcolors-core/src/program_api_tests.rscrates/labcolors-core/src/program_boundary_tests.rscrates/labcolors-core/src/program_clean_set_tests.rscrates/labcolors-core/src/program_identity.rscrates/labcolors-core/src/program_identity_tests.rscrates/labcolors-core/src/program_joint_integration_tests.rscrates/labcolors-core/src/program_mixed_evaluator_tests.rscrates/labcolors-core/src/program_point_causality_tests.rscrates/labcolors-core/src/program_session.rsdocs/whitepaper.md
Результат
Finite target больше не хранит цвет отдельно от opacity: каждый допустимый кандидат — одна атомарная
EncodedPointPaintValueV1 { source, opacity }. Это запрещает solver-у образовывать Cartesian-product комбинации, которых клиент не объявлял.Контракт
PaintValueV1и канонизирует signed zero;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;be3f324c6931d7aa967c5941c3b7c841711e36cef75468dea636662a9e7b0a9b, hostile verifier 31/31: PASS;1.0против выбранного0.5; после возврата production path end-to-end test GREEN.Refs #419.
Summary by CodeRabbit
Новые возможности
Исправления
Документация