Skip to content

feat(kaitai): Phase 0 — fix compile blockers and wire runtime#39

Merged
Perseus merged 1 commit intofeat/kaitai-rust-scaffoldfrom
feat/kaitai-lmo-adapter-phase-a
Mar 2, 2026
Merged

feat(kaitai): Phase 0 — fix compile blockers and wire runtime#39
Perseus merged 1 commit intofeat/kaitai-rust-scaffoldfrom
feat/kaitai-lmo-adapter-phase-a

Conversation

@Perseus
Copy link
Owner

@Perseus Perseus commented Mar 2, 2026

Summary

  • Fix Rust keyword conflicts in .ksy (typeobj_type, boxbbox)
  • Wire kaitai-io/kaitai_struct_rust_runtime git dependency (official runtime)
  • Regenerate pko_lmo.rs and fix 4 categories of generated code bugs
  • cargo check passes cleanly

Linear

Resolves PKO-137

Test plan

  • cargo check passes
  • All 375 existing tests pass

🤖 Generated with Claude Code

Phase 0 of Kaitai LMO Adapter (PKO-137):
- Rename Rust keyword conflicts in pko_lmo.ksy: type→obj_type, box→bbox/aabb
- Regenerate pko_lmo.rs from fixed .ksy (6,187 lines)
- Fix generated code: *_io.size() deref, i32/u32 type mismatches, u32::MAX literal
- Add kaitai runtime as git dep (kaitai-io/kaitai_struct_rust_runtime@9959613)
- Wire kaitai_gen module into lib.rs via #[path]
- All 375 tests pass, cargo check/clippy clean

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@greptile-apps
Copy link

greptile-apps bot commented Mar 2, 2026

Greptile Summary

This PR successfully resolves Rust keyword conflicts in the Kaitai Struct schema and wires the official runtime, making cargo check pass cleanly. The .ksy schema renames typeobj_type and boxaabb/bbox to avoid reserved keywords. After regeneration, the 6,187-line pko_lmo.rs parser required manual fixes in four categories: unnecessary pointer derefs on _io.size(), i32/u32 type mismatches (now using 4294967295u32 literals), and struct/field renames to match the updated schema. The kaitai runtime v0.11.0 is pinned at commit 9959613 from the official repository. All 375 existing tests pass according to the commit message.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • All changes are well-structured and necessary: schema keyword renames prevent compilation errors, generated code fixes are correct and localized, runtime integration uses official dependency. The commit message confirms all 375 tests pass and cargo check/clippy are clean.
  • No files require special attention

Important Files Changed

Filename Overview
formats/pko_lmo.ksy Renamed Rust keyword conflicts: typeobj_type, boxaabb/bbox throughout schema
src-tauri/Cargo.toml Added kaitai runtime git dependency at rev 9959613
src-tauri/src/lib.rs Wired kaitai_gen module with comprehensive lint suppressions for generated code
src-tauri/gen/kaitai/pko_lmo.rs Regenerated parser with fixes: removed unnecessary derefs, fixed u32/i32 mismatches, renamed types/fields

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[formats/pko_lmo.ksy<br/>Schema Definition] -->|kaitai-struct-compiler| B[gen/kaitai/pko_lmo.rs<br/>Generated Parser]
    B -->|Manual Fixes| C[Fixed Generated Code<br/>- Remove *_io.size dereferences<br/>- Fix u32/i32 comparisons<br/>- Rename type→obj_type<br/>- Rename box→bbox/aabb]
    D[Cargo.toml] -->|Add Dependency| E[kaitai runtime v0.11.0<br/>@9959613]
    C --> F[lib.rs]
    E --> F
    F -->|Module Declaration| G[kaitai_gen::pko_lmo<br/>With Lint Suppressions]
    G --> H[cargo check ✓<br/>cargo clippy ✓<br/>375 tests pass ✓]
Loading

Last reviewed commit: bed3fef

@Perseus Perseus merged commit 1398f98 into feat/kaitai-rust-scaffold Mar 2, 2026
1 check passed
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