R3a: проверять clean-set на финальном представлении - #476
Conversation
WalkthroughДобавлены package-pinned clean-set классификатор и typed constraints, строгая offline-проверка product receipt и license closure, research replay-проверка, legal-файлы, receipt-контракты, presentation cache, новые evidence/subject-типы и расширенные Rust/Python/CI-тесты. ChangesClean-set receipt и программная интеграция
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
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: 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
⛔ Files ignored due to path filters (1)
crates/labcolors-core/contracts/clean-set-srgb8-v1/point-clean-set-srgb8-column-rle-v1.binis excluded by!**/*.bin
📒 Files selected for processing (24)
.gitattributes.github/workflows/ci.ymlcrates/labcolors-core/Cargo.tomlcrates/labcolors-core/LICENSES/CC-BY-4.0.txtcrates/labcolors-core/LICENSES/CC-BY-SA-4.0.txtcrates/labcolors-core/NOTICE.mdcrates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.jsoncrates/labcolors-core/contracts/clean-set-srgb8-v1/receipt-v1.sha256crates/labcolors-core/src/clean_set.rscrates/labcolors-core/src/clean_set_tests.rscrates/labcolors-core/src/generic_boundary_tests.rscrates/labcolors-core/src/lib.rscrates/labcolors-core/src/program.rscrates/labcolors-core/src/program_boundary_tests.rscrates/labcolors-core/src/program_clean_set_tests.rscrates/labcolors-core/src/program_identity.rscrates/labcolors-core/src/program_joint_integration_tests.rscrates/labcolors-core/src/program_lcs_integration_tests.rscrates/labcolors-core/src/program_mixed_evaluator_tests.rscrates/labcolors-core/src/program_session.rscrates/labcolors-core/src/program_session_tests.rscrates/labcolors-core/tests/sha256.rsscripts/test_verify_clean_set_receipt.pyscripts/verify_clean_set_receipt.py
Что изменено
ac6d9654fc722334d8bc2054afb903770f2aad80;PointPresentation-subject для общегоHard | ReportOnlyconstraint path;Emptyи rejected point остаются разными типизированными нарушениями; finite search и fresh recheck используют тот же закон;Почему
Исходный цвет токена не равен реально видимому цвету после прозрачности и последующих слоёв. Проверка nominal source давала бы ложную гарантию. Срез связывает конвенцию с точным финальным вкладом конкретного occurrence в конкретный terminal root и не вводит рецептурные роли, отдельный solver или преждевременный
auto.Воздействие
f64a6c17;90aaed651efd4c12f6cb3c7740143e85713f6914a20435d39206f1ebd19c2cea;labcolors-coreнесёт явную смешанную лицензионную closure встроенных данных.Проверки exact head
c0c2f08cargo +1.96.0 test --workspace --locked: PASS; core 861 pass + 6 intentional ignore;-D warnings, rustdoc-D warnings,git diff --check: PASS;labcolors-core-0.3.0.crate: 869373 байта, SHA-256d81b9f70d23e9ace8a43dcd4f599781945cc7661ce4df292945bc16e97b2c94a; closure VERIFIED; doctests 4/4 + compile-fail 33/33;Финальный product receipt SHA-256:
874926f880901e5b9ffeb0fb23a6466f9745a5a120ca29b47309b7c078aa9a40.Честная граница
CI проверяет самодостаточную product/package closure. Полный scientific replay дополнительно требует отдельный checkout research-репозитория на закреплённом commit; у него пока нет remote. Срез остаётся private и не открывает
autoили публичную гарантию человеческого восприятия.Summary by CodeRabbit
receipt-v1.jsonи соответствующий SHA-256.NOTICE.md.