Core: добавить exact RawBitmap24 family codec - #495
Conversation
WalkthroughДобавлена точная RawBitmap24-кодировка семейных артефактов с streaming-проверкой digest, отдельным production storage и валидацией payload до bitmap-сканирования. Fixture-путь сохранён для тестов, а program fixtures переведены на raw admission. ChangesRawBitmap24 admission
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant FamilyArtifactLoaderV1
participant verify_bound_envelope
participant raw_bitmap24
participant AdmittedFamilyArtifactV2
Client->>FamilyArtifactLoaderV1: load(encoded artifact)
FamilyArtifactLoaderV1->>verify_bound_envelope: validate envelope and payload receipt
verify_bound_envelope->>raw_bitmap24: preflight and verify_image
raw_bitmap24-->>FamilyArtifactLoaderV1: verified image digest
FamilyArtifactLoaderV1->>AdmittedFamilyArtifactV2: store RawBitmap24V1
AdmittedFamilyArtifactV2-->>Client: contains/assess result
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
05b29c2 to
8ccdc5e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/family_artifact/raw_bitmap24.rs`:
- Around line 73-102: Update verify_image to validate payload.len() against
PAYLOAD_LEN_V1 at runtime before processing the bytes, returning
FamilyArtifactLoadErrorV1::CodecPayloadLengthMismatch with the appropriate
expected and actual lengths on mismatch. Keep the debug assertion only if useful
as an additional invariant check, and preserve the existing member-count and
canonical digest flow for valid-length payloads.
🪄 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: 3b944c9f-0350-40de-af7a-b9042ba591a3
📒 Files selected for processing (6)
.cargo/mutants.tomlcrates/labcolors-core/src/family.rscrates/labcolors-core/src/family_artifact.rscrates/labcolors-core/src/family_artifact/raw_bitmap24.rscrates/labcolors-core/src/family_artifact_tests.rscrates/labcolors-core/src/program_family_tests.rs
Dismissed after the only thread was disproved with the exact admission proof and resolved; CodeRabbit subsequently approved the same head (review 4808024764). No code change is warranted.
Что изменено
RawBitmap24V1для полного IEC sRGB8 domain: один bit на сигнал, RGB big-endian ordinal, MSB0;O(1), allocation-free и не вызывает LCS;Vec<ColorSignal>сохранён только подcfg(test)как независимый storage/decoder oracle;Зачем
Это V5b2a: universal exact storage до появления materialised contextual provider. Срез меняет только representation, не family semantics, cleanliness, selection или public API.
Точный diff
8ed80da39bdc236253f13f859f5fbbe456807d72;8ccdc5e77afed3cfcff3752f2dcee7d6e0a4e9b4;f79316b21547ce728b0e6b7af549b64ed1d0b1c5;1d4f40ca14f2868bf873d28f17605d0f2fe0b2c3.Доказательства
cargo test --workspace --all-features: PASS;32 passed,1 ignored; Program family:16 passed;256³ = 16,777,216differential oracle: ровно один exhaustive test,256members, PASS локально и в CI;contains/assessне аллоцируют;50/50;49 caught,8 unviable,0 missed,0 timeout(raw_bitmap24:38 + 4; family loader/hash:11 + 4);Performance / size
O(1),0 alloc / 0 realloc / 0 dealloc;.rlib +21,432 B, staticlib+8,216 B, dylib0 B;0 Bи byte-identical; wasm-pack 0.13.1 optimized WASM0 Bи byte-identical;Временную скорость cold admission не заявляем: для неё ещё нет отдельного воспроизводимого benchmark-gate.
Границы
Codec и loader остаются
pub(crate); реальный provider import/mint приходит только после V5b2c/V5b2d. Adaptive compression оценивается по benchmark после первого реального artifact и не меняет semantic identity.