Skip to content

R3a: проверять clean-set на финальном представлении - #476

Merged
lemone112 merged 3 commits into
mainfrom
agent/r3a-point-convention
Jul 27, 2026
Merged

R3a: проверять clean-set на финальном представлении#476
lemone112 merged 3 commits into
mainfrom
agent/r3a-point-convention

Conversation

@lemone112

@lemone112 lemone112 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Что изменено

  • добавлен точный package-pinned классификатор encoded sRGB8 из закреплённого research release ac6d9654fc722334d8bc2054afb903770f2aad80;
  • canonical Program получил закрытый PointPresentation-subject для общего Hard | ReportOnly constraint path;
  • один закон проверяет финальный terminal-root результат после alpha, composition и occlusion, а не исходный solid;
  • Empty и rejected point остаются разными типизированными нарушениями; finite search и fresh recheck используют тот же закон;
  • phase-local cache объединяет clean-set и causal replay без аллокаций на отвергнутых состояниях и без переноса authority между фазами;
  • Program identity связывает presentation edge и полный digest выпуска;
  • package/NOTICE/license/receipt closure проверяется fail-closed в CI и в извлечённом crate.

Почему

Исходный цвет токена не равен реально видимому цвету после прозрачности и последующих слоёв. Проверка nominal source давала бы ложную гарантию. Срез связывает конвенцию с точным финальным вкладом конкретного occurrence в конкретный terminal root и не вводит рецептурные роли, отдельный solver или преждевременный auto.

Воздействие

  • публичный API не расширен: R3a остаётся внутренним;
  • публичные WASM, JS glue и декларации типов побайтно совпадают с base f64a6c17;
  • WASM: 397551 байт, SHA-256 90aaed651efd4c12f6cb3c7740143e85713f6914a20435d39206f1ebd19c2cea;
  • runtime codec: 11370 байт и link-strip-ится из браузерного cut;
  • labcolors-core несёт явную смешанную лицензионную closure встроенных данных.

Проверки exact head c0c2f08

  • cargo +1.96.0 test --workspace --locked: PASS; core 861 pass + 6 intentional ignore;
  • fmt, clippy all-targets -D warnings, rustdoc -D warnings, git diff --check: PASS;
  • product receipt + полный research replay: PASS;
  • receipt hostile suite: 29/29 PASS;
  • generic boundary: 21/21; mixed evaluator: 21/21; Program clean-set: 13/13; release contract: 23/23;
  • full-cube classifier differential: 16777216 точек, 0 unknown;
  • npm build, typecheck и tests: PASS, 264/264;
  • извлечённый labcolors-core-0.3.0.crate: 869373 байта, SHA-256 d81b9f70d23e9ace8a43dcd4f599781945cc7661ce4df292945bc16e97b2c94a; closure VERIFIED; doctests 4/4 + compile-fail 33/33;
  • все девять доказанных CodeRabbit findings исправлены; дополнительно закрыты hostile случаи raw-string comment masking и fail-open shell prologue.

Финальный product receipt SHA-256: 874926f880901e5b9ffeb0fb23a6466f9745a5a120ca29b47309b7c078aa9a40.

Честная граница

CI проверяет самодостаточную product/package closure. Полный scientific replay дополнительно требует отдельный checkout research-репозитория на закреплённом commit; у него пока нет remote. Срез остаётся private и не открывает auto или публичную гарантию человеческого восприятия.

Summary by CodeRabbit

  • Новые возможности
    • Добавлена package-фиксированная классификация цветов sRGB8 по “exact nominal clean set”.
    • Расширена поддержка declared clean-set в модели проверок и evidence.
  • Проверки и целостность
    • Добавлена строгая офлайн-верификация receipt (product/full/core-package) и hostile-тесты.
    • Усилены проверки в CI для “clean-set receipt” и валидации упакованного core-пакета.
    • Обновлены receipt-v1.json и соответствующий SHA-256.
  • Документация
    • Добавлены тексты лицензий CC BY 4.0 и CC BY-SA 4.0, расширен NOTICE.md.
  • Тесты
    • Расширены юнит-, граничные и регрессионные сценарии для clean-set логики и инвариантов.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Добавлены package-pinned clean-set классификатор и typed constraints, строгая offline-проверка product receipt и license closure, research replay-проверка, legal-файлы, receipt-контракты, presentation cache, новые evidence/subject-типы и расширенные Rust/Python/CI-тесты.

