Repository navigation
feat(artifacts): report declared DDS, GLB, KTX and KTX2 headers and regions - #14248
Conversation
…egions Recognize DDS (including the DX10 extension), GLB, KTX 1.1 and KTX 2.0 by their header signatures and inventory them as containers. The root format metadata carries the declared header facts. Each declared byte region is a member that is hashed, classified and extractable: the DDS payload; GLB JSON and BIN chunks and BIN-stored images; KTX key/value data and mip levels; and KTX2 DFD, KVD, SGD and levels. Nothing is decoded. A DDS payload is checked against the size derived from its dimensions, mips, faces, layers and block size. Disagreeing extents are reported in extent_check with unknown coverage rather than refused, and regions past the end of the file are dropped, not clipped. Structural header faults refuse as malformed input with the format and offset. Part of #14155
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The change adds four file formats to artifact inspection and extraction workflows. The uncertainty requirement must be satisfied before merging: an invalid GLB buffer URI can still produce complete coverage. SummaryAdds signature-based recognition, header facts, and extractable byte regions for DDS, GLB, KTX, and KTX2 without decoding payloads.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[File signature] --> B[GPU asset reader]
B --> C[Header layout]
C --> D[Root header facts]
C --> E[Stored byte regions]
E --> F[Hashes and extraction]
C --> G[Extent and examined coverage]
G --> H[Complete or unknown inventory]
Reviews (5) · Last reviewed commit: "fix(gpu-assets): count a GLB image as ex..." · Reviewed by Greptile |
- Stop the GLB chunk walk at 1,024 chunks with unknown coverage. - Refuse a GLB chunk that crosses the declared length, or a chunk table that stops short of a physically present declared end, as malformed. - Report coverage unknown when GLB images were not all listed: past the image allowance, an unparsed JSON chunk, or an unresolved bufferView. - Leave the DDS payload size unknown when rows are padded to a declared pitch or more than 32 mip levels are declared, instead of deriving it from different dimensions.
Only buffers[0] without a uri is the GLB BIN chunk. An image whose bufferView sits in a buffer with a uri, or an image named by uri, is stored outside the file; it was counted as an unresolved image and made coverage unknown. Such images are now counted in external_images and leave coverage complete; only views that resolve to no buffer stay unknown.
The 64-bit level-index fields were read from a buffer that starts at file offset 80, but an unsafe value reported its index-relative position. The reader now takes the buffer's file base and reports base plus position, so every failure offset is a file offset.
An image or buffer whose uri is present but not a string, and an image with neither a uri nor a bufferView, were counted in external_images and left coverage complete without an established source. Only a URI string now marks a source external; other sources stay unresolved and keep coverage unknown.
…-20261124 * origin/main: (3854 commits) fix(ci): retry recorded crash dependency acquisition without stale index cache (#14076) chore(deps): bump rcssmin from 1.2.2 to 1.3.0 in /website (#14229) chore(deps): bump markdownify from 1.2.3 to 1.2.4 in /website (#14227) ci: compare frozen selections with observed test failures (#14301) ci: record affected-test predictions above the live cutoff (#14300) ci: wait for static checks before broad PR test shards (#14299) ci: validate workflow anchors with actionlint 1.7.12 (#14298) ci: measure portable runner time for recorded selection predictions (#14304) test(pe): distinguish unsupported DOS input from truncated input (#14302) test(go): check build information in a one-directory PE32 fixture (#14303) fix(tests): damage Deno PE resource framing the loader-equivalent reader reads test(go): expect loader-equivalent PE header facts in the MZ diagnostics (#14293) perf(resources): refuse non-ASAR Pickle prefixes without building errors perf(artifacts): reuse the streamed XML plist verdict when classifying perf(artifacts): decide the FAT header once per classified stream test: run repeated CLI formatting capacity pairings in process (#14279) fix(limits)!: make the IL2CPP pointer index adjustable and require owned refusal limits (#14243) fix(artifacts): report S-record data after the final count (#14260) feat(artifacts): report declared DDS, GLB, KTX and KTX2 headers and regions (#14248) fix(pe)!: share one loader-equivalent PE header owner across static readers (#14253) ...
…an pipeline-cache headers Recognize the four remaining morluto#14155 media/cache containers by their public header signatures and inventory them as archives. Root format metadata carries the declared header facts; each named byte region is a member that is hashed and extractable. Payloads stay opaque: no audio, video or pipeline-cache body decode. Disagreeing extents stay in extent_check with unknown coverage rather than a refusal. Structural header faults refuse as malformed input with format and offset. Completes the remaining formats from morluto#14155 after morluto#14248.
Part of #14155: DDS (including DX10), GLB, KTX and KTX2. Ogg Opus, RIFF/XMA2, Bink 2 and the Vulkan pipeline cache are not covered and remain open.
What changes
These four GPU asset containers were refused as
file_format_rejected. They are now recognized by their header signatures, never by file name, and inventoried as containers (archivetarget kind, new format IDsdds,glb,ktx,ktx2).src/artifacts/gpuAsset/GpuAssetLayouts.tsparses each header once withBinaryReader. It returns the declared metadata (src/domain/formatMetadata/gpuAssetMetadata.ts) and the byte regions the header names.format_metadataiskind: "gpu-asset-region"with aroleand anindex. The regions are:payload.bin.chunks/<n>.json|bin, plusimages/<n>.<ext>for images stored in the BIN chunk through abufferView.levels/<n>.bin.levels/<n>.bin.dxgi_format(with a name for common values), dimension, array size and misc flags.expected_payload_bytesis derived for BC1–BC7, DXT1–DXT5, ATI1/ATI2 and common uncompressed formats.asset.version/generator, top-level collection counts andextensionsUsed. The JSON is strict UTF-8, duplicate members are last-wins, and only up to 16 MiB is parsed for counts.vkFormat, counts, the supercompression scheme and name, the DFD/KVD/SGD extents and the level index.Malformed and truncated stay distinct
extent_checkisconsistent,truncatedortrailing-bytes. A disagreement is a fact withunknowncoverage, not a refusal:payload_bytesnext toexpected_payload_bytes, which is the issue's success criterion.ParseFailurewith format and offset). Examples:#14239 note:
TargetFailurehas not landed, so the failures stay on the existingParseFailure/artifactParseFailurepath. #14239 migrates them.Tests
src/artifacts/gpuAsset/GpuAssetArtifactReader.test.ts(17 tests):tests/boundary/filesystem/binaryTarget.test.ts: all four resolve toarchivetargets under a.binname.tests/acceptance/gpuAssetHeadersCli.test.ts: compiled CLIinspect-artifactandextract-artifactfor each format, comparing extracted bytes withsource_location; a truncated DDS; a malformed GLB.tests/boundary/mcp/gpuAssetHeadersMcp.test.ts: for each format, an MCP summary and aninspect_analysis_viewpage of one region.Validation
npx vitest runover the gpu-asset, target, vocabulary, format-recognition, inventory and analysis-view tests: 119 files, 2427 passed.tsc: clean.oxfmt,oxlint(no errors) andarchitecture-guards.mjs: pass.Real public files (scratch directory, never executed)
All four report
extent_check: consistentandcompletecoverage through the source inventory:e124e8d8Models/Duck/glTF-Binary/Duck.glb65bf938f…4ae54ab5983695c1tests/resources/ktx/bc3_unorm_array_7.ktx94c364ad…b6cc57external/basis_universal/test_files/kodim23.ktx20eb567d4…8390a8d2d3e7cctests/patterns/test_data/dds.hexpat.ddseed49527…200968Remaining
expected_payload_bytes: null, with a limitation.compare-artifactsdoes not compare the root header facts yet. Like the other single-file formats, they are marked as covered by content comparison.