Skip to content

core: isolate LCS as an explicit Program capability - #467

Merged
lemone112 merged 3 commits into
mainfrom
agent/program-capability-boundary
Jul 26, 2026
Merged

core: isolate LCS as an explicit Program capability#467
lemone112 merged 3 commits into
mainfrom
agent/program-capability-boundary

Conversation

@lemone112

@lemone112 lemone112 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Результат

Encoded-only Exact/WCAG Program path больше не строит LCS и не включает неиспользуемые LCS/XYZ releases в content identity. LCS оформлен отдельным occurrence-scoped lazy capability: target и evidence минтятся атомарно из одной физической occurrence, а успех и ошибка derivation кешируются на scope.

Доказательства

  • RED→GREEN на двух LCS constraints / одной occurrence: одна derivation, включая failure.
  • Hostile equal-bytes/context test не позволяет смешать provenance разных физических occurrences.
  • Exact/WCAG дают ноль LCS/CAM16 derivations и работают при LCS-incompatible context.
  • Mutation LCS release меняет только LCS-aware constraint identity.
  • Point-support proof перевязан на полный новый source cone.

Проверки

  • cargo +1.96.0 test --workspace --all-features --locked
  • cargo +1.96.0 clippy --workspace --all-targets --all-features --locked -- -D warnings
  • cargo +1.85.0 check -p labcolors-core --lib --locked
  • cargo +1.96.0 fmt --all -- --check
  • python3 scripts/test_point_support_surplus_source_binding.py
  • python3 scripts/verify_point_support_surplus.py
  • git diff --check

Независимый final review выполняется на frozen exact head до ready/merge.

Summary by CodeRabbit

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

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

    • Упрощены encoded-only проверки: они больше не запускают вычисление LCS.
    • Обновлены идентификаторы и проверки сертификатов, а также контрольные значения целостности.
    • Уточнены диагностические сообщения и обработка ошибок оценки.

@coderabbitai

coderabbitai Bot commented Jul 26, 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: 2 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: da8ddd72-e47e-4892-aaf7-c4c2e227e646

📥 Commits

Reviewing files that changed from the base of the PR and between 3d24f17 and f4da10d.

📒 Files selected for processing (8)
  • 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_identity_tests.rs
  • crates/labcolors-core/src/program_lcs_integration_tests.rs
  • crates/labcolors-core/src/program_mixed_evaluator_tests.rs
  • crates/labcolors-core/src/program_session.rs

Walkthrough

Изменён evaluation-путь программных ограничений: physical evidence и declared appearance context отделены от lazy LCS capability. Session-план больше не хранит modeled LCS, identity-кодирование разделено по типам ограничений, а тесты и proof-хэши обновлены.

Changes

Разделение physical evidence и LCS capability

