Skip to content

refactor: keep appearance graph physical - #336

Merged
lemone112 merged 7 commits into
mainfrom
agent/c7a-appearance-evidence
Jul 16, 2026
Merged

refactor: keep appearance graph physical#336
lemone112 merged 7 commits into
mainfrom
agent/c7a-appearance-evidence

Conversation

@lemone112

@lemone112 lemone112 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Результат

Physical appearance graph больше не хранит authored EvidenceClass и LegacyCompatibility. Occurrence содержит только source / against / backdrop; source-over задаётся версионированным CompositionProfileV1 и replay-сертификатом.

RED → GREEN

  • Compile-time RED доказал, что ForegroundOccurrenceSpec требовал нефизическую evidence-ось, а ResolvedOccurrence переносил её в результат.
  • После удаления оси: appearance graph 12/12; PairLabel differential/property 8/8.
  • Canonical Linux size gate честно обнаружил уменьшение runtime WASM: 454385 → 454334 B.
  • Docs-only правка сохранила размер, но изменила SHA и вскрыла ложное смешение size policy с artifact identity.
  • V7 хранит только exact raw size без headroom. Same-size byte mutation проходит size gate; ±1 B остаётся RED; artifact SHA запрещён в size schema.
  • CI собирает обе роли, выполняет cargo clean, повторяет тот же exact versioned recipe и fail-closed сравнивает полные pkg/ и compiler/ outputs. Это проверяет повторяемость внутри одного toolchain-pinned CI job, не cross-run/cross-host identity.
  • Hostile mutations доказывают, что дополнительный build flag, нейтрализация diff, fail-body path guard и ложный recipe-sha=match не проходят.
  • Release provenance отдельно связывает HEAD/GITHUB_SHA → actual role SHA → build-metadata → tarball → publish readback.

Инварианты

  • Surface/occurrence RGB bytes, topology и typed errors не меняются.
  • Certificate profile, operands, binary64 alpha bits, output и replay сохранены.
  • PairLabel outcomes равны migration oracle на проверяемом домене; оба пути используют один downstream solver, поэтому differential не выдаётся за независимый oracle его математики.
  • Публичного ABI-изменения нет: затронутые graph-типы pub(crate).
  • Исторические WASM budgets V1–V6 неизменны; V7 — текущий append-only документ.

Проверка

  • npm test: 155/155.
  • npm run typecheck: green.
  • Rust workspace/MSRV/fmt/clippy/rustdoc/audit: green.
  • Swift conformance: green.
  • Canonical Linux runtime: 454334 B, SHA 999ca532…de32.
  • Canonical Linux compiler: 229658 B, SHA 34e2a561…bc8d.
  • Same-job repeated full outputs: byte-identical.
  • Все GitHub CI gates: green; review threads: 0 unresolved.

CodeRabbit одобрил срез на 2ee9f24. Финальный 67b1cba содержит только fail-closed hardening по независимому hostile-review; повторный incremental CodeRabbit run попал в fair-usage limit, поэтому новых циклов ради обязательного «найти ещё что-нибудь» не запускалось. Независимый финальный verdict: GO.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

Удалена классификация EvidenceClass из appearance-графа и связанных контрактов. PairLabel-документация обновлена. WASM-бюджет переведён на v7 с immutable-связью на v6, обновлённой валидацией, release-тестами и воспроизводимой CI-сборкой.

Changes

Контракт физических фактов appearance

Layer / File(s) Summary
Контракт физических фактов
crates/labcolors-core/src/appearance.rs, crates/labcolors-core/src/appearance_graph_tests.rs
EvidenceClass и поля evidence удалены из appearance-контрактов и evaluation path; тесты проверяют физические поля occurrences и replay сертификата.
Связь PairLabel и документация
crates/labcolors-core/src/semantic.rs, docs/whitepaper.md
PairLabel использует appearance-поверхность без evidence-классификации; документация описывает physical facts, replay и роль differential-проверок.

WASM-бюджет v7

Layer / File(s) Summary
Определение бюджета v7
packages/colors/bench/wasm-size-budget-v7.json, packages/colors/README.md, scripts/check-wasm-size-budget.mjs
Добавлен v7-бюджет с ролями, рецептами, измерениями, политиками и immutable-предшественником v6; обновлены связанные идентификаторы и история.
Валидация бюджета v7
scripts/check-wasm-size-budget.mjs
Валидатор проверяет v7, связь с v6, role measurements, ceilings, SHA-256 и вывод artifact-хэша.
Release-контракты и воспроизводимая сборка
packages/colors/test/release-contract.test.mjs, .github/workflows/ci.yml
Тесты покрывают версии v1–v7 и 26 мутаций; CI повторно собирает runtime и compiler, сравнивает артефакты и проверяет build paths.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

  • Labpics-Team/lab-colors#310: напрямую связан с удалением EvidenceClass и полей evidence в appearance-графе.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% 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 Заголовок точно отражает рефакторинг физического appearance-графа и удаление authored evidence/LegacyCompatibility, хотя не упоминает сопутствующие изменения.
✨ 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/c7a-appearance-evidence

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

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 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: 2

