Core: ввести точные family-множества - #491
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 47 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 (4)
WalkthroughДобавлены проверяемые family-наборы и family membership constraints в ChangesFamily membership
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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
📒 Files selected for processing (20)
.cargo/mutants.tomlcrates/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/constraints/family.rscrates/labcolors-core/src/constraints/mod.rscrates/labcolors-core/src/constraints/relation.rscrates/labcolors-core/src/family.rscrates/labcolors-core/src/family_tests.rscrates/labcolors-core/src/generic_boundary_tests.rscrates/labcolors-core/src/lib.rscrates/labcolors-core/src/program.rscrates/labcolors-core/src/program_boundary_tests.rscrates/labcolors-core/src/program_clean_set_tests.rscrates/labcolors-core/src/program_family_tests.rscrates/labcolors-core/src/program_identity.rscrates/labcolors-core/src/program_identity_tests.rscrates/labcolors-core/src/program_relation_tests.rscrates/labcolors-core/src/program_session.rsscripts/verify_point_support_surplus.py
Корневая проблема
Core уже умел сравнивать generic relations, но declared family оставалась неформальной идеей: не было content-addressed exact set, полного generator-image certificate и одного Program constraint. Это оставляло дорогу новым
Ladder/neutral/cleanliness recipes и смешивало style identity с частными solver paths.Изменение
AdmittedFamilySetнадColorSignal, canonical независимо от порядка и дубликатов;rank, insertion position или RGB-neighbours;Проверка exact rebased head
7eb86382db1b9d71de350cf3229337260c35edf7cargo test -p labcolors-core --locked: 971 unit passed, 6 ignored; integration suites и 37 doctests PASS;hashlibgolden для generator/image/family identity;cargo fmt --all --check, clippy-D warnings, rustdoc-D warnings: PASS;actionlintи diff check: PASS;.cargo/mutants.tomlconflict весь 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
Новые возможности
Тесты
Технические изменения