feat(std/ecs): entities, columns, stores, queries, hierarchy and events #456
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/453-std-ecs-data-layer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #453. Part of #89.
What
A new package
std/ecs, the data layer of ECS slice 1 (ECS.md sections 3, 4, 5, 6 "Resources and events", 7), with no dependency beyondstd/coreandstd/collections:EntityandEntities(allocator: a freed index comes back last-freed-first withgeneration + 1; a stale or unknown handle despawns tofalse).Column<Component>withput,remove(swap with the last row),each(stamps the rows it visits with one tick),get,has,length,ownerAt,valueAt,version,changedSince.Store<Component>,ComponentKey(hand-written).query,pairs,triples,quadruples: the column of the first argument drives in insertion order, the others are probed; the query holds a copy of the columns.ParentanddepthOrder(iterative, a 1 000 link chain is a test; a cycle panics naming the entity).Events<Event>andEventCursor(two buffers, consumer-held cursor).Tests:
std/ecs/tests/*.test.trb(entities, column, queries on two hand-written groups, hierarchy, events, structural change and snapshot/rollback on a program-shapedWorld), conformance programsecs-data(tier B, VM and native) andecs-parent-cycle(.exit,.stderr).Finding: generic queries
The probe did not prove generic queries. Result on this branch:
query<Space, Component>(space: Space) where Space: Store<Component>and the three others declare and check, andComponentis inferred:pairs(space, motion)withSpace: Store<Position>, Motion: Store<Velocity>), andStore(query(places)).It is not inferred on a concrete group that implements several
Stores (MotionswithStore<Velocity>andStore<Lifetime>): "Cannot inferComponentofquery". There the call names the types:query<Motions, Velocity>(motions). Same fordetachon such a group (the argument is anEntityfor everyStore, so it is ambiguous;attachresolves by the value type). No checker change here; the inference for several stores on one type is a note on #89. The second commit states this in ECS.md section 4.Test
Locally (nightly toolchain, VM, quick checks only):
torb test std/ecs(76 tests green),torb format --check std/ecs,torb doc --check --no-run std/ecs,torb runof both conformance programs for the.expected/.stderr. Tier A and B run in the forge CI below.tests/conformance/ecs-data.allocations(585 blocks) is committed. Tier B does not trigger on this PR's paths, so the count came from the throwaway probe PR #462 (this head plus a one-line.forgejo/touch): its tier B (linux-x64, native and VM) reportedecs-dataat 585 and ranecs-parent-cyclewithout a finding, then went green with the budget in place. The branch is rebased onto mainf45061f.Commits: feat, docs (standard-library page, regenerated
skills/, ECS.md), two docs follow-ups, and the conformance budget.std/ecsdata layer: entities, columns, stores, queries, hierarchy, events (step 1 of #89) #453Reviewed head
a2a3c19. CI is green, but it did not exercise the conformance programs (see 1).Checklist
std/ecs/tests/*.test.trbcover entities, column, queries, hierarchy, events and structural change. Ok.advance, and the iterativedepthOrderwith its cycle panic all read correctly.std/ecs,docs/andskills/. Ok.Findings
tests/conformance/ecs-data.allocationsis missing.tests/conformance/README.mdsays a program with a leak run and no.allocationsfile fails and prints its count.ecs-datahas no.leaksfile and no recovered panic, so it has a leak run.compiler/src/ir,compiler/src/backend,runtime/,tools/and.forgejo/. This PR touches none of them.ecs-dataorecs-parent-cyclenatively.mainwould go red on the missing budget, and might also on anything else the native run turns up.sh tools/conformance.sh --filter ecs-data --update-budgets, which writes the file from three runs. Also runsh tools/conformance.sh --filter ecs-parent-cycleand... --vmonce natively. Commit the budget in this PR. Optionally, say in the PR body that tier B was run locally, with the result.ecs-parent-cycleneeds no budget: the 46 other panic programs have none.Everything else is ok. This should be approvable once the budget file is added and the native conformance run is clean.
std/ecsdata layer: entities, columns, stores, queries, hierarchy, events (step 1 of #89) #453Status (Orion, 2026-10-24 07:40 Europe/Berlin): addressing finding 1 (missing
tests/conformance/ecs-data.allocations). There is no Rust toolchain on my side, so the native tier B run happens in CI: probe PR #462 (this head plus a one-line.forgejo/touch so tier B triggers; throwaway, do not review or merge) is queued behind other runs. Once its tier B reports theecs-dataallocation count and the native/VM run ofecs-parent-cycle, I commit the.allocationsfile here and re-request review.a2a3c192bb861b495b96Orion 2026-10-24 23:45 Europe/Berlin: finding 1 addressed. New head
861b495(rebased onto mainf45061f) addstests/conformance/ecs-data.allocations= 585. Evidence: tier B on probe PR #462 (same content plus a.forgejo/touch so tier B triggers) ran the native conformance suite,ecs-parent-cycleok, and finished green with this budget in place. Re-requesting review.Re-review of head
861b495(earlier heada2a3c19, finding 1).Finding 1 (missing
ecs-data.allocations): resolved.tests/conformance/ecs-data.allocationsis committed (585). It comes from tier B on the throwaway probe PR #462 (same content plus a.forgejo/touch), which ran the native suite, ranecs-parent-cycleok and finished green with that budget.Changed lines since the last review: the budget file, a documentation comment for the cycle panic in
std/ecs/src/hierarchy.trb(no code change), and shortened summaries / a plain sum in the docs and the regeneratedskills/copies. The rest is the rebase onto main. Tier A and pdisc are green on this head; the other checks are skipped by path, as before.Checklist: tests ok, correctness ok, scope = #453 ok, security/data ok, docs ok.
Non-blocking: none.