Skip to content

fix: correct ComponentTypeRef tag constant (0x03 not 0x04)#67

Merged
avrabe merged 1 commit into
mainfrom
fix/component-type-ref-tag
Mar 28, 2026
Merged

fix: correct ComponentTypeRef tag constant (0x03 not 0x04)#67
avrabe merged 1 commit into
mainfrom
fix/component-type-ref-tag

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Mar 28, 2026

Summary

Wrong binary format constant: count_type_imports_in_section used 0x04 (Component) instead of 0x03 (Type) for the ComponentTypeRef tag. This caused count_replayed_types to undercount when a component has Type imports, making resource operations point to wrong type indices.

Fixes the with fixture's invalid component error. A second bug (cross-memory string copy) remains.

Test plan

  • All 78 tests pass, no regressions
  • clippy clean

The count_type_imports_in_section function used 0x04 for the Type
tag in ComponentTypeRef, but the component model binary format spec
defines Type as externdesc 0x03 (0x04 is Component).

This caused count_replayed_types to undercount when a component has
Type imports (e.g., `use my:inline/foo.{msg}`), making the P2 wrapper
assign resource type operations to the wrong type index.

Fixes the `with` fixture's "type index N is not a resource type" error
(one of two bugs — the other is a cross-memory string copy issue).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 24547ed into main Mar 28, 2026
@avrabe avrabe deleted the fix/component-type-ref-tag branch March 28, 2026 06:33
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