3.5 KiB
| id | ticket | title | status | created | ref_decisions | tags | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PLN-0169 | runtime-owned-variable-glyph-bank-palette-protocol | Asset Decode Validation for Variable Glyph Palettes | open | 2026-07-14 |
|
|
Briefing
DEC-0041 changes glyph-bank decode from a fixed 4096-byte palette block to a
variable palette_count * 16 * 4 block. The asset manager is the runtime gate
that must reject malformed glyph payloads before residency.
Decisions de Origem
DEC-0041- Variable Glyph Bank Palette Protocol
Alvo
Update glyph asset layout validation and decode to accept palette_count in
1..=64 and materialize exactly that many palettes.
Escopo
- Update
crates/console/prometeu-drivers/src/asset.rs. - Replace exact
palette_count == 64validation. - Replace fixed
GLYPH_BANK_PALETTE_BYTES_V1usage in decode. - Validate
sizeanddecoded_sizeusing variable formulas. - Read exactly
palette_count * 16 * 4bytes. - Preserve RGBA byte order.
Fora de Escopo
- HAL storage changes except as required by
PLN-0168. - Composer invalid-reference behavior.
- Packer output changes.
Plano de Execucao
Step 1 - Change layout return data
What: Carry palette count through layout validation.
How: Update decode_glyph_bank_layout to return palette_count and
palette byte count along with tile size, dimensions, and serialized pixel byte
count.
Files: crates/console/prometeu-drivers/src/asset.rs
Step 2 - Replace exact palette-count validation
What: Accept only the DEC-0041 range.
How: Reject palette_count = 0 and palette_count > 64; accept all values
in 1..=64.
Files: crates/console/prometeu-drivers/src/asset.rs
Step 3 - Use variable size formulas
What: Align entry validation with the spec.
How: Compute palette_bytes = palette_count * 16 * size_of::<u32>(),
serialized_size = packed_pixels + palette_bytes, and
decoded_size = logical_pixels + palette_bytes.
Files: crates/console/prometeu-drivers/src/asset.rs
Step 4 - Decode variable palette data
What: Read only materialized palettes.
How: In buffer and reader decode paths, slice/read exactly palette_bytes.
Populate the new variable GlyphBank palette representation in order.
Files: crates/console/prometeu-drivers/src/asset.rs
Step 5 - Remove fixed-byte assumptions
What: Retire the fixed payload block from active decode.
How: Replace helper functions and tests that assume
GLYPH_BANK_PALETTE_BYTES_V1 is always in the payload. Keep a maximum constant
only if it is named as a maximum, not a payload size.
Files: crates/console/prometeu-drivers/src/asset.rs
Criterios de Aceite
- Decode accepts valid
palette_countvalues from1through64. - Decode rejects
palette_count = 0. - Decode rejects
palette_count > 64. sizeanddecoded_sizevalidation use variable palette bytes.- Buffer and reader decode paths behave consistently.
- RGBA channel order remains unchanged.
Tests / Validacao
- Add unit tests for
palette_count = 1, an intermediate count, and64. - Add rejection tests for
0,65, short palette data, oversized metadata size, and mismatcheddecoded_size. - Run the crate tests that cover asset manager glyph decode.
Riscos
- Existing tests may use generated glyph payload helpers with fixed 64-palette size.
- Reader and buffer paths can drift if only one path receives the variable-size change.