feat(core): add transactional point attachment - #478
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 26 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (15)
WalkthroughДобавлены terminal point-attachment и атомарная публикация snapshot-ов через linear sink. Session-переходы переведены на evidence-only API с deferred retirement, добавлена привязка output к point presentation, расширены тесты и receipt/verifier-контракты. ChangesPoint-attachment и публикация
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant OwnerV1
participant Attachment
participant Session
participant LinearPointSinkLeaseV1
OwnerV1->>Attachment: attach bindings and sink lease
Attachment->>Session: prepare_update(update)
Session-->>Attachment: prepared disposition
Attachment->>LinearPointSinkLeaseV1: prepare(intent, patches, stamp)
LinearPointSinkLeaseV1-->>Attachment: proposed stamp
Attachment->>LinearPointSinkLeaseV1: try_install()
Attachment->>Session: commit_deferred()
Attachment->>LinearPointSinkLeaseV1: finish_after_session()
Attachment-->>OwnerV1: AttachmentCommitV1 and render outputs
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 13
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
crates/labcolors-core/src/program_boundary_tests.rs (2)
89-91: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
certificate_countбольше ничего не проверяет.После удаления обхода
operations()переменная только считается и гасится черезlet _ = .... Либо утверждать что-то содержательное (например, что повторный проход даёт то же число), либо убрать её.♻️ Предлагаемое упрощение
- let certificates = exact_size(view.certificates()); - let certificate_count = certificates.len(); - for certificate in certificates { + for certificate in exact_size(view.certificates()) {- let _ = certificate_count; }Also applies to: 190-191
🤖 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/program_boundary_tests.rs` around lines 89 - 91, Remove the unused certificate_count calculation in the certificate iteration within the program boundary tests, including the corresponding occurrence around the second referenced section. Do not retain a suppressed value; only keep the certificate traversal and assertions that provide meaningful validation.
863-889: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueИмя теста осталось в терминах
projection.Остальные тесты в этом слое переименованы под evidence-контракт; здесь
..._commit_returns_the_new_projectionтеперь описываетEvidenceViewV1. Переименование сохранит согласованность номенклатуры.🤖 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/program_boundary_tests.rs` around lines 863 - 889, Переименуйте тест `..._commit_returns_the_new_projection` в терминологию evidence-контракта, используя `EvidenceViewV1` вместо `projection`; поведение и проверки теста оставьте без изменений.crates/labcolors-core/src/generic_boundary_tests.rs (1)
428-465: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueЗапреты по подстроке в целом
PROGRAM_SOURCEхрупки.
"SetV1","RemoveV1","HoldV1"проверяются как подстроки всего файла, поэтому любое будущее легитимное имя (напримерOutputSetV1,ThresholdV1) начнёт валить тест по ложной причине. Стоит привязать запреты к синтаксическим формам (enum SetV1,SetV1 {,-> SetV1), как это уже сделано дляpub(crate) fn project(.🤖 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/generic_boundary_tests.rs` around lines 428 - 465, Уточни проверки запрещённых API в тесте вокруг массива forbidden: замени общие подстроки SetV1, RemoveV1 и HoldV1 на синтаксически специфичные формы объявлений или использования, например enum, структурный вариант и возвращаемый тип, по аналогии с проверкой pub(crate) fn project(. Сохрани запрет на реальные устаревшие sink-authority конструкции, но не блокируй легитимные имена, лишь содержащие эти фрагменты.
🤖 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/appearance.rs`:
- Around line 1943-1951: Упростите occurrence_subject: после успешного
binary_search_by_key напрямую извлекайте элемент по найденному индексу и
возвращайте его subject_id, устранив повторный get и лишнюю недостижимую ветку.
Сохраните Option-поведение для случая, когда поиск не находит occurrence, в
стиле соседних bind_occurrence/occurrence.
In `@crates/labcolors-core/src/program_api_tests.rs`:
- Around line 46-54: Update the test around projection.certificates() and
certificate.outputs() to retain both iterators and assert that each has no
second element after validating the first Verified certificate and certified
Paint output. Preserve the existing assertions for output_slot() and source(),
while explicitly enforcing the single-certificate and single-output contract.
In `@crates/labcolors-core/src/program_mixed_evaluator_tests.rs`:
- Line 732: Rename the evidence-only helper function consume_public_projection
to consume_public_evidence and the associated ProjectionProbe type to
EvidenceProbe. Update all references and usages in the affected tests while
preserving their existing behavior with EvidenceViewV1.
- Line 1524: Удалите тождественные псевдонимы ready_evidence в тестах и
используйте исходную переменную ready напрямую во всех соответствующих
выражениях; примените то же изменение к аналогичным присваиваниям на позициях
1576, 1606 и 1640.
- Around line 2546-2547: Удалите избыточную строку `let _ = owner;` перед
вызовом `assert_projection_matches_model` в соответствующем тесте, оставив
использование `owner` в ветвях `prepare_modeled_payload` и `commit` без
изменений.
In `@crates/labcolors-core/src/program_session_tests.rs`:
- Around line 554-559: Добавьте короткий комментарий перед проверками
output_ordinal() и presentation_ordinal(), поясняющий, что ожидаемое значение 1
основано на каноническом возрастающем порядке числовых ID, где EARLIER_OUTPUT и
EARLIER_PRESENTATION_ROOT имеют меньшие значения. Не изменяйте сами проверки.
In `@crates/labcolors-core/src/program_session.rs`:
- Around line 1398-1416: Добавьте doc-комментарии к вариантам
MissingPresentationTarget и InternalInvariant в enum
PointOutputPresentationBindErrorV1, описав отсутствие цели presentation для
указанного root/occurrence и нарушенный внутренний инвариант соответственно;
остальные варианты и поля не изменяйте.
In `@crates/labcolors-core/src/program/attachment.rs`:
- Around line 827-887: В обработке ConfirmExact сохраните ссылку на validated
published_stamp при построении action и переиспользуйте её при создании
PointSinkIntentV1::ConfirmExact и проверке ConfirmStampMismatch. Удалите
повторные вызовы self.published_stamp.as_ref().ok_or(...) в этих участках,
сохранив существующее поведение для отсутствующего stamp и остальных вариантов
action.
- Around line 507-509: Document the invariant for committed_sink_patch in the
surrounding struct: it is retained as a reusable buffer solely so mem::swap and
clear() preserve its allocation capacity across updates. If the implementation
does not require that capacity-preservation behavior, remove the field and
update the related swap/clear logic accordingly.
- Around line 521-551: Refactor UnpublishedSinkGuardV1 to store L directly
instead of Option<L>, removing the unreachable!() branches from sink() and
accept(). Implement accept(self) by extracting the owned sink while suppressing
Drop with ManuallyDrop, so the guard’s Drop implementation still revokes the
sink unless ownership is successfully accepted.
In `@crates/labcolors-core/src/program/attachment/support.rs`:
- Around line 260-354: Уточните семантику счётчиков в prepare: state.counts.*
сейчас увеличивается до ветки reject_next_prepare и учитывает отклонённые
intent. Переместите инкремент после точки, где prepare уже не может быть
отклонён, чтобы считать только intent, дошедшие до install, либо добавьте явный
комментарий, что счётчики означают предъявленные intent; изменяйте
соответствующую ветку match по intent_kind в prepare.
In `@crates/labcolors-core/src/program/attachment/tests.rs`:
- Around line 606-664: Improve diagnostics in
source_guards_keep_the_post_install_tail_destructor_free by replacing bare
find/split unwraps and contains assertions with explicit assertion messages
identifying the missing source anchor or expected invariant. Preserve the
existing ordering and content checks, but make failures report which symbol or
guard was not found instead of only panicking on Option::unwrap.
In `@scripts/test_verify_clean_set_receipt.py`:
- Around line 464-489: Объедините проверки отсутствующих и изменённых артефактов
в общие параметризованные хелперы, чтобы не дублировать отдельные тесты для
каждой роли. Обновите существующие
`test_product_only_mode_rejects_each_missing_transitive_executor` и
`test_product_only_mode_rejects_each_mutated_transitive_executor` либо их общие
вспомогательные методы, передавая кортеж ролей и соответствующие пути
артефактов; сохраните текущие ожидания ошибок и `subTest` для каждой роли.
---
Outside diff comments:
In `@crates/labcolors-core/src/generic_boundary_tests.rs`:
- Around line 428-465: Уточни проверки запрещённых API в тесте вокруг массива
forbidden: замени общие подстроки SetV1, RemoveV1 и HoldV1 на синтаксически
специфичные формы объявлений или использования, например enum, структурный
вариант и возвращаемый тип, по аналогии с проверкой pub(crate) fn project(.
Сохрани запрет на реальные устаревшие sink-authority конструкции, но не блокируй
легитимные имена, лишь содержащие эти фрагменты.
In `@crates/labcolors-core/src/program_boundary_tests.rs`:
- Around line 89-91: Remove the unused certificate_count calculation in the
certificate iteration within the program boundary tests, including the
corresponding occurrence around the second referenced section. Do not retain a
suppressed value; only keep the certificate traversal and assertions that
provide meaningful validation.
- Around line 863-889: Переименуйте тест `..._commit_returns_the_new_projection`
в терминологию evidence-контракта, используя `EvidenceViewV1` вместо
`projection`; поведение и проверки теста оставьте без изменений.
🪄 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: 5f8aa058-a22c-4c1c-be51-4c64e8855422
📒 Files selected for processing (23)
crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.jsoncrates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256crates/labcolors-core/contracts/point-support-reference-surplus-q55-bps-proof-v1.jsoncrates/labcolors-core/src/appearance.rscrates/labcolors-core/src/appearance_graph_tests.rscrates/labcolors-core/src/generic_boundary_tests.rscrates/labcolors-core/src/program.rscrates/labcolors-core/src/program/attachment.rscrates/labcolors-core/src/program/attachment/support.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_mixed_evaluator_tests.rscrates/labcolors-core/src/program_session.rscrates/labcolors-core/src/program_session_tests.rscrates/labcolors-core/src/session.rscrates/labcolors-core/src/session_tests.rsscripts/test_program_public_surface.pyscripts/test_verify_clean_set_receipt.pyscripts/verify_clean_set_receipt.pyscripts/verify_point_support_surplus.pyscripts/verify_program_public_surface.py
|
Review closure on exact head
Local gates: core all-targets 888 passed / 6 ignored, workspace clippy @coderabbitai review |
|
✅ Action performedReview finished.
|
Результат
Attachment, который линейно владеет Session, точной compiled generation и sink lease;output→sinkиoutput→presentation, проверяет полное fan-out покрытие и пишет физический output ровно один раз;Projection/Set/Removeодним whole-snapshot протоколомSetAll | RevokeAll | ConfirmExact;Доказательства
SetAllswap и послеRevokeAllswap;2bb05b04027f4415e3511db43a324b697f0f1dcee6294ec10c539c2ea6ce65b7, 43 negative controls;9190d17fe46f6588cd26fd0a65eed4956afbffefba7d1ef34e192fcf0922f418(PRODUCT_IDENTITY_VERIFIED; research replay намеренно не заявлен).Проверки
cargo +1.96.0 fmt --all -- --checkcargo +1.96.0 test -p labcolors-core --all-targets --lockedcargo +1.96.0 clippy --workspace --all-targets --locked -- -D warningsRUSTDOCFLAGS='-D warnings' cargo +1.96.0 doc --workspace --no-deps --lockedcargo +1.96.0 package -p labcolors-core --allow-dirty --locked— 129 files, package verify GREENpython3 scripts/verify_point_support_surplus.pypython3 scripts/verify_clean_set_receipt.py product --product-root .python3 -m unittest discover -s scripts -p 'test_verify_clean_set_receipt.py'— 31/31python3 -m unittest discover -s scripts -p 'test_program_public_surface.py'— 8/8Граница
Это O1b-1: приватная транзакционная authority. Немедленный следующий отдельный срез O1b-1a заменит pre-existing open-address
ScenarioIdadmission на bounded deterministic sorts до любого public export.Summary by CodeRabbit
Новые возможности
Исправления
Проверки