feat(core): select from explicit WCAG feasibility (#296-B) - #320
Conversation
WalkthroughДобавлен публичный API выбора первого feasible-кандидата в объявленном порядке с повторной проверкой и receipt-идентичностью. Добавлены контракты, Rust/Python-тесты и документация. Native admission переведён на V3, WASM evidence — на boundary V2 и size budget V4. ChangesЯвный выбор WCAG 2.2
Evidence-контракты
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/wcag22_feasibility/explicit.rs`:
- Around line 3-5: Remove the redundant #[path] attribute from the selection
module declaration in the explicit module, leaving pub mod selection; so Rust
resolves the module at its conventional explicit/selection.rs location.
In `@crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs`:
- Around line 477-519: Update stream_receipt_edge to replace the unnamed [1] tag
with a named VERIFIED_PASS_TAG constant documenting the verified-Pass value.
Remove the duplicate ReceiptSink, receipt_sink_u64, and
receipt_sink_len_prefixed helpers, and reuse the existing hash_u64 and
hash_len_prefixed grammar helpers from wcag22_feasibility.rs throughout the
receipt-streaming functions, preserving the current byte order and
length-prefixed encoding.
In `@crates/labcolors-core/tests/wcag22_explicit_selection.rs`:
- Around line 121-156: Переиспользуйте одну target-директорию для всех проверок
в assert_downstream_rejected. Создайте shared_target_dir один раз в
selection_source_and_receipts_cannot_be_forged_or_rewrapped_downstream и
передавайте её путь в каждый вызов, обновив сигнатуру
assert_downstream_rejected; сохраняйте отдельные временные каталоги исходников
для каждого вызова.
🪄 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: d54d68b7-11b5-476c-bce2-a820261b2d03
📒 Files selected for processing (25)
.cargo/mutants.toml.github/workflows/ci.ymlCHANGELOG.mdcrates/labcolors-core/Cargo.tomlcrates/labcolors-core/README.mdcrates/labcolors-core/benches/wcag22_feasibility_admission.rscrates/labcolors-core/contracts/wcag22-explicit-selection-identity-v1.jsoncrates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.jsoncrates/labcolors-core/src/wcag22_feasibility.rscrates/labcolors-core/src/wcag22_feasibility/explicit.rscrates/labcolors-core/src/wcag22_feasibility/explicit/selection.rscrates/labcolors-core/tests/wcag22_explicit_selection.rscrates/labcolors-core/tests/wcag22_explicit_selection_alloc.rsdocs/NAMING.mddocs/verification-map.mdpackages/colors/README.mdpackages/colors/bench/wasm-size-budget-v4.jsonpackages/colors/bench/wcag22-feasibility-boundary.bench.mjspackages/colors/bench/wcag22-feasibility-wasm-boundary-v2.jsonpackages/colors/test/release-contract.test.mjspackages/colors/test/wcag22-feasibility-boundary.test.mjsscripts/check-wasm-size-budget.mjsscripts/check_wcag22_feasibility_applicability.pyscripts/check_wcag22_feasibility_benchmark.pyscripts/verify_wcag22_explicit_selection_identity.py
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 (2)
packages/colors/test/wcag22-feasibility-boundary.test.mjs (1)
373-407: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueИтоговая проверка
--recordслишком слаба относительно остальных проверок в тесте.Тест аккуратно вычисляет
harnessIndex/recordIndex/fingerprintIndex/uploadIndexдля проверки порядка шагов, но финальная проверкаassert.match(ci, /--record/u, ...)— это несвязанный поиск подстроки по всемуci.yml, не привязанный к найденному ранееrecordIndex. Она фактически избыточна (наличие--recordуже подтверждено черезrecordIndex > harnessIndex) и не добавляет проверки контекста/порядка.♻️ Предлагаемое упрощение
- assert.match(ci, /--record/u, "candidate commit must execute recording mode"); + assert.ok( + ci.slice(recordIndex).startsWith(record), + "candidate commit must execute recording mode at the discovered step", + );🤖 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 `@packages/colors/test/wcag22-feasibility-boundary.test.mjs` around lines 373 - 407, Remove the redundant global `assert.match(ci, /--record/u, ...)` from the test. Keep the existing `harnessIndex` and `recordIndex` ordering assertion, which already verifies that recording mode is present in the expected candidate command context.crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json (1)
257-290: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy liftСинхронизировать
feasibleCandidatesдляmaximum-combined-applicable-envelope. Вcrates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.jsonзначение7, а вpackages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json—149при одинаковой форме входа. Остальные сценарии этого набора согласуются; здесь нужен единый эталон или явное объяснение отличия.🤖 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/contracts/wcag22-feasibility-benchmark-v3.json` around lines 257 - 290, Синхронизируйте значение feasibleCandidates для сценария maximum-combined-applicable-envelope с эталонным контрактом и соответствующим сценарием в wcag22-feasibility-wasm-boundary-v2.json: при одинаковой форме входа значения должны совпадать. Обновите согласованные поля expected и observedIdentity, если они зависят от исправленного результата, сохранив остальные метрики без изменений.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 `@docs/verification-map.md`:
- Around line 119-120: Дополните описание append-only size V4 и whole-call V2 в
verification-map.md происхождением параметров 520993 B и 10 форм × 5 samples,
указав конкретный источник измерений и тест, который фиксирует эти значения.
Явно обозначьте диапазон применимости и чувствительность к формам запросов и
числу выборок, чтобы значения не воспринимались как универсальные пороги;
сохраните существующие ограничения V1/V2/V3.
- Line 120: В строке документации с описанием канонического WASM замените
англоязычные описательные термины whole-call, fresh-process samples, headroom и
transport на русские эквиваленты «полный вызов», «выборки в новых процессах»,
«запас» и «транспортный путь», сохранив имена файлов, флаги и API-идентификаторы
в backticks.
In `@packages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json`:
- Line 1: Обновите эталонное значение feasibleCandidates в сценарии
maximum-combined-applicable-envelope с 149 на 7, синхронизировав его с
контрактом wcag22-feasibility-benchmark-v3.json. Не изменяйте остальные поля или
сценарии.
---
Outside diff comments:
In `@crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json`:
- Around line 257-290: Синхронизируйте значение feasibleCandidates для сценария
maximum-combined-applicable-envelope с эталонным контрактом и соответствующим
сценарием в wcag22-feasibility-wasm-boundary-v2.json: при одинаковой форме входа
значения должны совпадать. Обновите согласованные поля expected и
observedIdentity, если они зависят от исправленного результата, сохранив
остальные метрики без изменений.
In `@packages/colors/test/wcag22-feasibility-boundary.test.mjs`:
- Around line 373-407: Remove the redundant global `assert.match(ci,
/--record/u, ...)` from the test. Keep the existing `harnessIndex` and
`recordIndex` ordering assertion, which already verifies that recording mode is
present in the expected candidate command context.
🪄 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: 362a89fe-8dc3-4f94-888f-e17e2b309c00
📒 Files selected for processing (10)
.github/workflows/ci.ymlCHANGELOG.mdcrates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.jsoncrates/labcolors-core/src/wcag22_feasibility.rscrates/labcolors-core/src/wcag22_feasibility/explicit/selection.rscrates/labcolors-core/tests/wcag22_explicit_selection.rsdocs/verification-map.mdpackages/colors/bench/wcag22-feasibility-wasm-boundary-v2.jsonpackages/colors/test/release-contract.test.mjspackages/colors/test/wcag22-feasibility-boundary.test.mjs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@CHANGELOG.md`:
- Around line 81-88: Update the V4 SHA-256 suffix in the WASM size history entry
to the correct four-character suffix “4c0e”, preserving the existing 520920 B
size and 7e9c3b prefix.
🪄 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: aedb3ca9-c03e-43da-88d6-752c5c32a5cd
📒 Files selected for processing (16)
.github/workflows/ci.ymlCHANGELOG.mdcrates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.jsoncrates/labcolors-core/src/wcag22_feasibility.rscrates/labcolors-core/src/wcag22_feasibility/explicit/selection.rscrates/labcolors-core/tests/wcag22_explicit_selection.rscrates/labcolors-protocol/src/lib.rsdocs/verification-map.mdpackages/colors/README.mdpackages/colors/bench/wasm-size-budget-v4.jsonpackages/colors/bench/wcag22-feasibility-wasm-boundary-v2.jsonpackages/colors/test/release-contract.test.mjspackages/colors/test/wcag22-feasibility-boundary.test.mjsscripts/check-wasm-size-budget.mjsscripts/check_wcag22_feasibility_applicability.pyscripts/check_wcag22_feasibility_benchmark.py
Результат
Feasibleвыдаёт закрытыйFeasibleSelectionSourceV1;Infeasible,NotEvaluatedи downstream-код не могут его сконструировать или восстановить из сериализованных bytes.FirstFeasibleInDeclaredOrderV1принимает непрозрачные client-owned ID, полностью проверяет весь bounded order до выбора и не имеет fallback.Selected | NoSelection; payload и receipts Core-sealed.Найденные и устранённые корни
Feasibleи остальными терминалами;--lockedfetch +--frozenbuild/run;Exact evidence
b50a110cadbdb6785222a686f28d7fad353d8c82;8cda7139f0b7b07aa090f7d5ee231aea45a3c87a9576dbdc5363ea88e06d9a56; artifact SHA-25646ec939523a9aff4f253c4c74e997dfd95812a694b2507fae885ff60244ade3a;c5922366bfe3d6d028a65d626f4e629b3adad066995cf0b60c8a4b617bba5ffe, cargofec239e6b74df873f54ef52912bfcfcc8d8414bc14a7ae1e0be80460bae72841, and executed benchmark6ac07bad81a204ee8fcee8f94a3c445f881d1ca10edaf4cc4a86a5db0b232e3a;3b4ec73fc09eeee03a96fa785fe7c4c6af419965b74b9e454f1378cf3170d888; 10 scenarios × 5 fresh processes; all 50 raw samples changed while deterministic request/outcome/shape evidence stayed equal;520920 B, SHA-256c179f42cd90c24699167ee78b4080c80fb38247c54953e7dc020483f6fcf94ed; exact zero-headroom size ratchet;clippy -D warningsPASS, release/boundary 26/26, docs-drift 23/23;Scope / handoff
Implements #296-B. Parent #296 remains open. The next slice is #296-C1: split the unpublished offline compiler operation into
@labpics/colors/compilerand prove that the root runtime neither resolves nor instantiates compiler WASM.