Skip to content

query: use actual table id for IsA matches in fixed traversal#2035

Open
60k41p wants to merge 4 commits intoSanderMertens:masterfrom
VerdantInteractive:fix-is-a-eval-upstream
Open

query: use actual table id for IsA matches in fixed traversal#2035
60k41p wants to merge 4 commits intoSanderMertens:masterfrom
VerdantInteractive:fix-is-a-eval-upstream

Conversation

@60k41p
Copy link
Copy Markdown
Contributor

@60k41p 60k41p commented Mar 25, 2026

Updates flecs_query_trav_fixed_src_up_fixed_second to use the actual component ID stored in the table's type array when a match is found for an EcsIsA relationship, rather than reconstructing the pair from arguments.

Bug repro

Changes:

  • Capture the column index returned by ecs_search_relation.
  • Add a check for index != -1 to ensure the relationship was found in the table (Self) before accessing the type array.
  • When trav == EcsIsA, set the matched ID to table->type.array[column].
  • Manually populate the iterator fields and variables with the resolved matched ID.

This ensures that the query iterator reports the exact component ID present in the archetype when matching IsA relationships.

Also, this PR updates the link to the Stagehand repository (which got renamed from VoxInteractive/Godot-Flecs).

60k41p added 3 commits March 25, 2026 16:03
Updates `flecs_query_trav_fixed_src_up_fixed_second` to use the actual component ID stored in the table's type array when a match is found for an `EcsIsA` relationship, rather than reconstructing the pair from arguments.

Changes:
- Capture the column index returned by `ecs_search_relation`.
- Add a check for `column != -1` to ensure the relationship was found in the table (Self) before accessing the type array.
- When `trav == EcsIsA`, set the matched ID to `table->type.array[column]`.
- Manually populate the iterator fields and variables with the resolved `matched` ID.

This ensures that the query iterator reports the exact component ID present in the archetype when matching `IsA` relationships.
@SanderMertens
Copy link
Copy Markdown
Owner

Can you add a test case that reproduces the failure that this fixes?

@60k41p
Copy link
Copy Markdown
Contributor Author

60k41p commented Mar 31, 2026

Can you add a test case that reproduces the failure that this fixes?

Test added.

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.

2 participants