Skip to content

Core: authored selection release with a proven total preorder (V5c-1) - #531

Merged
lemone112 merged 5 commits into
mainfrom
v5c-1-selection-release
Aug 5, 2026
Merged

Core: authored selection release with a proven total preorder (V5c-1)#531
lemone112 merged 5 commits into
mainfrom
v5c-1-selection-release

Conversation

@lemone112

@lemone112 lemone112 commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

V5c-1: the sole authored selection input, ahead of the V5c session integration.

  • selection_release.rs (labcolors-core): SelectionReleaseV1 declares a total preorder over opaque canonical candidate keys as an ordered sequence of tie groups. Admission is sealed and content-addressed (labcolors.selection-release.v1\0 domain-separated SHA-256 over revision + canonical groups); key order inside a tie group is not policy — groups canonicalise before identity. The single common tie-break inside a group is the canonical key bytes; declaration index, usize, RGB bytes, distances and weights never participate. select_order_v1 materialises one candidate set's total order by (rank, key bytes) only, rejecting unknown keys, duplicate bindings and empty sets with typed errors.
  • Hostile contract (7 tests): foreign-shape admission rejection table, content-addressed revision-bound identity, tie-group permutation invariance, preorder rank grammar, rank-then-key ordering with input-permutation invariance, foreign-binding rejection, bijective payload relabeling invariance. RED commit a2e6de1, GREEN commit c17952b.
  • No numeric behaviour changes; no pinned inventory changes; the module is dead-code-exempted until V5c-2 materialises the joint order from it. Full crate suite green locally (the --test sha256 python3-corpus case requires python3, present only in the CI image).

Summary by CodeRabbit

  • Новые возможности

    • Добавлен механизм авторизованного выпуска подборок кандидатов с версией и контентной идентификацией.
    • Реализовано детерминированное ранжирование: сначала учитываются группы приоритета, затем канонические байты ключей.
    • Добавлена проверка пустых релизов, дубликатов и неизвестных привязок с понятными типизированными ошибками.
  • Исправления

    • Обновлены контрольные суммы артефактов и проверочных данных для подтверждения их целостности.
    • Добавлены проверки корректности порядка, идентичности и обработки пустых наборов кандидатов.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0198b61c-5d86-4963-9c8f-fa08d0e63a49

📥 Commits

Reviewing files that changed from the base of the PR and between d418123 and 3097133.

📒 Files selected for processing (2)
  • crates/labcolors-core/src/selection_release.rs
  • crates/labcolors-core/src/selection_release_tests.rs

Walkthrough

Добавлен внутренний модуль selection_release для авторизованного ранжирования кандидатов. Он проверяет канонические группы ключей, создаёт identity с учётом revision и материализует детерминированный порядок. Обновлены тесты и контрольные хэши артефактов.

Changes

Selection release V1

Layer / File(s) Summary
Контракт и admission релиза
crates/labcolors-core/src/selection_release.rs
Добавлены типы релиза, ключа и ошибок. Admission отклоняет пустые группы, неизвестные состояния и дубликаты. Каноническое содержимое и revision входят в SHA-256 identity.
Ранжирование и материализация порядка
crates/labcolors-core/src/selection_release.rs, crates/labcolors-core/src/selection_release_tests.rs, crates/labcolors-core/src/lib.rs
Добавлены методы identity, revision, rank_of и select_order_v1. Кандидаты сортируются по рангу и байтам ключа. Тесты проверяют ошибки, стабильность identity и порядок payload. Модули подключены в lib.rs.
Синхронизация артефактов и проверок
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/contracts/point-support-reference-surplus-q55-bps-proof-v1.json, scripts/verify_point_support_surplus.py
Обновлены размеры и SHA-256 для изменённого исходного файла, proof-контракта, receipt и исходной капсулы верификатора.

Estimated code review effort: 4 (Complex) | ~45 минут

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant admit_selection_release_v1
  participant AdmittedSelectionReleaseV1
  participant CandidateSet
  Caller->>admit_selection_release_v1: передаёт SelectionReleaseV1
  admit_selection_release_v1->>AdmittedSelectionReleaseV1: проверяет и канонизирует release
  AdmittedSelectionReleaseV1-->>Caller: возвращает допущенный release
  Caller->>AdmittedSelectionReleaseV1: вызывает select_order_v1
  AdmittedSelectionReleaseV1->>CandidateSet: проверяет привязки и сортирует payload
  CandidateSet-->>Caller: возвращает упорядоченный Box<[C]>
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Заголовок точно и кратко описывает основное изменение: добавление авторизованного selection release с полным предпорядком для V5c-1.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ 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 v5c-1-selection-release

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

Claude Code added 2 commits August 5, 2026 11:39
…ation

lib.rs now registers selection_release, so the point-support source
capsule and the clean-set module-registration artifact are rebound to
the new byte digests without any semantic change.

@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/selection_release_tests.rs`:
- Around line 73-83: Add a test alongside
identity_is_content_addressed_and_revision_bound that verifies identity encoding
separates key and group boundaries: compare releases containing one key b"ab"
versus keys b"a", b"b", then compare the split-key release with the same keys
placed in separate rank groups, asserting distinct identities for both pairs.

In `@crates/labcolors-core/src/selection_release.rs`:
- Around line 159-168: Replace the unit-valued BTreeMap used by bound in the
candidate-binding loop with a BTreeSet, adding the required import and
preserving the existing duplicate detection via insert(key.as_bytes()). Keep the
UnknownCandidateKey lookup and DuplicateCandidateBinding error behavior
unchanged.
- Around line 96-120: Замените все три вызова unwrap при преобразовании размеров
в u32 на типизированную обработку ошибки. Добавьте вариант
SelectionReleaseErrorV1 для неподдерживаемого размера и возвращайте его при
переполнении числа tie-групп, ключей в группе или длины ключа, сохраняя
хеширование для допустимых значений.
🪄 Autofix

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: be660f0a-5494-44a3-beb1-afcf7824b692

📥 Commits

Reviewing files that changed from the base of the PR and between e1ff819 and d418123.

📒 Files selected for processing (7)
  • 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/contracts/point-support-reference-surplus-q55-bps-proof-v1.json
  • crates/labcolors-core/src/lib.rs
  • crates/labcolors-core/src/selection_release.rs
  • crates/labcolors-core/src/selection_release_tests.rs
  • scripts/verify_point_support_surplus.py

Comment thread crates/labcolors-core/src/selection_release_tests.rs
Comment thread crates/labcolors-core/src/selection_release.rs Outdated
Comment thread crates/labcolors-core/src/selection_release.rs
Admission now rejects oversized length fields through a typed
ReleaseShapeOverflow verdict instead of panicking, and a hostile test
pins that the length-prefixed identity grammar separates key and group
boundaries for releases with identical joined key bytes.
@lemone112
lemone112 merged commit e024f8e into main Aug 5, 2026
10 checks passed
@lemone112
lemone112 deleted the v5c-1-selection-release branch August 5, 2026 09:31
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