Skip to content

Core: заменить AlphaAnalog execution единым point-представлением - #518

Merged
lemone112 merged 7 commits into
mainfrom
codex/v3-point-representation
Aug 3, 2026
Merged

Core: заменить AlphaAnalog execution единым point-представлением#518
lemone112 merged 7 commits into
mainfrom
codex/v3-point-representation

Conversation

@lemone112

@lemone112 lemone112 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Что изменено

  • recipe-specific analog.rs заменён приватным point_representation.rs;
  • физический coordinator принимает только target, typed opacity и backdrop — без client ID, declaration ordinal, RoleSpec и recipe vocabulary;
  • удалены публичные AlphaAnalog, resolve_alpha_analog и resolve_alpha_analog_hex;
  • замороженный recipe-frontend теперь односторонне понижается в общий exact point-закон;
  • сохранены один source-over kernel, финальный exact recheck и zero-allocation execution;
  • добавлен anti-drift gate, запрещающий возврат recipe-specific execution.

Почему

Core одновременно владел физикой и authored routing. Это нарушало opaque-ID границу и создавало второй recipe-shaped execution path рядом с generic Paint/Surface/Occurrence.

Влияние

Публичный низкоуровневый helper удалён намеренно: клиентов и обязательств обратной совместимости ещё нет. Конфигурационный frontend пока остаётся замороженным до общего public Program cutover; его byte output не изменён.

Проверки

  • RED: новый boundary-test сначала не компилировался без generic модуля;
  • cargo test --workspace --all-targets: GREEN, core 1007 passed / 7 ignored; WASM 73 passed; остальные workspace gates GREEN;
  • cargo clippy --workspace --all-targets -- -D warnings: GREEN;
  • cargo test --workspace --doc: 37 doctests GREEN;
  • exhaustive 65 536 channel-pair oracle и property differential frontend ↔ physical law: GREEN;
  • allocation gate: 0 heap allocations;
  • focused mutation run: 65 mutants, 42 caught, 9 unviable, 14 timeout, 0 missed. Timeout-mutants создают неограниченные циклы и не выдаются за completed mutation proof.

Scope

Этот PR удаляет один специальный execution path. Он не заявляет завершение free-alpha/glass, Material/Glow cutover, cleanliness, LCS или LPC.

Summary by CodeRabbit

  • Изменения

    • Обновлена модель точечного представления цветов и непрозрачности с проверкой точности для sRGB8.
    • Минимальная допустимая непрозрачность автоматически повышается до первого точного результата.
    • Добавлена каноническая прозрачность.
    • Удалены устаревшие интерфейсы аналоговой альфа-композиции.
  • Документация

    • Уточнены правила композиции и преобразования рецептов в общие физические представления.
  • Тесты

    • Обновлены проверки точности, разрешимости на байтовой сетке и отсутствия устаревшей терминологии.

@coderabbitai

coderabbitai Bot commented Aug 3, 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: 17 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: 9b4be73c-c0ac-4c92-843a-da097ea7f8bf

📥 Commits

Reviewing files that changed from the base of the PR and between cb90dcf and 25ae8ae.

📒 Files selected for processing (9)
  • 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/generic_boundary_tests.rs
  • crates/labcolors-core/src/point_representation.rs
  • crates/labcolors-core/src/semantic.rs
  • packages/colors/bench/wasm.json
  • scripts/check-wasm-size-budget.mjs
  • scripts/verify_point_support_surplus.py

Walkthrough

PR заменяет legacy AlphaAnalog API и модуль analog на point_representation. Resolver использует Srgb8 source и typed AdmittedOpacityV1. Semantic frontend вызывает общий exact point resolver.

Changes

Миграция point representation

Layer / File(s) Summary
Ядро exact point representation
crates/labcolors-core/src/point_representation.rs, crates/labcolors-core/src/composition.rs, crates/labcolors-core/src/lib.rs, crates/labcolors-core/src/appearance.rs
VerifiedAlphaAnalogV1 и связанные API заменены на point-типы. Authored binding удалён. Добавлена каноническая прозрачность AdmittedOpacityV1::TRANSPARENT.
Интеграция semantic AlphaAnalog
crates/labcolors-core/src/semantic.rs, crates/labcolors-core/src/appearance_graph_tests.rs
Standalone и named invocations используют общий exact resolver, typed minimum opacity и ordinal-based dispatch.
Физические alpha-тесты и границы
crates/labcolors-core/src/alpha.rs, crates/labcolors-core/src/generic_boundary_tests.rs
Тесты проверяют exact materialization, минимальность opacity, strict binary64 inversion и удаление legacy API.
Контракты и описание поведения
crates/labcolors-core/src/config.rs, docs/whitepaper.md
Документация описывает AlphaAnalog как frontend общего point-representation pipeline.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • Labpics-Team/lab-colors#269: Предыдущий refactor AlphaAnalog API и связанных alpha/compositing путей.
  • Labpics-Team/lab-colors#354: Предыдущая exact-occurrence реализация, заменяемая generic point representation.
  • Labpics-Team/lab-colors#310: Общие изменения alpha.rs, appearance.rs и SourceOverCertificateV1, используемые новым physical path.
🚥 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 Заголовок точно описывает основной переход исполнения AlphaAnalog на единое point-представление.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 codex/v3-point-representation

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

@lemone112

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 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.

