refactor(npm): isolate offline compiler WASM - #321
Conversation
WalkthroughДобавлен отдельный offline compiler для WCAG22 feasibility с собственным WASM, npm subpath и типами. Runtime освобождён от feasibility protocol; обновлены role-aware WASM budgets, evidence, release manifest, package smoke-проверки, CI gates и документация. ChangesCompiler boundary
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Consumer
participant CompilerEntry
participant CompilerWasm
Consumer->>CompilerEntry: evaluateWcag22Feasibility(Uint8Array)
CompilerEntry->>CompilerEntry: validate Uint8Array and size
CompilerEntry->>CompilerWasm: evaluate request or oversize outcome
CompilerWasm-->>CompilerEntry: feasibility outcome
CompilerEntry-->>Consumer: typed outcome
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.
|
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 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`:
- Line 44: Замените англоязычный заголовок раздела “Breaking (npm API)” на
русскоязычный эквивалент, например “Несовместимые изменения (npm API)”, сохранив
смысл и формат заголовка.
In `@docs/NAMING.md`:
- Around line 55-66: Уточните правило в разделе о subpath’ах, ограничив
требование разрешения в исходник только исходными JS/TS domain exports. Явно
исключите служебные exports `./package.json` и `./build-metadata.json`, а также
артефактные exports `./pkg/labcolors_bg.wasm` и `./compiler/wasm`, сохранив для
них действующие отдельные правила.
In `@README.md`:
- Around line 37-39: Уточните абзац README о `@labpics/colors/compiler`: не
связывайте npm-компилятор с клиентскими `opaque relations` или соседними цветами
и не приписывайте ему поддержку явного домена. Опишите его только через
фактически опубликованный V1-путь; добавлять API и доказательства следует лишь
при наличии соответствующей реализации.
In `@scripts/docs-drift.test.mjs`:
- Around line 74-99: Extend the test “generated WASM names come from package
files without hiding undeclared source” to create a packages/colors/pkg fixture
containing one package.json-declared file and one undeclared extra file, then
assert nonLawFiles(root) includes the undeclared pkg file alongside the existing
compiler results. Keep the declared pkg file excluded and preserve the fixture
cleanup.
In `@scripts/naming-inventory.mjs`:
- Around line 193-211: Обновите nonLawFiles и связанный walk, чтобы директории
packages/colors/pkg и packages/colors/compiler полностью проверялись, включая не
объявленные runtime-артефакты. Расширьте обработку generatedPackageFiles так,
чтобы записи package.json вида files: ["pkg"] и files: ["compiler"] считались
корнями, а не только путями конкретных файлов. Добавьте regression-test,
подтверждающий попадание не объявленного файла из pkg в результат.
🪄 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: 6e0819c8-4268-46f1-a4bc-952a4f4a942f
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (37)
.github/workflows/ci.yml.github/workflows/publish.ymlCHANGELOG.mdCargo.tomlREADME.mdcrates/labcolors-compiler/Cargo.tomlcrates/labcolors-compiler/src/lib.rscrates/labcolors-compiler/tests/wasm_parity.rscrates/labcolors-core/benches/wcag22_feasibility_admission.rscrates/labcolors-core/contracts/wcag22-feasibility-benchmark-v4.jsoncrates/labcolors-wasm/Cargo.tomlcrates/labcolors-wasm/src/lib.rscrates/labcolors-wasm/tests/wasm_parity.rsdocs/NAMING.mddocs/migrations/exact-alpha-glow.mddocs/verification-map.mdpackages/colors/README.mdpackages/colors/bench/wasm-size-budget-v5.jsonpackages/colors/bench/wcag22-feasibility-boundary.bench.mjspackages/colors/bench/wcag22-feasibility-wasm-boundary-v3.jsonpackages/colors/compiler.d.tspackages/colors/compiler.jspackages/colors/index.d.tspackages/colors/index.jspackages/colors/package.jsonpackages/colors/test/compiler-boundary.test.mjspackages/colors/test/release-contract.test.mjspackages/colors/test/release-provenance.test.mjspackages/colors/test/wcag22-feasibility-boundary.test.mjspackages/colors/test/wcag22-feasibility.test.mjspackages/colors/wcag22.d.tsscripts/check-wasm-size-budget.mjsscripts/check_wcag22_feasibility_benchmark.pyscripts/docs-drift.test.mjsscripts/naming-inventory.mjsscripts/prepare-npm-package.mjsscripts/verify-package-release.mjs
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
README.md (1)
34-40: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winУкажите происхождение и проверку численных параметров.
В абзаце названы
WCAG 2.2,sRGB8иsrgb8-neutral-axis-v1, но не указаны их источник, диапазон применимости, sensitivity и тестовый/evidence-артефакт. Сошлитесь на канонический контракт иdocs/verification-map.md, не добавляя новые значения в README.🤖 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 `@README.md` around lines 34 - 40, Обновите абзац о полной проверке конечного домена в README, добавив ссылки на канонический compiler-контракт и docs/verification-map.md для происхождения и проверки WCAG 2.2, sRGB8 и srgb8-neutral-axis-v1. Укажите источник, диапазон применимости, sensitivity и соответствующий тестовый/evidence-артефакт, не вводя новых численных значений.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.
Outside diff comments:
In `@README.md`:
- Around line 34-40: Обновите абзац о полной проверке конечного домена в README,
добавив ссылки на канонический compiler-контракт и docs/verification-map.md для
происхождения и проверки WCAG 2.2, sRGB8 и srgb8-neutral-axis-v1. Укажите
источник, диапазон применимости, sensitivity и соответствующий
тестовый/evidence-артефакт, не вводя новых численных значений.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: e791c330-0389-467f-8793-6b6a4679215c
📒 Files selected for processing (2)
README.mddocs/NAMING.md
Scope
#296-C1 only: один npm package, две физические execution-role. Package root остаётся runtime-only;
@labpics/colors/compilerвладеет offline feasibility compiler. Compatibility alias в root не добавлен. C2 atomic A→B и C3 transport publication в этот PR не входят.Результат
labcolors-protocolили compiler features; rootinit()не загружает compiler.init/initSync, curated types и strict byte boundary.Доказательства
60e0b0f621fb4e0fcc5c57c527a8f1bf11487ee34581c98239b1ac6c31e6de86, проверяется CI в verify-only mode; ревизия под тестом больше не может сама записать новую истину.454385 B, compiler175212 B; оба exact Linux-x64 SHA/recipe имеют нулевой headroom.ready → request → pass.Gates
npm test: 138/138 PASS;npm run typecheck: PASS.cargo +1.96.0 test --workspace --all-targets --locked: PASS.Closes no issue: owner #296 остаётся открыт для C2/C3.