Layer / File(s) Summary
Контракты targets, bindings и LCS capability
crates/labcolors-core/src/constraints/mod.rs, crates/labcolors-core/src/lcs_occurrence.rs, crates/labcolors-core/src/program.rs
Базовые targets и bindings используют encoded physical data и declared context; LCS-aware targets, adapter, evidence и assessment выделены в отдельный typed API. Связанные modeled-tristimulus типы и инварианты удалены.
Session evaluation через declared context
crates/labcolors-core/src/program_session.rs
Evaluator dispatch принимает ProgramPointOccurrenceV1, session plan удаляет modeled-occurrence cache, а compiled constraints используют occurrence_context_index.
Identity encoding и release separation
crates/labcolors-core/src/program_identity.rs, crates/labcolors-core/src/program_identity_tests.rs
LCS release включается только в LCS-aware constraint content; root и signal encoding очищены от прежних modeled-LCS и transform tags, golden digests обновлены.
Boundary и integration validation
crates/labcolors-core/src/*boundary_tests.rs, crates/labcolors-core/src/*integration_tests.rs, crates/labcolors-core/src/program_mixed_evaluator_tests.rs
Тесты проверяют physical bindings, declared contexts, lazy derivation, memoization и отсутствие LCS-построения для encoded-only evaluators.
Обновление proof binding
crates/labcolors-core/contracts/point-support-reference-surplus-q55-bps-proof-v1.json, scripts/verify_point_support_surplus.py
Обновлены хэши proof certificate и ожидаемый digest source capsule.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant ProgramSessionPlan
  participant occurrence_contexts
  participant ProgramConstraintEvaluatorSetV1
  participant assess_program_point_hard
  participant ProgramLcsPointAdapterV1
  ProgramSessionPlan->>occurrence_contexts: resolve occurrence_context_index
  occurrence_contexts-->>ProgramSessionPlan: return declared AppearanceContextId
  ProgramSessionPlan->>ProgramConstraintEvaluatorSetV1: assess ProgramPointOccurrenceV1
  ProgramConstraintEvaluatorSetV1->>assess_program_point_hard: assess encoded point
  ProgramSessionPlan->>ProgramLcsPointAdapterV1: request LCS only for LCS-aware constraint
  ProgramLcsPointAdapterV1-->>ProgramSessionPlan: memoized ModeledLcsOccurrenceV1
Loading

Possibly related PRs

  • Labpics-Team/lab-colors#447 — обновляет point-support proof artifacts и source capsule sealing, связанные с изменёнными proof-хэшами.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 58.97% 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 Title clearly matches the main change: LCS is isolated as an explicit Program capability.
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
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/program-capability-boundary

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

@lemone112
lemone112 marked this pull request as ready for review July 26, 2026 21:22

@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/program_lcs_integration_tests.rs (1)

576-610: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Разделите два независимых сценария на отдельные тесты.

Функция проверяет и report-only exact-программу, и WCAG-программу. При падении второй части имя теста не покажет, какой evaluator-набор регрессировал, а первая часть уже успела перезаписать счётчики. Отдельный wcag_program_does_not_derive_lcs даст точную локализацию.

🤖 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/program_lcs_integration_tests.rs` around lines 576
- 610, Разделите тест encoded_only_program_evaluators_do_not_derive_lcs на два
независимых теста: сохраните текущую проверку report-only exact-программы в
исходном тесте, а проверку compiled_wcag_program вынесите в отдельный тест с
именем wcag_program_does_not_derive_lcs. Инициализацию сессии и сброс
MODELED_TRISTIMULUS_DERIVATION_CALLS оставьте в соответствующем тесте, сохранив
существующие утверждения поведения.
🤖 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/generic_boundary_tests.rs`:
- Around line 983-986: Ограничьте проверку отсутствия
`Option<ModeledLcsOccurrenceV1>` областью `ProgramLcsPointAdapterV1`, извлекая
или проверяя только исходный фрагмент этого адаптера вместо всего
`CONSTRAINTS_SOURCE`. Сохраните текущую проверку для адаптера и не запрещайте
легитимные использования типа в других частях файла.

In `@crates/labcolors-core/src/program_lcs_integration_tests.rs`:
- Around line 638-641: Добавьте поясняющее сообщение к утверждению
MODELED_TRISTIMULUS_DERIVATION_CALLS, явно описывающее инвариант: encoded-only
путь не должен наследовать LCS-требование объявленного контекста. Сохраните
текущую проверку нулевого числа дериваций и используйте формат сообщений,
принятый в остальных проверках счётчика этого файла.

In `@crates/labcolors-core/src/program_mixed_evaluator_tests.rs`:
- Line 761: Замените в проверках вокруг `evidence.binding().context()` сравнение
с `exact.appearance_context()` на сравнение с объявленным контекстом фикстуры
через `context()`. Сохраните проверку привязки evidence, чтобы тест
действительно подтверждал передачу declared context, а не сравнивал значение с
самим собой.

---

Outside diff comments:
In `@crates/labcolors-core/src/program_lcs_integration_tests.rs`:
- Around line 576-610: Разделите тест
encoded_only_program_evaluators_do_not_derive_lcs на два независимых теста:
сохраните текущую проверку report-only exact-программы в исходном тесте, а
проверку compiled_wcag_program вынесите в отдельный тест с именем
wcag_program_does_not_derive_lcs. Инициализацию сессии и сброс
MODELED_TRISTIMULUS_DERIVATION_CALLS оставьте в соответствующем тесте, сохранив
существующие утверждения поведения.
🪄 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: d0494670-efd1-4834-a322-6bbc2f6e60e6

📥 Commits

Reviewing files that changed from the base of the PR and between b38db1d and 3d24f17.

📒 Files selected for processing (13)
  • crates/labcolors-core/contracts/point-support-reference-surplus-q55-bps-proof-v1.json
  • crates/labcolors-core/src/constraints/mod.rs
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/lcs_occurrence.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_identity_tests.rs
  • crates/labcolors-core/src/program_joint_integration_tests.rs
  • crates/labcolors-core/src/program_lcs_integration_tests.rs
  • crates/labcolors-core/src/program_mixed_evaluator_tests.rs
  • crates/labcolors-core/src/program_session.rs
  • scripts/verify_point_support_surplus.py

Comment thread crates/labcolors-core/src/generic_boundary_tests.rs
Comment thread crates/labcolors-core/src/program_lcs_integration_tests.rs
Comment thread crates/labcolors-core/src/program_mixed_evaluator_tests.rs Outdated
@lemone112
lemone112 merged commit 3409bfd into main Jul 26, 2026
10 checks passed
@lemone112
lemone112 deleted the agent/program-capability-boundary branch July 26, 2026 22:01
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