Skip to content

Core: ввести точные family-множества - #491

Merged
lemone112 merged 4 commits into
mainfrom
agent/v5b-family-set
Jul 29, 2026
Merged

Core: ввести точные family-множества#491
lemone112 merged 4 commits into
mainfrom
agent/v5b-family-set

Conversation

@lemone112

@lemone112 lemone112 commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Корневая проблема

Core уже умел сравнивать generic relations, но declared family оставалась неформальной идеей: не было content-addressed exact set, полного generator-image certificate и одного Program constraint. Это оставляло дорогу новым Ladder/neutral/cleanliness recipes и смешивало style identity с частными solver paths.

Изменение

  • один generic exact AdmittedFamilySet над ColorSignal, canonical независимо от порядка и дубликатов;
  • раздельные generator definition, exhaustive image certificate, proof release и content digests;
  • exact membership evaluator + один Program family constraint с типизированными atomic failures;
  • achromatic axis и chromatic line существуют только как proof fixtures одного закона, не production perception profiles;
  • family path не знает cleanliness, readability, backdrop, selection, client roles или token names;
  • membership evidence связывает family digest и queried signal, но не storage-relative rank, insertion position или RGB-neighbours;
  • mutation scope включает family certificate/membership без отката fail-closed harness CI: доказать полноту мутационной популяции #486.

Проверка exact rebased head 7eb86382db1b9d71de350cf3229337260c35edf7

  • cargo test -p labcolors-core --locked: 971 unit passed, 6 ignored; integration suites и 37 doctests PASS;
  • full sRGB8 cube differential против независимого set-oracle;
  • independent Python hashlib golden для generator/image/family identity;
  • cargo fmt --all --check, clippy -D warnings, rustdoc -D warnings: PASS;
  • mutation verifier hostile tests: 49/49; actionlint и diff check: PASS;
  • independent architecture/API/numerics/performance review: PASS до rebase; после единственного .cargo/mutants.toml conflict весь exact-head gate повторён.

Scope boundary

Это V5b foundation. Context-bound Cartesian family provider, exact bitmap runtime codec и certified full-domain materialisation идут следующими V5b2 slices; этот PR не объявляет clean/neutral/human law и не публикует временный authoring API.

Summary by CodeRabbit

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

    • Добавлена поддержка цветовых семейств и проверки принадлежности сигналов к ним.
    • Программы теперь могут объявлять семейства и использовать жёсткие или информационные ограничения членства.
    • Добавлены сертификаты, проверка целостности изображений семейств и диагностические ошибки для некорректных конфигураций.
    • Расширены отчёты и доказательства результатами проверки семейства.
  • Тесты

    • Добавлены проверки каноничности, воспроизводимости, идентичности и устойчивости к повреждённым данным.
  • Технические изменения

    • Обновлена версия контентной идентичности программ и связанные контрольные отпечатки.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 47 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f7e29ad1-7eab-4373-b1ce-326c4c9746f3

📥 Commits

Reviewing files that changed from the base of the PR and between 20c2784 and 08de324.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml
  • crates/labcolors-core/src/constraints/relation.rs
  • crates/labcolors-core/src/family_tests.rs
  • crates/labcolors-core/src/program_identity_tests.rs

Walkthrough

Добавлены проверяемые family-наборы и family membership constraints в labcolors-core. Поддержка проведена через Program API, компиляцию, runtime evidence и content identity V7. Обновлены контрактные хэши, source-binding digest и mutation coverage.

Changes

Family membership