Changes

Clean-set receipt и программная интеграция

Layer / File(s) Summary
Receipt, legal closure и offline-верификация
.gitattributes, .github/workflows/*, crates/labcolors-core/{Cargo.toml,LICENSES/*,NOTICE.md}, crates/labcolors-core/contracts/clean-set-srgb8-v1/*, scripts/verify_clean_set_receipt.py, scripts/test_verify_clean_set_receipt.py
Receipt фиксирует артефакты, лицензии, research provenance и runtime contract; verifier проверяет канонический JSON, хэши, codec, research closure и package closure, а CI запускает product/core-package и hostile-проверки.
Package-pinned clean-set classifier
crates/labcolors-core/src/{clean_set.rs,clean_set_tests.rs,lib.rs}
Встроенный RLE codec классифицирует Srgb8, возвращает accepted/rejected решения и проверяется по границам, sentinel, raw-table hash и accepted count.
Typed clean-set constraints и presentation resolution
crates/labcolors-core/src/{program.rs,program_session.rs}
Добавлены declared clean-set bodies, presentation-target compilation, typed subjects/evidence, cache разрешения presentation domains и новые compile/final-recheck ошибки.
Canonical constraint identity
crates/labcolors-core/src/program_identity.rs
Identity graph связывает declared clean-set constraints с release digest и presentation-target вершинами через новую роль ребра.
Boundary и integration tests
crates/labcolors-core/src/*tests.rs, crates/labcolors-core/tests/sha256.rs, packages/colors/test/release-contract.test.mjs, scripts/verify_point_support_surplus.py
Тесты проверяют compile/runtime semantics, hard/report-only режимы, final recheck, identity invariants, mixed evaluator projections, allocation behavior, workflow gates и обновленные контрольные суммы.

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

Sequence Diagram(s)

sequenceDiagram
  participant DraftV1
  participant ProgramSession
  participant PresentationCache
  participant CleanSetClassifier
  participant Certificate
  DraftV1->>ProgramSession: компилирует declared clean-set constraint
  ProgramSession->>PresentationCache: разрешает presentation target
  PresentationCache-->>ProgramSession: возвращает domain и replay span
  ProgramSession->>CleanSetClassifier: классифицирует Srgb8
  CleanSetClassifier-->>Certificate: передаёт typed subject и evidence
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.03% 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 Заголовок точно отражает основную идею PR: проверку clean-set для финального представления точки.
✨ 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/r3a-point-convention

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

@lemone112
lemone112 marked this pull request as ready for review July 27, 2026 10:54
@lemone112

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 27, 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: 9

🤖 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 788-813: Update
clean_set_program_path_cannot_smuggle_auto_or_writer_contracts so it also
validates clean_set.rs, while stripping comments before checking forbidden
identifiers. Keep the guard focused on code identifiers rather than arbitrary
documentation text, preserving detection of actual writer/checkpoint and
quality-contract references.

In `@crates/labcolors-core/src/program_identity.rs`:
- Around line 774-843: Extract the duplicated constraint-body matching and
graph-binding logic into a shared helper that accepts the differing mode tag,
reusing the existing symbols such as constraint_color,
declared_srgb8_clean_set_constraint_color_for_release, and graph.add_edge.
Update both the hard and report_only loops to call this helper with their
respective mode tags, preserving all three constraint-body branches and edge
roles.

In `@crates/labcolors-core/src/program_mixed_evaluator_tests.rs`:
- Around line 602-608: Обновите ветку AssessmentV1::DeclaredSrgb8CleanSet в
тестовой пробе, чтобы checksum учитывал не только visible(), но также
violation() и rejected_blue_interval(). Смешайте их стабильные значения в probe
вместе с текущим RGB, чтобы differential-проверка выявляла изменения вида
нарушения и интервала.

In `@crates/labcolors-core/src/program_session.rs`:
- Around line 4068-4124: Consolidate the duplicated lookup and validation logic
in compile_constraints for DeclaredSrgb8CleanSet and
DeclaredSrgb8CleanSetFinalRecheckMutant by introducing and reusing a shared
helper such as compile_declared_clean_set_body. Pass the appropriate
package_pinned or final_recheck convention into the helper, preserving the
existing missing-target and absence_release validation behavior.

In `@scripts/test_verify_clean_set_receipt.py`:
- Around line 464-473: Расширьте
test_product_pin_rejects_noncanonical_name_or_digest отдельным кейсом для
невалидного digest: используйте корректное имя receipt-v1.json, но значение
digest с верхним регистром или некорректной длиной hex, чтобы выполнение дошло
до _sha256_string и verify_product_receipt завершился VerificationError.
Сохраните существующий кейс для невалидного имени файла.

In `@scripts/verify_clean_set_receipt.py`:
- Around line 429-437: Добавьте таймаут к вызову subprocess.check_output в Git
lookup и обработайте истечение таймаута через существующий catch, чтобы ошибка
преобразовывалась в VerificationError через _fail. Нормализуйте error.output
через значение по умолчанию, учитывающее None, перед decode, сохранив текущий
формат диагностического сообщения.
- Around line 837-855: Update the table-header parsing around current_table so
any TOML table header, including array-of-table forms such as [[bin]], [[test]],
and [[bench]], is recognized and resets the package context. Preserve matching
of ordinary sections like [package], and ensure subsequent fields from array
tables are not evaluated as package license fields.
- Around line 610-622: Replace the ternary expression in the accepted-points
validation near counts["accepted_chromatic"] and counts["neutral_points"] with
an explicit check: validate that both values are exact integers, then validate
their sum against ACCEPTED_POINTS using _exact_int. Preserve the existing
failure behavior for missing or non-integer values.
- Around line 356-372: Replace the hard-coded codec body offset in _decode_codec
with a value derived from the format constants, such as the header length plus
the offset-table size, and reuse that derived offset when slicing codec. Apply
the same change to the duplicated literal in _decode_raw, preserving the
existing validation and decoding behavior.
🪄 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: 3eefa56f-04d4-419a-b6b9-e0e47ff00504

📥 Commits

Reviewing files that changed from the base of the PR and between f64a6c1 and 9ade78f.

⛔ Files ignored due to path filters (1)
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/point-clean-set-srgb8-column-rle-v1.bin is excluded by !**/*.bin
📒 Files selected for processing (24)
  • .gitattributes
  • .github/workflows/ci.yml
  • crates/labcolors-core/Cargo.toml
  • crates/labcolors-core/LICENSES/CC-BY-4.0.txt
  • crates/labcolors-core/LICENSES/CC-BY-SA-4.0.txt
  • crates/labcolors-core/NOTICE.md
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.json
  • crates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256
  • crates/labcolors-core/src/clean_set.rs
  • crates/labcolors-core/src/clean_set_tests.rs
  • crates/labcolors-core/src/generic_boundary_tests.rs
  • crates/labcolors-core/src/lib.rs
  • crates/labcolors-core/src/program.rs
  • crates/labcolors-core/src/program_boundary_tests.rs
  • crates/labcolors-core/src/program_clean_set_tests.rs
  • crates/labcolors-core/src/program_identity.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
  • crates/labcolors-core/src/program_session_tests.rs
  • crates/labcolors-core/tests/sha256.rs
  • scripts/test_verify_clean_set_receipt.py
  • scripts/verify_clean_set_receipt.py

Comment thread crates/labcolors-core/src/generic_boundary_tests.rs
Comment thread crates/labcolors-core/src/program_identity.rs
Comment thread crates/labcolors-core/src/program_mixed_evaluator_tests.rs
Comment thread crates/labcolors-core/src/program_session.rs
Comment thread scripts/test_verify_clean_set_receipt.py Outdated
Comment thread scripts/verify_clean_set_receipt.py Outdated
Comment thread scripts/verify_clean_set_receipt.py
Comment thread scripts/verify_clean_set_receipt.py
Comment thread scripts/verify_clean_set_receipt.py
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