core: compile modeled point presentation authority - #470
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (9)
WalkthroughДобавлена поддержка point presentations: roots и targets объявляются через API, валидируются относительно appearance-графа и сохраняются в эпохе программы. Content identity переведён с V2 на V3 с канонизацией presentation-топологии и обновлёнными ошибками и тестами. ChangesКаноническая V3-идентичность
Авторитеты appearance-графа
Контракты presentation и ошибки
Компиляция и выдача presentation
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Program
participant prepare_program
participant compile_point_presentations
participant CompiledAppearanceGraph
participant ProgramEpochV1
Program->>prepare_program: передаёт roots и targets
prepare_program->>compile_point_presentations: запускает компиляцию presentation
compile_point_presentations->>CompiledAppearanceGraph: строит roots и paths
compile_point_presentations->>ProgramEpochV1: сохраняет compiled presentations
ProgramEpochV1-->>Program: предоставляет point presentations
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: 10
🤖 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_graph_tests.rs`:
- Around line 123-153: Дополните тесты уровня appearance-графа рядом с
presentation-root тестами, напрямую проверив для compile_point_presentation_path
соответствующие варианты PointPresentationPathErrorV1: MissingRoot,
MissingTarget и TargetOutsideRootAncestry. Создайте минимальные сценарии с
отсутствующим root, отсутствующей target и target, не являющимся предком
переданного root, сохранив проверки точных типизированных ошибок без опоры на
program-слой.
In `@crates/labcolors-core/src/appearance.rs`:
- Around line 1742-1770: Добавьте комментарий перед циклом обхода, поясняющий,
что compile() через canonical_functional_topology отвергает RenderCycle, поэтому
render-граф ацикличен и цепочка occurrence → backdrop surface → occurrence
завершается не более чем за self.occurrences.len() шагов. Зафиксируйте, что это
также обосновывает try_reserve_exact и предотвращает превращение цикла в
бесконечный при будущих изменениях компилятора.
- Around line 1713-1719: Переименуйте связанную переменную `occurrence` внутри
паттерна `CompiledSurfaceSpec::FromOccurrence` в отличающееся имя, например
`source_occurrence`, и обновите условие сравнения с `terminal.index`; внешний
`occurrence` из `self.occurrences.iter()` не изменяйте.
In `@crates/labcolors-core/src/generic_boundary_tests.rs`:
- Line 1043: Обновите проверку в тесте вокруг PROGRAM_IDENTITY_SOURCE, чтобы она
запрещала литералы обоих retired-доменов: v1 и v2. Сохраните существующую
проверку v1 и добавьте симметричную проверку для
labcolors.program-content-identity.v2.
In `@crates/labcolors-core/src/program_boundary_tests.rs`:
- Around line 222-345: Define shared module-level constants for the occurrence,
paint, and surface identifiers currently hard-coded inside fixed_nested_draft,
then update that helper and all presentation tests to use those constants
instead of directly constructing the private values. Preserve the existing
terminal, target, paint, and surface semantics.
In `@crates/labcolors-core/src/program_identity.rs`:
- Around line 560-564: Document the invariant beside the construction of
presentation_targets: each (root, occurrence) pair must already be unique before
compile_program_content_identity_v3 runs, because this flow does not deduplicate
targets and duplicates would create multiple equivalent vertices. Reference
compile_point_presentations as the step responsible for enforcing this
precondition, and keep the invariant aligned with the later presentation-target
processing.
In `@crates/labcolors-core/src/program_session.rs`:
- Around line 3247-3254: Перенесите проверку `UnusedPresentationRoot` для
каждого `root` из финального участка компиляции сразу после дедупликации
`targets`, до дорогого обхода ancestry. Используйте существующий поиск по
`targets` и возвращайте ту же ошибку
`ProgramCompileError::UnusedPresentationRoot`; позднюю дублирующую проверку
удалите.
- Around line 1302-1326: Replace the anonymous five-element tuple returned by
point_presentations with a self-describing public view, preferably an
&[CompiledPointPresentationV1] projection or a small public view type exposing
named getters for terminal, target, and path length. Update the
iterator/signature and mapping so callers no longer need to distinguish adjacent
OccurrenceId values or infer the usize field’s meaning positionally.
- Around line 3209-3216: Уберите получение terminal через индекс roots в цикле
обработки targets. Храните terminal вместе с каждым элементом compiled_roots
либо используйте terminal() у соответствующего compiled-объекта, чтобы значение
извлекалось напрямую и ветка InternalInvariant для несогласованности коллекций
больше не требовалась.
In `@crates/labcolors-core/src/program.rs`:
- Around line 437-444: Add complete /// documentation for the new
presentation-related variants in CompileErrorKindV1 and CompileErrorV1,
including DuplicatePresentationRoot, MissingPresentationRootOccurrence,
PresentationRootConsumedDownstream, UnusedPresentationRoot,
DuplicatePointPresentationTarget, MissingPointPresentationRoot,
MissingPointPresentationOccurrence, and
PointPresentationOccurrenceOutsideRootAncestry. Document every associated root,
occurrence, and terminal field, explicitly distinguishing the node represented
by terminal from the occurrence node, and match the existing public error
documentation style.
🪄 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: d36f0ace-171f-4272-86af-824eac3cad7c
📒 Files selected for processing (9)
crates/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_api_tests.rscrates/labcolors-core/src/program_boundary_tests.rscrates/labcolors-core/src/program_identity.rscrates/labcolors-core/src/program_identity_tests.rscrates/labcolors-core/src/program_session.rs
Что изменено
PresentationRootтолько для terminal point occurrence;BypassOwnBackdropV1и root/target topology связаны новымProgramContentIdentityV3;Зачем
Непрозрачный
OccurrenceIdсам по себе не доказывает final modeled presentation. Этот срез создаёт compiler-owned causal authority перед exact counterfactual replay и сертификатом O1a, не выдавая modeled point за renderer/attachment/actual sink.Граница среза
Здесь намеренно нет runtime replay, изменений Session lifecycle, renderer/attachment API, сертификата causal domain или переименования output surface. Они идут следующими вертикальными срезами поверх этого authority.
Review
Clone/Eqsemantics graph instance;Проверки exact head
5aca75fcargo test --workspace --all-targets;-D warnings;-D warnings;Product commit:
fc93a46. Первый proof rebind:56ba331. Review closure + final canonical proof rebind:5aca75f.Summary by CodeRabbit