Layer / File(s) Summary
Модель и проверка family-наборов
crates/labcolors-core/src/family.rs, crates/labcolors-core/src/family_tests.rs
Добавлены генераторы, канонические изображения, сертификаты, replay-проверка, identities и membership assessment.
Constraints и Program runtime
crates/labcolors-core/src/constraints/*, crates/labcolors-core/src/program.rs, crates/labcolors-core/src/program_session.rs, crates/labcolors-core/src/program_family_tests.rs
Family membership добавлено в hard/report-only constraints, компиляцию, ошибки, runtime evaluation и typed evidence.
Content identity V7
crates/labcolors-core/src/program_identity.rs, crates/labcolors-core/src/program_identity_tests.rs, crates/labcolors-core/src/*boundary_tests.rs
Program identity переведена на V7 и расширена family vertices, constraint edges и release tags.
Контрактные и проверочные метаданные
.cargo/mutants.toml, crates/labcolors-core/contracts/*, scripts/verify_point_support_surplus.py
Обновлены mutation glob, source capsule digest и хэши receipt/proof-артефактов.

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

Sequence Diagram(s)

sequenceDiagram
  participant DraftV1
  participant prepare_program
  participant FamilySet as AdmittedFamilySetV1
  participant CompiledInvocation as CompiledCoreIntrinsicUnaryInvocationV1
  participant Evidence
  DraftV1->>prepare_program: declare family and membership constraint
  prepare_program->>FamilySet: verify and canonicalize family
  prepare_program->>CompiledInvocation: resolve family index
  CompiledInvocation->>FamilySet: assess actual signal
  FamilySet->>Evidence: return measurement and pass or violation
Loading

Possibly related PRs

  • Labpics-Team/lab-colors#489 — добавляет связанное plumbing для intrinsic-unary constraints и ProgramConstraintContentV1.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.43% 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 Заголовок точно отражает главное изменение: введение точных family-множеств в Core.
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/v5b-family-set

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/labcolors-core/src/constraints/relation.rs (1)

239-293: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Зафиксируйте инвариант, из-за которого assess возвращает Option.

None здесь означает не «нет данных», а нарушение инварианта компиляции: family_index и family синхронно проверяются в compile_constraints и validate_compiled_family_usage. Без короткого комментария следующий читатель может принять None за штатную ветку и обработать её мягким fallback вместо InternalInvariant.

Как per coding guidelines, «Комментарии в коде должны объяснять почему и инвариант, а не пересказывать оператор».

♻️ Предлагаемый комментарий
 impl CompiledCoreIntrinsicUnaryInvocationV1 {
+    /// `None` возвращается только при нарушении инварианта компиляции:
+    /// compile-время связывает `family_index` с `family` и отвергает
+    /// несвязанные ссылки, поэтому runtime обязан трактовать `None` как
+    /// внутреннюю ошибку, а не как отсутствующее измерение.
     pub(crate) fn assess(
🤖 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/constraints/relation.rs` around lines 239 - 293,
Добавьте краткий комментарий непосредственно перед проверкой family в ветке
CompiledCoreIntrinsicUnaryInvocationV1::assess, объясняющий, что None означает
нарушение инварианта компиляции, а не отсутствие данных: family_index должен
указывать на декларацию с соответствующим family благодаря проверкам
compile_constraints и validate_compiled_family_usage. Не пересказывайте сам
оператор и не меняйте поведение метода.

Source: Coding guidelines

🤖 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_tests.rs`:
- Around line 86-111: Сократите тест
axis_membership_matches_the_full_srgb8_cube_oracle, убрав полный перебор 256³
значений, чтобы mutation-прогоны не выполняли дорогостоящую проверку с бинарным
поиском для каждой комбинации. Сохраните полную проверку значений на
равноканальной оси и добавьте ограниченную детерминированную выборку вне оси;
общий закон членства уже покрывается существующим proptest-оракулом.

In `@crates/labcolors-core/src/program_identity_tests.rs`:
- Around line 935-943: Объедините соседние ветки, проверяющие mutation на
FullMutation::CompleteSchemaGolden, в один блок. Внутри этого блока выполните
настройку семейства через declared_family и присвойте результат
program.with_families; уберите промежуточное переприсваивание и отдельную ветку,
возвращающую исходный program, сохранив поведение для остальных мутаций.

In `@crates/labcolors-core/src/program_session.rs`:
- Around line 4749-4769: Текущая реализация canonicalize_and_verify_families не
требует изменения: полная проверка выполняется только на compile-пути и не
затрагивает hot path. Сохраните family.set().verify() сейчас, а при добавлении
V5b2 отдельно установите ограничение размера образа либо кэшируйте результат по
family_content_identity.

---

Outside diff comments:
In `@crates/labcolors-core/src/constraints/relation.rs`:
- Around line 239-293: Добавьте краткий комментарий непосредственно перед
проверкой family в ветке CompiledCoreIntrinsicUnaryInvocationV1::assess,
объясняющий, что None означает нарушение инварианта компиляции, а не отсутствие
данных: family_index должен указывать на декларацию с соответствующим family
благодаря проверкам compile_constraints и validate_compiled_family_usage. Не
пересказывайте сам оператор и не меняйте поведение метода.
🪄 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: 2cf5d2b9-b72b-40a5-bd89-4cb14b579ffa

📥 Commits

Reviewing files that changed from the base of the PR and between de83303 and 20c2784.

📒 Files selected for processing (20)
  • .cargo/mutants.toml
  • 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/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_tests.rs
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/lib.rs
  • crates/labcolors-core/src/program.rs
  • crates/labcolors-core/src/program_boundary_tests.rs
  • crates/labcolors-core/src/program_clean_set_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_relation_tests.rs
  • crates/labcolors-core/src/program_session.rs
  • scripts/verify_point_support_surplus.py

Comment thread crates/labcolors-core/src/family_tests.rs
Comment thread crates/labcolors-core/src/program_identity_tests.rs Outdated
Comment thread crates/labcolors-core/src/program_session.rs
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