Skip to content

Core: отделить semantic family от runtime artifact - #492

Merged
lemone112 merged 3 commits into
mainfrom
agent/v5b2p-artifact-boundary
Jul 29, 2026
Merged

Core: отделить semantic family от runtime artifact#492
lemone112 merged 3 commits into
mainfrom
agent/v5b2p-artifact-boundary

Conversation

@lemone112

@lemone112 lemone112 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Что изменено

  • Program хранит только FamilyId → SemanticFamilyReleaseIdV2; codec bytes и artifact receipt исключены из Program identity и membership evidence.
  • Добавлен единственный content-bound loader precursor: envelope, proof/verifier identity, payload digest, semantic release и receipt проверяются до executable view; production неизвестный codec отклоняет fail-closed.
  • Exact admitted storage принадлежит Session/Attachment generation и освобождается при lifecycle teardown, независимо от внешнего Owner.
  • Один semantic artifact обслуживает несколько opaque aliases; missing/extra/duplicate диагностируются канонически и не зависят от client ID.
  • Cold retry возвращает те же owned bytes или уже подготовленную Session без refetch/redecode/reallocation.
  • Удалены прежняя V1 family implementation, второй attach facade и совместимые zombie-типы.

Почему

Предыдущая модель смешивала смысл точного family-set, его storage representation и lifetime владельца. Это делало Program identity зависимой от codec, создавало второй источник истины и вынуждало повторять дорогую подготовку при host retry. Срез V5b2p проводит границу перед первым production codec (RawBitmap24, следующий V5b2a), не добавляя временный public API.

Проверка

  • cargo +1.96.0 test --workspace --all-targets --no-fail-fast — PASS; core 976 passed, 6 ignored.
  • cargo +1.96.0 clippy --workspace --all-targets --all-features -- -D warnings — PASS.
  • cargo +1.96.0 fmt --all -- --check и git diff --check — PASS.
  • RUSTDOCFLAGS='-D warnings' cargo +1.96.0 doc --workspace --no-deps — PASS.
  • Targeted: family artifact 21/21, Program family 16/16, Attachment 35/35.
  • Два независимых read-only review — PASS после одного test-only Clippy fix.
  • Mutation gate: исходная популяция 246 выявила 9 survived и 1 timeout; после структурных исправлений финальная delta 13/13 учтена — 7 killed, 6 unviable, 0 survived, 0 timeout; три redacted-Debug мутанта отдельно 3/3 killed.
  • Baseline mutation harness: 1078 passed, 7 ignored, 0 failed; ручной индекс итератора, ложный ResourceExhausted и equality владеющего artifact удалены из пространства состояний.
  • Exact product receipt — VERIFIED; 31 hostile verifier tests — PASS.
  • Point-support source binding 5/5 и независимый proof replay — PASS.
  • PR остаётся draft до финального CI и внешнего review.

Summary by CodeRabbit

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

    • Поддержка семантических семейных релизов и семейных артефактов версии V2.
    • Загрузка, валидация целостности и канонизация семейных изображений при работе с артефактами.
    • Привязка семейных артефактов к программам и выполнение оценок по семантике.
  • Изменения

    • Обновлены API создания программ/сессий и подключений: передача family-artifacts при инстанцировании и при повторных попытках.
    • Повышена точность ошибок для повреждённых/несовпадающих артефактов.
  • Тесты

    • Расширены проверки каноничности, корректности семантики и безопасного восстановления после отказов.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e11ebfa6-e60c-4e74-9221-3e39c3425fe3

📥 Commits

Reviewing files that changed from the base of the PR and between cf9ce40 and 48c034c.

📒 Files selected for processing (10)
  • 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/contracts/point-support-reference-surplus-q55-bps-proof-v1.json
  • crates/labcolors-core/src/family.rs
  • crates/labcolors-core/src/family_artifact.rs
  • crates/labcolors-core/src/family_artifact_tests.rs
  • crates/labcolors-core/src/program/attachment/tests.rs
  • crates/labcolors-core/src/program_family_tests.rs
  • crates/labcolors-core/src/program_identity.rs
  • scripts/verify_point_support_surplus.py

Walkthrough

Добавлена V2-модель family: семантические релизы отделены от транспортных receipts, артефакты проходят строгую загрузку и связывание, а program/session/attachment используют сохранённые V2-артефакты и retry-состояния.

Changes

Family V2 и артефакты