🤖 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/semantic.rs`:
- Around line 691-697: В rustdoc-комментариях вокруг описания графа замените
англоязычные термины обычной прозы: `Differential` переведите как
«дифференциальный тест», `downstream` — как «последующий резолвер», а `oracle` —
как «эталон». Не изменяйте точные имена полей, API и код.

In `@docs/whitepaper.md`:
- Around line 213-219: В русскоязычном фрагменте замените англоязычные термины
Differential, wiring, outcomes, oracle и downstream solver на русские
эквиваленты, сохранив исходный смысл. Имена полей source/against/backdrop и
идентификаторы ссылок не изменяйте.
🪄 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: 38b80fc5-09b5-47fe-b6cd-6e28bd57954d

📥 Commits

Reviewing files that changed from the base of the PR and between 1bbe173 and 3997a30.

📒 Files selected for processing (8)
  • crates/labcolors-core/src/appearance.rs
  • crates/labcolors-core/src/appearance_graph_tests.rs
  • crates/labcolors-core/src/semantic.rs
  • docs/whitepaper.md
  • packages/colors/README.md
  • packages/colors/bench/wasm-size-budget-v7.json
  • packages/colors/test/release-contract.test.mjs
  • scripts/check-wasm-size-budget.mjs
💤 Files with no reviewable changes (1)
  • crates/labcolors-core/src/appearance.rs

Comment thread crates/labcolors-core/src/semantic.rs Outdated
Comment thread docs/whitepaper.md Outdated

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Финальный bounded review после исправления корневого смешения size budget, same-source reproducibility и release provenance. Просьба проверить только текущий HEAD c12bb17.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

@lemone112 Принято. Проверю только текущий HEAD c12bb17, с фокусом на size budget, воспроизводимость из одного исходника и release provenance.

✅ 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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/check-wasm-size-budget.mjs (1)

336-343: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Задокументируйте инвариант статического declared-recipe-sha=match.

Строка всегда печатает match, потому что validateBudgetValue() уже фейлит раньше при расхождении recipeSha256. Это корректно сейчас, но неявно — если порядок вызовов (readBudgetevaluateWasmBudget) когда-нибудь изменится, лог начнёт лгать без единого признака ошибки в самом formatResult.

💬 Предлагаемое уточнение
 function formatResult(result, artifact) {
   const delta = `${result.deltaBytes >= 0 ? "+" : ""}${result.deltaBytes}`;
   return (
     `WASM size budget ${result.status} role=${result.role} raw=${result.rawBytes}B ` +
     `ceiling=${result.maxRawBytes}B delta=${delta}B gzip=${result.gzipBytes}B ` +
     `diagnostic-only platform=${result.currentPlatform} artifact=${artifact} ` +
+    // Recipe SHA is already enforced fail-fast in validateBudgetValue(); reaching
+    // this point guarantees the match, so it is safe to report statically here.
     `artifact-sha256=${result.artifactSha256} declared-recipe-sha=match`
   );
 }
🤖 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 `@scripts/check-wasm-size-budget.mjs` around lines 336 - 343, Зафиксируйте
инвариант для статического поля declared-recipe-sha=match в formatResult: это
значение допустимо только потому, что validateBudgetValue() проверяет
recipeSha256 до формирования результата в цепочке readBudget →
evaluateWasmBudget. Добавьте краткое пояснение рядом с формированием строки, не
меняя текущий формат вывода.
🤖 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 `@docs/whitepaper.md`:
- Around line 220-221: В тексте документации замените смешанное выражение
«typography-фактов» на «типографических фактов», а грамматически некорректное
«никакой размер/вес текста» — на «ни размер, ни вес текста», сохранив остальной
смысл абзаца.

---

Outside diff comments:
In `@scripts/check-wasm-size-budget.mjs`:
- Around line 336-343: Зафиксируйте инвариант для статического поля
declared-recipe-sha=match в formatResult: это значение допустимо только потому,
что validateBudgetValue() проверяет recipeSha256 до формирования результата в
цепочке readBudget → evaluateWasmBudget. Добавьте краткое пояснение рядом с
формированием строки, не меняя текущий формат вывода.
🪄 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: 70fcb76c-cc61-4e42-a0dd-4a4d39eebe6a

📥 Commits

Reviewing files that changed from the base of the PR and between 3997a30 and c12bb17.

📒 Files selected for processing (7)
  • .github/workflows/ci.yml
  • crates/labcolors-core/src/semantic.rs
  • docs/whitepaper.md
  • packages/colors/README.md
  • packages/colors/bench/wasm-size-budget-v7.json
  • packages/colors/test/release-contract.test.mjs
  • scripts/check-wasm-size-budget.mjs

Comment thread docs/whitepaper.md Outdated

Copy link
Copy Markdown
Collaborator Author

Review disposition для замечания вне diff о declared-recipe-sha=match: Rejected as false on current HEAD. Checker принимает произвольные WASM-байты и не может вывести их provenance из валидности budget document; hostile RED воспроизвёл match на локальном darwin artifact. Поле удалено, тест теперь запрещает recipe-sha=match / artifact-sha=match. Языковое замечание в whitepaper исправлено в 2ee9f24, thread resolved.

@lemone112
lemone112 merged commit 815d36f into main Jul 16, 2026
10 checks passed
@lemone112
lemone112 deleted the agent/c7a-appearance-evidence branch July 16, 2026 21:38
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