Skip to content

feat(core): select from explicit WCAG feasibility (#296-B) - #320

Merged
lemone112 merged 43 commits into
mainfrom
agent/issue-296b-selection
Jul 15, 2026
Merged

feat(core): select from explicit WCAG feasibility (#296-B)#320
lemone112 merged 43 commits into
mainfrom
agent/issue-296b-selection

Conversation

@lemone112

@lemone112 lemone112 commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Результат

  • Только терминал Feasible выдаёт закрытый FeasibleSelectionSourceV1; Infeasible, NotEvaluated и downstream-код не могут его сконструировать или восстановить из сериализованных bytes.
  • Единственная политика FirstFeasibleInDeclaredOrderV1 принимает непрозрачные client-owned ID, полностью проверяет весь bounded order до выбора и не имеет fallback.
  • Публичный исход — исчерпывающий Selected | NoSelection; payload и receipts Core-sealed.
  • Выбранная строка повторно проверяется по всем canonical applicable edges тем же exact evaluator BUG/A11Y: ввести доказуемый versioned WCAG 2.2 sRGB8 evaluator #284. Второго WCAG solver нет.
  • Адаптеры, runtime resolution, emitted colors и adaptive traces не изменены; transport explicit selection остаётся ARCH/SELECTION: explicit finite sRGB8 feasibility + client-owned selection #296-C.

Найденные и устранённые корни

  • sealed feasibility без отдельной capability допускала концептуальную путаницу между Feasible и остальными терминалами;
  • прежняя форма outcome не позволяла downstream исчерпывающий match;
  • relation ID внутри edge-loop мог создавать до ~128 MiB лишней SHA-работы на допустимом boundary input;
  • durable native evidence ранее зависел от самоутверждаемых runtime-полей и не доказывал фактический build recipe;
  • V3 теперь создаёт только repo-owned recorder: fresh Cargo home/target, пустая config-discovery hierarchy, positive env allowlist, точные toolchain executables и --locked fetch + --frozen build/run;
  • recorder, а не benchmark, выдаёт receipt фактически запущенного executable; dependency cone проверяется до build, после run и после binding;
  • независимое review обнаружило, что Linux whole-call JSON был перепривязан без нового raw record; все 50 observations пересняты на canonical Linux/Node, а временный candidate-recorder удалён из финального CI;
  • два слишком широких документационных claims сужены до доказанного: receipt содержит применимые relation ID, исторический V2 проверяется сохранённым checker-ом.

Exact evidence

  • reviewed head: b50a110cadbdb6785222a686f28d7fad353d8c82;
  • selection tests: public 12/12, private traversal/byte-work 6/6, allocation target 1/1;
  • independent selection oracle: 37 mutation checks, 6 invariance controls, 2 malformed-input rejections;
  • native V3 source snapshot SHA-256 8cda7139f0b7b07aa090f7d5ee231aea45a3c87a9576dbdc5363ea88e06d9a56; artifact SHA-256 46ec939523a9aff4f253c4c74e997dfd95812a694b2507fae885ff60244ade3a;
  • recorder receipt pins rustc c5922366bfe3d6d028a65d626f4e629b3adad066995cf0b60c8a4b617bba5ffe, cargo fec239e6b74df873f54ef52912bfcfcc8d8414bc14a7ae1e0be80460bae72841, and executed benchmark 6ac07bad81a204ee8fcee8f94a3c445f881d1ca10edaf4cc4a86a5db0b232e3a;
  • native evidence: 10 scenarios × 5 observations, 71 durable mutations, no timing threshold;
  • recaptured canonical Linux whole-call V2 SHA-256 3b4ec73fc09eeee03a96fa785fe7c4c6af419965b74b9e454f1378cf3170d888; 10 scenarios × 5 fresh processes; all 50 raw samples changed while deterministic request/outcome/shape evidence stayed equal;
  • canonical Linux WASM V4 unchanged: 520920 B, SHA-256 c179f42cd90c24699167ee78b4080c80fb38247c54953e7dc020483f6fcf94ed; exact zero-headroom size ratchet;
  • local: workspace/explicit Rust suites PASS, clippy -D warnings PASS, release/boundary 26/26, docs-drift 23/23;
  • exact-head CI 29388369844 and Native/Swift 29388369888: SUCCESS;
  • CodeRabbit current-head SUCCESS/APPROVED; independent release and claims reviews CLEAN; 7/7 review threads resolved.

Scope / handoff

Implements #296-B. Parent #296 remains open. The next slice is #296-C1: split the unpublished offline compiler operation into @labpics/colors/compiler and prove that the root runtime neither resolves nor instantiates compiler WASM.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Добавлен публичный API выбора первого feasible-кандидата в объявленном порядке с повторной проверкой и receipt-идентичностью. Добавлены контракты, Rust/Python-тесты и документация. Native admission переведён на V3, WASM evidence — на boundary V2 и size budget V4.

Changes

Явный выбор WCAG 2.2

Layer / File(s) Summary
Core API и повторная проверка
crates/labcolors-core/src/wcag22_feasibility.rs, crates/labcolors-core/src/wcag22_feasibility/explicit.rs, crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs
Добавлены policy/source/outcome-типы, выбор первого feasible ID, streaming receipt и повторная проверка applicable edges тем же evaluator.
Контракты и тесты выбора
crates/labcolors-core/contracts/*, crates/labcolors-core/tests/*, crates/labcolors-core/README.md, crates/labcolors-core/Cargo.toml
Добавлены identity, property-based, downstream и allocation-тесты, а документация показывает использование selection API.
Независимый identity-оракул
scripts/verify_wcag22_explicit_selection_identity.py, .cargo/mutants.toml
Добавлен Python-валидатор policy/receipt digests и расширена область mutation testing.
Verification map и CI-интеграция
docs/verification-map.md, .github/workflows/ci.yml
Зафиксированы selection-инварианты и self-test нового identity-валидатора.

Evidence-контракты

Layer / File(s) Summary
Native admission V3
crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json, scripts/check_wcag22_feasibility_*.py, crates/labcolors-core/benches/wcag22_feasibility_admission.rs, crates/labcolors-protocol/src/lib.rs
Артефакты и проверки переведены на V3; Cargo.lock обрабатывается как historical-only объект в durable-проверке.
WASM boundary V2 и budget V4
packages/colors/bench/*, packages/colors/README.md, scripts/check-wasm-size-budget.mjs
Добавлены boundary V2 и size budget V4 с неизменяемой историей и запретом ослабления порога относительно V3.
Release-контракты и CI evidence
packages/colors/test/*.mjs, .github/workflows/ci.yml
Тесты проверяют V1–V4, детерминированность whole-call projection и порядок записи/upload candidate evidence.

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

Possibly related issues

  • Labpics-Team/lab-colors#296 — PR реализует explicit client-owned selection, включая API, receipts, тесты и evidence.
  • Labpics-Team/lab-colors#290 — изменения реализуют explicit feasibility-and-selection architecture, включая client-owned policy selection и final recheck.

Possibly related PRs

  • Labpics-Team/lab-colors#316 — связан с базовой feasibility-реализацией, на которую опираются изменения Core.
  • Labpics-Team/lab-colors#318 — добавляет базовую explicit feasibility capability, расширенную этим selection API.
  • Labpics-Team/lab-colors#151 — связан с расширением mutation-testing configuration.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.93% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок кратко и понятно отражает основное изменение: явный выбор из WCAG feasibility для #296-B.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/issue-296b-selection

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

@lemone112
lemone112 marked this pull request as ready for review July 15, 2026 00:20

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 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 commented Jul 15, 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

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 4afe61b and d3d8de1.

📒 Files selected for processing (25)
  • .cargo/mutants.toml
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • crates/labcolors-core/Cargo.toml
  • crates/labcolors-core/README.md
  • crates/labcolors-core/benches/wcag22_feasibility_admission.rs
  • crates/labcolors-core/contracts/wcag22-explicit-selection-identity-v1.json
  • crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json
  • crates/labcolors-core/src/wcag22_feasibility.rs
  • crates/labcolors-core/src/wcag22_feasibility/explicit.rs
  • crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs
  • crates/labcolors-core/tests/wcag22_explicit_selection.rs
  • crates/labcolors-core/tests/wcag22_explicit_selection_alloc.rs
  • docs/NAMING.md
  • docs/verification-map.md
  • packages/colors/README.md
  • packages/colors/bench/wasm-size-budget-v4.json
  • packages/colors/bench/wcag22-feasibility-boundary.bench.mjs
  • packages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json
  • packages/colors/test/release-contract.test.mjs
  • packages/colors/test/wcag22-feasibility-boundary.test.mjs
  • scripts/check-wasm-size-budget.mjs
  • scripts/check_wcag22_feasibility_applicability.py
  • scripts/check_wcag22_feasibility_benchmark.py
  • scripts/verify_wcag22_explicit_selection_identity.py

Comment thread crates/labcolors-core/src/wcag22_feasibility/explicit.rs
Comment thread crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs Outdated
Comment thread crates/labcolors-core/tests/wcag22_explicit_selection.rs Outdated

@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 (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.json149 при одинаковой форме входа. Остальные сценарии этого набора согласуются; здесь нужен единый эталон или явное объяснение отличия.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between d3d8de1 and 7906107.

📒 Files selected for processing (10)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json
  • crates/labcolors-core/src/wcag22_feasibility.rs
  • crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs
  • crates/labcolors-core/tests/wcag22_explicit_selection.rs
  • docs/verification-map.md
  • packages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json
  • packages/colors/test/release-contract.test.mjs
  • packages/colors/test/wcag22-feasibility-boundary.test.mjs

Comment thread docs/verification-map.md Outdated
Comment thread docs/verification-map.md Outdated
Comment thread packages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json Outdated

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7906107 and ea2d7a0.

📒 Files selected for processing (16)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • crates/labcolors-core/contracts/wcag22-feasibility-benchmark-v3.json
  • crates/labcolors-core/src/wcag22_feasibility.rs
  • crates/labcolors-core/src/wcag22_feasibility/explicit/selection.rs
  • crates/labcolors-core/tests/wcag22_explicit_selection.rs
  • crates/labcolors-protocol/src/lib.rs
  • docs/verification-map.md
  • packages/colors/README.md
  • packages/colors/bench/wasm-size-budget-v4.json
  • packages/colors/bench/wcag22-feasibility-wasm-boundary-v2.json
  • packages/colors/test/release-contract.test.mjs
  • packages/colors/test/wcag22-feasibility-boundary.test.mjs
  • scripts/check-wasm-size-budget.mjs
  • scripts/check_wcag22_feasibility_applicability.py
  • scripts/check_wcag22_feasibility_benchmark.py

Comment thread CHANGELOG.md
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