Layer / File(s) Summary
Семантические family-контракты
crates/labcolors-core/src/family.rs, constraints/*, program_identity*, program.rs
Добавлены V2 digest-типы, semantic release, membership measurement и обновлено кодирование family identity и constraints.
Загрузка и связывание артефактов
crates/labcolors-core/src/family_artifact.rs, family_artifact_tests.rs, lib.rs
Добавлены certificates, owned transport bytes, строгий loader, admitted artifacts, bind по semantic release и проверки ошибок/мутаций.
Инстанцирование и runtime evaluation
program_session.rs, program_family_tests.rs
Program и Session переведены на V2 declarations, required releases и bound artifacts; family membership получает evidence из runtime bundle.
Attachment pipeline и retry
program/attachment.rs, program/attachment/tests.rs, session.rs
attach принимает family artifacts, разделяет cold preparation и admission, а retry сохраняет необходимые ресурсы и execution bindings.
Контрактные отпечатки
contracts/..., scripts/verify_point_support_surplus.py
Обновлены размеры и SHA-256 отпечатки изменённых исходных артефактов и semantic source capsule.

Estimated code review effort: 5 (Critical) | ~120 minutes

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок кратко и точно отражает основное изменение: разделение semantic family и runtime artifact.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/v5b2p-artifact-boundary

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

@lemone112

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 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: 5

🤖 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/family_artifact.rs`:
- Around line 1003-1054: Уберите недостижимую дублирующую ветку Err из цикла
bind после предварительной проверки semantic в начале функции. В цикле по
declarations используйте поиск, который выражает гарантированный успех
(например, преобразование результата в значение с обработкой структурного
инварианта), сохранив получение artifact_index, отметку used и добавление в
slots; предварительную проверку и канонический порядок диагностики не изменяйте.
- Line 29: Добавьте краткие комментарии к константам MAX_SRGB8_MEMBER_COUNT_V1 и
HEADER_LEN_V2, описав их инварианты: первая равна полной кардинальности
sRGB8-домена (1 << 24), а вторая соответствует точной длине раскладки
сертификата, используемой encode_certificate и decode_certificate. Укажите
состав полей HEADER_LEN_V2 и отметьте, что изменение формата сертификата требует
синхронного обновления этой константы.

In `@crates/labcolors-core/src/family.rs`:
- Around line 168-200: Replace the inline schema-version literals in the
canonical image and semantic release hashing paths with named constants declared
near the corresponding domain constants. Use distinct constants for the
independently versioned encodings, and update the hashing calls in the canonical
image digest logic and semantic_family_release_id_v2 to reference them.

In `@crates/labcolors-core/src/program_family_tests.rs`:
- Around line 762-794: Update
missing_loaded_artifact_is_rejected_before_a_session_exists to assert that
FAMILY_MEMBERSHIP_ASSESS_CALLS remains zero after the failed
instantiate_with_family_artifacts call, before retrying with the returned
artifact bundle. Keep the existing failure-cause and successful-retry assertions
unchanged.

In `@crates/labcolors-core/src/program_identity.rs`:
- Around line 26-27: Проверьте использование FAMILY_CERTIFICATE_VERTEX_V1 и
FAMILY_MEMBERSHIP_RELEASE_V1 в program identity: если они нужны только тестам,
добавьте для обеих констант #[cfg(test)]; иначе оставьте их в релизной схеме и
добавьте короткий комментарий, фиксирующий, что значения 1 не должны
переиспользоваться.
🪄 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: 3e0bfcf3-6170-4847-b784-4ceb62d418c4

📥 Commits

Reviewing files that changed from the base of the PR and between 3c97cd7 and cf9ce40.

📒 Files selected for processing (16)
  • crates/labcolors-core/src/constraints/family.rs
  • crates/labcolors-core/src/constraints/mod.rs
  • crates/labcolors-core/src/constraints/relation.rs
  • crates/labcolors-core/src/family.rs
  • crates/labcolors-core/src/family_artifact.rs
  • crates/labcolors-core/src/family_artifact_tests.rs
  • crates/labcolors-core/src/family_tests.rs
  • crates/labcolors-core/src/lib.rs
  • crates/labcolors-core/src/program.rs
  • crates/labcolors-core/src/program/attachment.rs
  • crates/labcolors-core/src/program/attachment/tests.rs
  • crates/labcolors-core/src/program_family_tests.rs
  • crates/labcolors-core/src/program_identity.rs
  • crates/labcolors-core/src/program_identity_tests.rs
  • crates/labcolors-core/src/program_session.rs
  • crates/labcolors-core/src/session.rs
💤 Files with no reviewable changes (1)
  • crates/labcolors-core/src/family_tests.rs

Comment thread crates/labcolors-core/src/family_artifact.rs
Comment thread crates/labcolors-core/src/family_artifact.rs Outdated
Comment thread crates/labcolors-core/src/family.rs Outdated
Comment thread crates/labcolors-core/src/program_family_tests.rs
Comment thread crates/labcolors-core/src/program_identity.rs
@lemone112

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 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 29, 2026 06:48
@lemone112
lemone112 merged commit 35a7514 into main Jul 29, 2026
10 checks passed
@lemone112
lemone112 deleted the agent/v5b2p-artifact-boundary branch July 29, 2026 06:54
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