Skip to content

core: compile modeled point presentation authority - #470

Merged
lemone112 merged 3 commits into
mainfrom
agent/o1a-compiler-authority
Jul 27, 2026
Merged

core: compile modeled point presentation authority#470
lemone112 merged 3 commits into
mainfrom
agent/o1a-compiler-authority

Conversation

@lemone112

@lemone112 lemone112 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Что изменено

  • compiler минтит типизированный PresentationRoot только для terminal point occurrence;
  • target допускается только в доказанной target→root ancestry того же compiled graph instance;
  • authored root/target declarations компилируются на cold edge с закрытыми типизированными ошибками;
  • versioned absence law BypassOwnBackdropV1 и root/target topology связаны новым ProgramContentIdentityV3;
  • V2 identity удалена hard cut без alias/compatibility shim;
  • наружу не протекает промежуточный tuple/view API: текущая граница выдаёт только требуемый count.

Зачем

Непрозрачный 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

  • независимый exact-diff review исходного продукта: CLEAN; семь hostile production-mutants дали RED;
  • собственное root-review удалило ложные Clone/Eq semantics graph instance;
  • 10 CodeRabbit threads проверены по текущему коду: 9 исправлены, 1 withdrawn после hostile-теста на deterministic multi-error precedence;
  • unresolved review threads: 0.

Проверки exact head 5aca75f

  • Rust 1.96: cargo test --workspace --all-targets;
  • Rust 1.96: workspace all-target clippy с -D warnings;
  • Rust 1.85: workspace all-target MSRV check;
  • rustdoc workspace с -D warnings;
  • rustfmt и diff check;
  • point-support canonical proof replay: PASS, 43 source negative controls;
  • alpha-renaming/declaration-order, relation/multiplicity mutation, V3 goldens;
  • direct typed appearance errors, foreign graph authority и combined-invalidity precedence.

Product commit: fc93a46. Первый proof rebind: 56ba331. Review closure + final canonical proof rebind: 5aca75f.

Summary by CodeRabbit

  • Новые возможности
    • Добавлена поддержка точечных представлений: можно задавать корневые точки и целевые occurrence-элементы.
    • Реализована проверка принадлежности целей ancestry корня и корректности терминальных элементов.
    • Добавлены подробные ошибки компиляции для отсутствующих, дублирующихся, неиспользуемых и несовместимых объявлений.
    • Добавлен подсчёт точечных представлений в скомпилированной программе.
  • Изменения
    • Идентификаторы содержимого программ обновлены до версии V3.
    • Улучшена привязка презентационных данных к конкретному скомпилированному графу.
  • Тесты
    • Расширено покрытие сценариев успешной компиляции и диагностических ошибок.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a79bfb03-fb6b-4e48-8d26-505ca7db9321

📥 Commits

Reviewing files that changed from the base of the PR and between 56ba331 and 5aca75f.

📒 Files selected for processing (9)
  • crates/labcolors-core/contracts/point-support-reference-surplus-q55-bps-proof-v1.json
  • crates/labcolors-core/src/appearance.rs
  • crates/labcolors-core/src/appearance_graph_tests.rs
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/program.rs
  • crates/labcolors-core/src/program_boundary_tests.rs
  • crates/labcolors-core/src/program_identity.rs
  • crates/labcolors-core/src/program_session.rs
  • scripts/verify_point_support_surplus.py

Walkthrough

Добавлена поддержка point presentations: roots и targets объявляются через API, валидируются относительно appearance-графа и сохраняются в эпохе программы. Content identity переведён с V2 на V3 с канонизацией presentation-топологии и обновлёнными ошибками и тестами.

Changes

Каноническая V3-идентичность

Layer / File(s) Summary
Канонизация и V3 API
crates/labcolors-core/src/program_identity.rs, crates/labcolors-core/src/program.rs, crates/labcolors-core/src/program_identity_tests.rs, crates/labcolors-core/src/generic_boundary_tests.rs
Content identity переведён с V2 на V3; canonical graph включает presentation roots, targets и связи между ними. Обновлены golden-тесты и проверки V3-констант.

Авторитеты appearance-графа

Layer / File(s) Summary
Компиляция корней и путей
crates/labcolors-core/src/appearance.rs, crates/labcolors-core/src/appearance_graph_tests.rs
Скомпилированный граф получил instance-токен, а методы компилируют root authority и ancestry-пути с проверкой принадлежности графу и структурированных ошибок.

Контракты presentation и ошибки

Layer / File(s) Summary
Объявления и типизированные ошибки
crates/labcolors-core/src/program.rs, crates/labcolors-core/src/program_session.rs
Добавлены идентификаторы, root/target API, builder-методы и варианты ошибок для дубликатов, отсутствующих связей, неиспользованных roots и выхода за ancestry.

Компиляция и выдача presentation

Layer / File(s) Summary
Сборка и проверка
crates/labcolors-core/src/program_session.rs, crates/labcolors-core/src/program_api_tests.rs, crates/labcolors-core/src/program_boundary_tests.rs, crates/labcolors-core/src/program_identity_tests.rs, crates/labcolors-core/contracts/..., scripts/verify_point_support_surplus.py
Pipeline компилирует point presentations, сохраняет их в ProgramEpochV1, обновляет identity-проекции и проверяется API-, boundary- и golden-тестами.

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
Loading

Possibly related PRs

  • Labpics-Team/lab-colors#310 — использует ту же основу appearance-графа и расширяет CompiledAppearanceGraph.
  • Labpics-Team/lab-colors#466 — связан с обновлением proof-хэшей, зависящих от appearance.rs.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 64.84% 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 Заголовок кратко и точно отражает основное изменение: компиляцию авторитетности point presentation в 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/o1a-compiler-authority

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

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

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

@lemone112
lemone112 marked this pull request as ready for review July 27, 2026 00:29

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3e6814f and fc93a46.

📒 Files selected for processing (9)
  • crates/labcolors-core/src/appearance.rs
  • crates/labcolors-core/src/appearance_graph_tests.rs
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/program.rs
  • crates/labcolors-core/src/program_api_tests.rs
  • crates/labcolors-core/src/program_boundary_tests.rs
  • crates/labcolors-core/src/program_identity.rs
  • crates/labcolors-core/src/program_identity_tests.rs
  • crates/labcolors-core/src/program_session.rs

Comment thread crates/labcolors-core/src/appearance_graph_tests.rs
Comment thread crates/labcolors-core/src/appearance.rs
Comment thread crates/labcolors-core/src/appearance.rs
Comment thread crates/labcolors-core/src/generic_boundary_tests.rs
Comment thread crates/labcolors-core/src/program_boundary_tests.rs
Comment thread crates/labcolors-core/src/program_identity.rs
Comment thread crates/labcolors-core/src/program_session.rs Outdated
Comment thread crates/labcolors-core/src/program_session.rs Outdated
Comment thread crates/labcolors-core/src/program_session.rs
Comment thread crates/labcolors-core/src/program.rs
@lemone112
lemone112 marked this pull request as draft July 27, 2026 00:52
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