Skip to content

fix: treat removed/recycled entities as non-existent and fix Count()#29

Merged
ragoune merged 2 commits into
masterfrom
fix/entity-liveness-and-count
Jun 28, 2026
Merged

fix: treat removed/recycled entities as non-existent and fix Count()#29
ragoune merged 2 commits into
masterfrom
fix/entity-liveness-and-count

Conversation

@ragoune

@ragoune ragoune commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Removed entities kept their stale record, so Has/Get on a removed id returned stale data.
RemoveEntity now tombstones the slot (key = -1) and a new public Exists() guards every Has/Get/Add/Remove path; a dead entity is reported as non-existent and double-remove is a safe no-op.
The non-generic RemoveComponent and GetComponent (and the generic GetComponent) gain the bounds guard they were missing.

CreateWorld now allocates entities with capacity but zero length, so Count() returns 0 for a fresh world instead of the preallocated capacity.

ragoune and others added 2 commits June 28, 2026 12:15
Removed entities kept their stale record, so Has/Get on a removed id returned
  stale data.
RemoveEntity now tombstones the slot (key = -1) and a new public
  Exists() guards every Has/Get/Add/Remove path; a dead entity is reported as
  non-existent and double-remove is a safe no-op.
The non-generic RemoveComponent
  and GetComponent (and the generic GetComponent) gain the bounds guard they were
  missing.

CreateWorld now allocates entities with capacity but zero length, so Count() returns 0 for a fresh world instead of the preallocated capacity.
@codecov

codecov Bot commented Jun 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 18 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
component.go 25.00% 5 Missing and 10 partials ⚠️
tag.go 25.00% 1 Missing and 2 partials ⚠️
Files with missing lines Coverage Δ
world.go 78.81% <100.00%> (+0.93%) ⬆️
tag.go 88.23% <25.00%> (-5.52%) ⬇️
component.go 66.05% <25.00%> (+0.62%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ragoune ragoune merged commit 291ca8d into master Jun 28, 2026
3 of 4 checks passed
@ragoune ragoune deleted the fix/entity-liveness-and-count branch June 28, 2026 10:24
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