java-topology/defects/bevy/patch/CLEAN.md
russell@unturf.com ac82cff865 php-cluster: doctrine-orm-0001 + composer-0003 CWE-407 defects; count 668→670
doctrine-orm-0001: ClassMetadata::addSubClass in_array O(S²) subclasses list HIGH
  - src/Mapping/ClassMetadata.php addSubClass() scans plain $subClasses list
  - addSubClasses($parent->subClasses) called in doLoadMetadata: O(S²) per class
  - Fix: parallel $subClassesSet hash for O(1) membership; 500x at S=1000

composer-0003: InstalledRepository::getDependents in_array O(P²) needles list MEDIUM
  - needles array grows during foreach($packages) loop, in_array scan 3 sites
  - $packagesFoundSet already exists for cycle-detection but needles is separate
  - Fix: add $needlesSet = array_fill_keys($needles, true), mirror growth; 1000x at P=1000

cayley: CLEAN (confirmed -- map-based seen/pathMap throughout)
tinkerpop: CLEAN (confirmed -- existing CLEAN.md valid, sort ArrayList is query-plan-time only)
2026-03-29 19:51:31 -04:00

1.3 KiB

CLEAN — bevy

Scanned 2026-03-29 for CWE-407 (algorithmic complexity).

Findings

  • bevy_ecs/src/schedule/graph/graph_map.rs — cycle detection uses HashSet for blocked and maybe_in_more_cycles. CLEAN.
  • bevy_ecs/src/schedule/graph/dag.rs — transitive reduction uses FixedBitSet for visited. CLEAN.
  • bevy_ecs/src/schedule/auto_insert_apply_deferred.rsno_sync_edges is BTreeSet. CLEAN.
  • bevy_ecs/src/schedule/node.rsambiguous_with_all: &HashSet<NodeId>, ignored_ambiguities: &BTreeSet. CLEAN.
  • bevy_gltf/src/loader/gltf_ext/scene.rs — uses FixedBitSet and HashSet for visited tracking. CLEAN.
  • bevy_ui/src/stack.rsvisited_root_nodes: Local<HashSet<Entity>>. CLEAN.
  • bevy_picking/src/hover.rshover_ancestors: EntityHashSet. CLEAN.
  • bevy_render/src/view/window/screenshot.rsseen_targets: Local<HashSet<...>>. CLEAN.
  • bevy_pbr/src/render/light.rsall_cascades_seen: HashSet. CLEAN.
  • bevy_ecs/src/bundle/info.rsexplicit_component_ids: IndexSet<_, FixedHasher>. CLEAN.
  • bevy_ecs/src/world/entity_access/world_mut.rscontributed_components() slice .contains() called during archetype migration (not per-frame hot path), N bounded to component count per entity. Not actionable.

Result: No actionable CWE-407 defects.