feat: add proof-bound WCAG 2.2 sRGB8 evaluator - #313
Conversation
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 34 seconds 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 (27)
WalkthroughДобавлен доказуемый WCAG 2.2 sRGB8 evaluator с Q55-границами, proof-bound evidence и capability manifest V2. Результаты экспортируются через Rust, FFI, WASM и npm, включаются в conformance pack v4, а независимые скрипты проверяют артефакты, полный конечный домен и release-бюджеты. ChangesWCAG 2.2 evaluator
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
Sequence Diagram(s)sequenceDiagram
participant Client
participant ColorsPackage
participant WasmBinding
participant CoreEvaluator
participant EvidenceRegistry
Client->>ColorsPackage: вызывает evaluateWcag22
ColorsPackage->>WasmBinding: передаёт hex-пары и criterion
WasmBinding->>CoreEvaluator: вызывает evaluate_wcag22_hex
CoreEvaluator->>EvidenceRegistry: запрашивает canonical proof-bound evidence
EvidenceRegistry-->>CoreEvaluator: возвращает зарегистрированные IDs
CoreEvaluator-->>WasmBinding: возвращает Pass/Fail и Q55 assessment
WasmBinding-->>ColorsPackage: сериализует JsWcag22Assessment
ColorsPackage-->>Client: возвращает оценку и evidence
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 13
🤖 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 `@conformance/README.md`:
- Around line 58-76: Обновите раздел «Версионирование» в conformance/README.md:
укажите текущий manifest.packVersion как 4.0.0 вместо 3.0.0 и опишите переход
3.0.0 → 4.0.0 с изменениями capability V2 и добавлением семейства wcag22. В
таблицу «Семейства векторов» добавьте строку для wcag22.json, согласовав её с
источником истины из docs/NAMING.md и общим количеством семейств.
In `@crates/labcolors-core/src/numerics.rs`:
- Around line 233-366: Зафиксируйте уникальность wire-ключей в
NUMERICAL_REGISTRY_V2: добавьте проверку, которая обнаруживает повторяющиеся
значения, возвращаемые NumericalSiteIdV2::key(), и закрепите её тестом для
полного V2-реестра. Не ограничивайте проверку только NumericalSiteIdV1 и
используйте единый источник данных NUMERICAL_REGISTRY_V2.
- Around line 725-728: Добавьте независимый mutation guard непосредственно в
ветви кодирования proof_ids, проверяя ожидаемый результат сериализации, а не
пересчитывая checksum той же реализацией. Покройте все соответствующие пути
вокруг push_sorted_key_list и явно зафиксируйте, что legacy Glow не содержит
proof ID; guard должен обнаруживать удаление или перестановку этого кодирования.
- Around line 569-578: Mark the public enum NumericalRuntimeAttestationIdV2 with
#[non_exhaustive] so downstream code cannot exhaustively match its currently
empty variants. Leave its key method and other attributes unchanged.
In `@crates/labcolors-core/src/srgb8.rs`:
- Around line 3-14: Update hex_bytes to remove at most one leading '#' and
reject inputs with a repeated prefix such as ##1A2B3C, while preserving valid
optional-prefix parsing. Add a regression test that exercises the public parsing
path and fails before the fix for the repeated-prefix input.
In `@crates/labcolors-core/src/wcag22_tests.rs`:
- Around line 148-159: В тесте с детерминированной выборкой вынесите seed,
размер выборки и параметры LCG из тела цикла в именованные константы, используя
их в генерации состояния и диапазоне итераций. Добавьте комментарий,
объясняющий, что генератор обеспечивает воспроизводимую PR-time выборку, но не
заменяет доказательство по всему домену.
In `@crates/labcolors-core/src/wcag22.rs`:
- Around line 29-34: Уточните документацию варианта Wcag22Srgb8ContrastV1 в
перечислении Wcag22ProfileIdV1: отделите ссылку на рекомендацию WCAG 2.2 от
выбора конечного домена профиля, не приписывая стандарту ограничение «final
encoded sRGB8 bytes». Сохраните указание на Recommendation как нормативный
источник, а описание sRGB8 представьте как design-choice профиля.
In `@crates/labcolors-core/src/wcag22/kernel.rs`:
- Around line 56-64: Добавьте рядом с вычислением passes/fails в match threshold
поясняющий комментарий с выводом целочисленных коэффициентов из `(L + 0.05) / (D
+ 0.05)`: для порогов 3:1 и 4.5:1 укажите соответствующие неравенства, включая
обратное строгое условие для Fail. Не изменяйте логику вычислений.
In `@crates/labcolors-ffi/src/lib.rs`:
- Around line 851-884: Добавьте в тестовый модуль отдельный тест для успешного
результата `evaluate_wcag22`, используя валидные цвета и критерий
`Wcag22Criterion`; проверьте, что `assessment.decision` равен
`Wcag22Decision::Pass`. Разместите тест рядом с
`wcag22_transport_preserves_core_decision_and_evidence`, сохранив существующие
проверки без изменений.
- Around line 439-544: Update evaluate_wcag22 to verify that the core-returned
assessed_criterion matches the original criterion before constructing
Wcag22Assessment. Perform the comparison through the existing Wcag22Criterion
conversion or equivalent variant matching without requiring PartialEq on the
core type, and return IncompatibleCoreContract on mismatch; preserve the
existing criterion mapping for matching values.
In `@crates/labcolors-wasm/src/projection.rs`:
- Around line 71-96: Вынесите каноническое преобразование и разбор ключей WCAG22
в методы `Wcag22CriterionV1` на стороне core, например `key()` и `parse()`.
Замените повторяющиеся литералы в сериализации этого участка, сообщениях
`error.rs` и парсинге внутри `evaluate_wcag22` в `lib.rs` вызовами этих методов,
сохранив текущую обработку неизвестных вариантов.
In `@scripts/verify_wcag22_q55.py`:
- Around line 743-747: Remove the unnecessary f-string prefix from the
replacement string passed to re.subn in the normalization logic, while
preserving the existing \1 and <self-digest> replacement content.
In `@scripts/verify-package-release.mjs`:
- Around line 114-123: Update validateWcag22Evidence and verifyCleanConsumer so
WCAG22 evidence artifacts are validated from the packed tarball and installed
clean-consumer files, not only staging paths. Pass the expected evidence
artifacts into verifyCleanConsumer, then compare each installed evidence/*
file’s bytes and SHA-256 against the expected artifact before accepting the
release manifest.
🪄 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: 370e8cba-b1be-4ca1-9fba-3592e6bb506b
⛔ Files ignored due to path filters (1)
crates/labcolors-core/contracts/wcag22-srgb8-q55-v1.binis excluded by!**/*.bin
📒 Files selected for processing (42)
.cargo/mutants.toml.github/workflows/ci.yml.gitignoreREADME.mdbindings/swift/Tests/LabColorsConformanceTests/ConformanceTests.swiftconformance/README.mdconformance/vectors/manifest.jsonconformance/vectors/wcag22.jsoncrates/labcolors-conformance/src/bin/gen.rscrates/labcolors-conformance/src/lib.rscrates/labcolors-conformance/tests/reference_runner.rscrates/labcolors-core/contracts/wcag22-srgb8-q55-proof-v1.jsoncrates/labcolors-core/contracts/wcag22-srgb8-v1.jsoncrates/labcolors-core/src/lib.rscrates/labcolors-core/src/numerics.rscrates/labcolors-core/src/semantic.rscrates/labcolors-core/src/spaces/srgb.rscrates/labcolors-core/src/srgb8.rscrates/labcolors-core/src/wcag22.rscrates/labcolors-core/src/wcag22/kernel.rscrates/labcolors-core/src/wcag22/q55_data.rscrates/labcolors-core/src/wcag22_evidence.rscrates/labcolors-core/src/wcag22_tests.rscrates/labcolors-ffi/src/lib.rscrates/labcolors-wasm/src/error.rscrates/labcolors-wasm/src/lib.rscrates/labcolors-wasm/src/projection.rsdocs/NAMING.mddocs/verification-map.mdpackages/colors/README.mdpackages/colors/bench/wasm-size-budget-v1.jsonpackages/colors/index.d.tspackages/colors/index.jspackages/colors/package.jsonpackages/colors/test/capability-manifest.test.mjspackages/colors/test/release-contract.test.mjspackages/colors/test/wcag22.test.mjsscripts/check-wasm-size-budget.mjsscripts/generate_wcag22_q55.pyscripts/prepare-npm-package.mjsscripts/verify-package-release.mjsscripts/verify_wcag22_q55.py
|
@coderabbitai review Final exact head: |
|
✅ Action performedReview finished.
|
|
@coderabbitai review Final infrastructure-only head: |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,200p' .github/workflows/ci.ymlLength of output: 10182 🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n 'apt-get|apt ' .github/workflows/ci.yml -C3Length of output: 1806 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '360,430p' .github/workflows/ci.ymlLength of output: 4539 🏁 Script executed: #!/bin/bash
set -euo pipefail
awk 'NR<=365 && /^ [a-zA-Z_-]+:$/ {print NR": "$0}' .github/workflows/ci.yml | tail -5
grep -n "name: " .github/workflows/ci.yml | sed -n '1,60p'Length of output: 2200 🏁 Script executed: #!/bin/bash
set -euo pipefail
git log --oneline -5
git show --stat 58148111eb67040cc8d5f99e830ad8f95a60ab75 2>&1 | head -50Length of output: 955 🏁 Script executed: #!/bin/bash
set -euo pipefail
git show 58148111eb67040cc8d5f99e830ad8f95a60ab75 -- .github/workflows/ci.yml packages/colors/test/release-contract.test.mjsLength of output: 5086
No issues found — this is a clean, narrowly-scoped fix with matching test coverage for the exact-ordering and isolation invariants. ✅ Action performedReview finished.
|
|
Final gate packet for
Proceeding with squash merge under exact-head guard. |
Summary
numericalCapabilityManifest()V2evidence/while allowing the linker to remove them from runtime WASMContract boundary
This is a terminal standards certificate for a final sRGB8 pair, not a replacement for the LPC/APCA-shaped perceptual target used upstream by selection. Core never infers typography, token semantics, component state, or applicability from opaque client IDs. The caller declares one of the supported occurrence criteria; malformed input fails closed without fallback or panic.
The existing adaptive runtime and legacy
wcagRatiodiagnostic are unchanged. Neither can manufacture this evaluator's typed WCAG 2.2 result.Evidence
6,737,385,042,546,262,556, leaving2,485,986,994,308,513,251below signedi64::MAX; Q56 exceeds it; the production kernel promotes arithmetic tou128c91c5e185c432ae4a9fb9ea03e9838bf2565f2aabff56019e190aae97bfaa0f1#[non_exhaustive]seals generic terminal decisions and Glow outcomes; boundary tests obtain outcomes only through the real Core resolverc4a35a902ea49729704d05c2a9a07530a1731ebd4ff7325b5e5baf261fbe7b9efa10908a1960e51b122a11ca0413083ab67749c79161c8b5d22a6c0c69ce71fb8757b348b99926700c6d9854ed4ae515d4c676b31c7924b0812a3745f2181221Gates run locally
-D warningsCanonical WASM
Pinned Linux x64 release build (
rustc 1.96.0,wasm-pack 0.13.1,wasm-bindgen 0.2.126,wasm-opt 117 -Oz):94c61c1689fa2e1c10d79817864471f41c623463bd9b5b4e0dac2a850a58f09fThis is 3,430 raw bytes below the previous canonical artifact. An anti-vacuum gate proves neither separately shipped WCAG document is duplicated in runtime WASM.
Compatibility
No existing adaptive colour emission changes. The public capability/conformance surface is a deliberate pre-client correction; the next release must receive the documented coordinated 0.x version bump rather than preserving a temporary V1 alias.
Closes #284
Summary by CodeRabbit
Новые возможности
Pass/Fail.Улучшения