@lemone112
lemone112 marked this pull request as ready for review August 3, 2026 06:22
@lemone112
lemone112 merged commit 08c1299 into main Aug 3, 2026
10 checks passed
@lemone112
lemone112 deleted the codex/v3-point-representation branch August 3, 2026 07:17
lemone112 added a commit that referenced this pull request Aug 14, 2026
…d delete its physical recipe path (#578)

* test(colors): pin the Material characterization corpus before the C7d lowering

Every public Material construction path (Brand / Family / five NeutralPick
sources, all four passport themes, mixed per-theme tones, both legal floors,
gray-background pole flip, the direct NamedRoleTable boundary with hue: None,
and the typed chromatic-source conflict on both boundaries) is pinned
bit-for-bit on the current physics: tone hex, selected alpha bits, worst
conservative contrast bits, achieved dJ' bits, committed pole, satisfied
status and the ordered 60-step bisection bracket.

The corpus is the differential oracle for the C7d one-way lowering: a missed
construction path, a compositor/order change, a single-backdrop substitute for
the [black, white] corridor or a silent degradation breaks these pins.
Sensitivity was proven by a deliberate one-bit alpha mutation (RED observed,
then reverted).

* feat(colors): lower Material into the compiled Program spine and delete its physical recipe path (C7d)

- move the 60-step BackdropBox bisection physics verbatim into the private
  vocabulary-clean generic module corridor_representation (single source of
  the compositor envelope, directed-search guard and rechecked bracket)
- compile every Material construction path (config, DTO tag, direct
  NamedRoleTable::new / from_validated_parts) one-way into
  CompiledMaterialInvocationV1; resolve_named_set intercepts the ordinal
  before recipe dispatch (AlphaAnalog #518 precedent) with order-drift and
  leftover-invocation InternalInvariant guards
- raw RoleSpec::Material arm becomes a typed InternalInvariant guard;
  resolve_material and the callable old physical path are deleted
- public Material syntax stays frozen pre-C7c: material.rs facades delegate
  bit-identically to corridor physics (locked by a facade/corridor
  bit-identity test); WASM adapters remain projection-only
- zero-floor Material is rejected fail-closed at both compile boundaries
  (ConfigError::MaterialFloorRequired / NamedRoleTableCompileError::Material)
- hostile source scanner: corridor module joins GENERIC_SOURCES and a new
  gate proves no Material physics outside the generic lowering
- canonical reseal of the point-support capsule after the lib.rs module
  registration (independent verifier PASS)

* chore(colors): re-ratchet the runtime WASM exact-byte budget from the C7d CI measurement

The Material corridor lowering changes runtime WASM bytes
(378113 -> 379268 on the canonical linux-x64 toolchain-pinned job,
github-actions-run-31819594271). The budget is an exact measured pin with
zero arbitrary headroom, so the new measurement replaces the old one and
the checker file SHA-256 is re-bound to the canonical document.

* fix(colors): restore the canonical single-LF ending of the resealed point-support proof

The C7d reseal rewrote the proof artifact with a CRLF tail on Windows;
the release contract requires exactly one canonical JSON object followed
by one LF. Byte-level fix only: the JSON payload, verifier PASS and the
sealed capsule hashes are unchanged.
lemone112 pushed a commit that referenced this pull request Aug 18, 2026
- CompiledGlowInvocationV1 (tint/step/mode) compiled at table build,
  mirroring Material (C7d) and AlphaAnalog (#518)
- resolve_named_set intercepts the ordinal before recipe dispatch;
  order drift and leftover invocations are typed InternalInvariant
- raw RoleSpec::Glow arm is now a typed guard: executing it would
  recreate a second physics source
- architecture guard glow_execution_lives_only_in_the_compiled_invocation
  (sabotage-proven: fails on a second solve_screen_alpha_for_dj call site)
- bypass test proves missing invocation fails closed, no recipe fallback
lemone112 added a commit that referenced this pull request Aug 18, 2026
…invocation (#581)

* refactor(colors): move encoded-sRGB8 screen law into field_effect as single SSOT

- encoded_srgb8_screen_channel in field_effect owns the reference law
- glow.rs delegates its channel; local formula deleted
- architecture guard glow_screen_physics_lives_only_in_field_effect
  (sabotage-proven: fails when local formula returns)
- differential test pins glow bytes to the field_effect carrier

* feat(colors): C7e - execute Glow only through its compiled invocation

- CompiledGlowInvocationV1 (tint/step/mode) compiled at table build,
  mirroring Material (C7d) and AlphaAnalog (#518)
- resolve_named_set intercepts the ordinal before recipe dispatch;
  order drift and leftover invocations are typed InternalInvariant
- raw RoleSpec::Glow arm is now a typed guard: executing it would
  recreate a second physics source
- architecture guard glow_execution_lives_only_in_the_compiled_invocation
  (sabotage-proven: fails on a second solve_screen_alpha_for_dj call site)
- bypass test proves missing invocation fails closed, no recipe fallback

* chore(colors): ratchet runtime WASM budget to C7e canonical Linux observation

* chore(colors): repin runtime WASM budget file SHA after C7e ratchet

* fix(colors): type the alpha boundary of the shared screen channel law

encoded_srgb8_screen_channel now takes FieldOpacityV1: NaN/infinite/out-of-range
alpha is unrepresentable at the law boundary, so garbage input cannot produce
a plausible byte result. Domain validation stays centralized in FieldOpacityV1;
the quantised composite stream converts its invariant-held alpha bits through
a documented expect.

* chore(colors): ratchet runtime WASM budget to typed-alpha canonical Linux observation

---------

Co-authored-by: Daniel from Labpics <daniilerosov12@gmail.com>
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