Skip to content

Feature/native coverage Overall coverage across the current inventory: 71.1% (27432 covered lines / 38558 total lines).#1156

Merged
LahkLeKey merged 21 commits into
mainfrom
feature/native-coverage-100
Jun 21, 2026
Merged

Feature/native coverage Overall coverage across the current inventory: 71.1% (27432 covered lines / 38558 total lines).#1156
LahkLeKey merged 21 commits into
mainfrom
feature/native-coverage-100

Conversation

@LahkLeKey

@LahkLeKey LahkLeKey commented Jun 21, 2026

Copy link
Copy Markdown
Owner

This pull request introduces several improvements and fixes across the codebase, focusing on enhanced input validation, more robust fallback handling, improved code clarity, and better reporting in both C and Python scripts. The most significant changes include better handling of null or invalid inputs in core engine and tooling functions, improved coverage reporting for C/C++ header files, and new diagnostics and configuration options for the DX12 backend.

Engine and Tooling Robustness Improvements:

  • Added comprehensive null and invalid input checks, with fallback/default values, to functions in engine/runtime/terrain/terrain_height.c, engine/runtime/netcode/link/netcode_link.c, engine/tools/domain/banana_asset_cellular.c, and engine/tools/domain/banana_asset_wfc.c, improving stability and preventing crashes from bad inputs. [1] [2] [3] [4] [5] [6]
  • Refactored logic in engine/runtime/engine/support/engine_aux_launch_gate.c for clearer input validation and to use a switch statement, simplifying and making launch gate policy resolution more robust. [1] [2] [3]
  • Improved logic in engine/runtime/engine/gameplay/service/gameplay_service_sentience_decision.c for bonus calculation, making the code more explicit and robust against invalid states.

Coverage Reporting Enhancements:

  • Updated scripts/run-native-coverage.sh to detect and exclude declaration-only C/C++ headers from actionable coverage, improving the accuracy and clarity of the coverage report. Added clear reporting of declaration-only headers in the HTML summary. [1] [2] [3] [4]

DX12 Backend Diagnostics and Configuration:

  • Added support for a BANANA_DX12_FORCE_UNAVAILABLE environment variable to forcibly disable the DX12 backend, aiding in testing and diagnostics.
  • Improved diagnostics telemetry in engine/render/dx12/backend_dx12_diagnostics.c by providing a fallback snapshot and unavailable telemetry string when no snapshot is available, ensuring consistent and informative output.

Benchmark and Algorithm Adjustments:

  • Updated artifacts/native/k3h4-scaling-benchmark.json with new benchmark data for k3h4_ns and attention_ns values, reflecting recent performance measurements.
  • Refined biome transition logic in cellular automata to use a more concise and correct step calculation.

These changes collectively improve the reliability, maintainability, and observability of the codebase.

Copilot AI review requested due to automatic review settings June 21, 2026 05:00
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
banana Ready Ready Preview, Comment Jun 21, 2026 7:58pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR primarily increases native C test coverage across Banana’s runtime/engine subsystems (world, UI, input, tick phases, terrain, physics, render, netcode, orchestration, AI), with a handful of small native implementation tweaks to exercise guard/error paths and a coverage inventory script update.

Changes:

  • Add a broad set of native tests covering null guards, clamp behavior, adapter/ABI wrappers, and small deterministic helpers across runtime modules.
  • Adjust a few native runtime implementations (terrain height sampling, netcode link builder behavior, launch gate policy resolution, gameplay service loop exit, DX12 diagnostics/availability checks) to improve robustness/coverage.
  • Enhance scripts/run-native-coverage.sh inventory reporting to treat declaration-only headers specially and improve sorting/metadata in the HTML summary.

Reviewed changes

Copilot reviewed 118 out of 118 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/native/world/signals_test.c Adds coverage for signal queue lifecycle and flush guard paths.
tests/native/win32_dx12_poc/scene/demo_scene_catalog_test.c Adds coverage for demo scene catalog lookups, validation helpers, and gameplay helpers.
tests/native/win32_dx12_poc/scene_flow_test.c Adds coverage for scene-flow state machine transitions and input handling.
tests/native/win32_dx12_poc/continent_asset_registry_test.c Adds coverage for asset pack registry lookup and guard behavior.
tests/native/tools/infrastructure/banana_asset_json_writer_test.c Adds guard-path coverage for JSON writer functions on invalid paths.
tests/native/tools/domain/banana_asset_algorithms_test.c Adds tests for default algorithm contract metadata and callback wiring.
tests/native/runtime/world/world_metrics_test.c Adds tests for world metrics (active player count/entity state) with stubs.
tests/native/runtime/world/world_abi_test.c Adds tests for world ABI spawn/tick null guards and forwarding behavior.
tests/native/runtime/world/query/world_query_test.c Expands query coverage for invalid inputs and entity_count clamp/inactive behavior.
tests/native/runtime/ui/merchant/ui_merchant_impl_test.c Adds coverage for merchant UI stub behavior and null-ctx guard.
tests/native/runtime/ui/inventory/ui_inventory_impl_test.c Adds coverage for inventory UI stub behavior and null-ctx guard.
tests/native/runtime/ui/core/ui_test.c Expands UI core tests for invalid framebuffer sizes, text field guards, and cleanup paths.
tests/native/runtime/ui/core/ui_alloc_failure_test.c Adds allocator-failure coverage for UI context creation teardown paths.
tests/native/runtime/tick/tick_post_phase_test.c Adds coverage for post-phase callback invocation and null callbacks.
tests/native/runtime/tick/tick_phases_test.c Adds coverage for viewport resize guards/noops and terrain budget phase outcomes.
tests/native/runtime/terrain/terrain_chunks_test.c Adds coverage for terrain chunk hashing, partitioning, caching, stats, and cleanup.
tests/native/runtime/terrain/static_mesh/terrain_static_mesh_domain_test.c Adds coverage for static-mesh domain lookup and banana-line route helpers.
tests/native/runtime/runtime/input/contract/input_contract_test.c Adds coverage for NaN/INF rejects, truthy normalization, and sanitize guards.
tests/native/runtime/runtime/input/click/input_click_policy_test.c Expands click normalization coverage (null outputs, center mapping, invalid dims).
tests/native/runtime/render/material/render_material_test.c Adds coverage for entity/actor material selection branches.
tests/native/runtime/render/material/render_material_domain_test.c Adds coverage for material variant expectations using .color[] accessors.
tests/native/runtime/render/material/material_test.c Adds coverage for material defaults and shader stub uniform helpers.
tests/native/runtime/render/dx12/backend_dx12_projection_policy_test.c Adds coverage for DX12 projection behavior and clamping/degenerate vectors.
tests/native/runtime/render/dx12/backend_dx12_diagnostics_test.c Adds coverage for DX12 probe status defaults and telemetry formatting/fallbacks.
tests/native/runtime/render/camera/camera_test.c Adds coverage for degenerate look vectors and invalid aspect handling.
tests/native/runtime/player/sync/player_sync_abi_test.c Adds coverage for player sync ABI forwarding to registry stubs.
tests/native/runtime/player/runtime/player_motion_host_test.c Adds coverage for motion host null-world early return and binding-count clamping.
tests/native/runtime/player/resource/player_resources_test.c Adds coverage for resource init/cleanup, balance ops, snapshot/reset, and transfer.
tests/native/runtime/player/merchant/player_merchant_adapter_test.c Adds coverage for merchant adapter wrappers and forwarding to ABI stubs.
tests/native/runtime/player/gateway/player_gateway_abi_test.c Adds coverage for active guid selection and resource gateway struct wiring.
tests/native/runtime/physics/world/world_test.c Expands physics world tests to cover dynamics static-body guard and collision resolution.
tests/native/runtime/physics/world/world_collision_test.c Adds focused tests for collision pair filtering and resolve dispatch behavior.
tests/native/runtime/physics/raycast/raycast_test.c Adds coverage for raycast invalid inputs, shape filtering, and slab edge cases.
tests/native/runtime/physics/body/body_test.c Expands body tests to cover capsule init and static-body impulse guard.
tests/native/runtime/parallel/model/parallel_model_test.c Adds coverage for Amdahl helpers and clamping behavior.
tests/native/runtime/parallel/interlock/interlock_test.c Adds coverage for interlock lifecycle, contention hits, and null/uninitialized guards.
tests/native/runtime/parallel/contract/parallel_contract_test.c Adds coverage for parallel contract inventory table exposure and null count pointer.
tests/native/runtime/orchestration/tick/loop/terrain_tick_orchestration_test.c Adds coverage for orchestration adapter guard paths and callback wiring.
tests/native/runtime/netcode/netcode_vector_failure_path_test.c Adds coverage for vector build failure when k3h4 compute fails.
tests/native/runtime/netcode/netcode_k3h4_pipeline_equivalence_test.c Expands equivalence test for NULL-input no-mutation and dimension clamp case.
tests/native/runtime/netcode/netcode_k3h4_export_test.c Expands export test coverage for metadata preflight and filesystem failure paths.
tests/native/runtime/netcode/netcode_k3h4_export_io_failure_test.c Adds injected IO-failure coverage for export (fopen/fwrite/rename error mapping).
tests/native/runtime/merchant/trade/merchant_trade_abi_test.c Adds coverage for merchant trade ABI input validation and forwarding.
tests/native/runtime/merchant/service/merchant_service_test.c Adds coverage for merchant service price/trade paths with stubs and mapping.
tests/native/runtime/merchant/query/merchant_query_abi_test.c Adds coverage for merchant query ABI guard paths and callback error mapping.
tests/native/runtime/interaction/spawner/interactive_object_spawner_test.c Adds coverage for spawn rule validation and chunk spawn/despawn guards with stubs.
tests/native/runtime/interaction/collection/interactive_collection_test.c Adds coverage for collection register/collect cooldown/depletion/respawn behavior.
tests/native/runtime/input/move_target/move_target_service_test.c Expands move-target tests for guard/no-op behaviors and output expectations.
tests/native/runtime/input/binding/input_binding_test.c Adds coverage for input binding registration validation and dispatch guard paths.
tests/native/runtime/engine/tick/engine_tick_test.c Adds coverage for engine tick null-window error and dynamics guard paths.
tests/native/runtime/engine/state/engine_state_test.c Adds coverage for launch gate state mapping and runtime state reset behavior.
tests/native/runtime/engine/lifecycle/engine_lifecycle_spawn_math_test.c Adds coverage for spawn hashing/jitter and max-ground sampling behavior.
tests/native/runtime/engine/lifecycle/engine_lifecycle_launch_gate_decide_failure_test.c Adds coverage for launch gate preflight failure mapping when decide() errors.
tests/native/runtime/engine/lifecycle/engine_lifecycle_domain_test.c Adds coverage for lifecycle domain guard paths and controller/terrain chunk resets.
tests/native/runtime/engine/lifecycle/engine_lifecycle_actor_spawn_test.c Adds coverage for default actor spawn guards and expected archetype counts.
tests/native/runtime/engine/gameplay/service/gameplay_service_sentience_overrides_test.c Adds coverage for sentience override application and mode override precedence.
tests/native/runtime/engine/gameplay/service/gameplay_service_sentience_decision_test.c Adds coverage for sentience decision rules and comeback bonus clamping.
tests/native/runtime/engine/exports/engine_runtime_context_test.c Adds coverage for aux context exposure and backend fallback behavior via env var.
tests/native/runtime/engine/engine_test.c Adds coverage for engine init/tick/shutdown guard behavior and launch gate env inputs.
tests/native/runtime/engine/composition/engine_composition_shutdown_test.c Adds coverage for shutdown cleanup of controllers/merchants and backend fallback.
tests/native/runtime/engine/application/service/application_service_render_port_test.c Adds coverage for render port null/minimal-state behavior and reset.
tests/native/runtime/engine/application/service/application_service_ports_test.c Adds coverage for service-port table wiring and reset callability.
tests/native/runtime/controller/sync/controller_sync_test.c Adds coverage for controller position sync guards and parallel availability path.
tests/native/runtime/controller/kind/controller_kind_domain_test.c Adds coverage for controller kind parse/name guards and fallbacks.
tests/native/runtime/camera/follow/camera_follow_policy_test.c Adds coverage for camera follow pose guards and deterministic pose outputs.
tests/native/runtime/camera/basis/camera_basis_test.c Adds coverage for camera ground basis computation and input validation.
tests/native/runtime/ai/wildlife/wildlife_gameplay_test.c Adds coverage for wildlife “player nearby” signaling filters and guard paths.
tests/native/runtime/ai/state/state_machine_test.c Expands state machine tests for max state/transition limits and “none” state name.
tests/native/runtime/ai/perception/perception_test.c Expands perception tests for missing-world behavior and skipping inactive/excluded entities.
tests/native/runtime/ai/navigation/navigation_test.c Expands navigation tests for out-of-bounds block writes and partial-step/done behavior.
tests/native/runtime/ai/controller/controller_system_test.c Expands controller system tests for spawn guards, null destroy, and registry capacity tolerance.
tests/native/runtime/ai/controller/controller_system_lifecycle_alloc_failure_test.c Adds coverage for controller system allocation failure path.
tests/native/runtime/ai/controller/controller_system_dispatch_test.c Adds coverage for controller system dispatch guards and type-filter/broadcast behaviors.
tests/native/k3h4/k3h4_metrics_orchestration_layer_test.c Adds coverage asserting orchestration layer outputs match direct facade builders.
src/native/engine/tools/domain/banana_asset_cellular.c Refactors cellular automata application flow to better exercise allocation/no-op paths.
src/native/engine/runtime/terrain/terrain_height.c Reworks height sampling to clamp safely and tolerate missing grids via fallback cell.
src/native/engine/runtime/netcode/link/netcode_link.c Refactors link builder to use fallback inputs/outputs (but introduces output-mutation risk on invalid input).
src/native/engine/runtime/engine/support/engine_aux_launch_gate.c Tightens policy resolve guards and simplifies mode handling via switch.
src/native/engine/runtime/engine/gameplay/service/gameplay_service.c Adjusts pickup collection loop exit logic.
src/native/engine/runtime/engine/gameplay/service/gameplay_service_sentience_decision.c Refactors comeback bonus computation to centralize guards and clamping.
src/native/engine/render/dx12/backend_dx12_diagnostics.c Changes telemetry formatting to use fallback snapshot structure and preserve unavailable output.
src/native/engine/render/backend/backend_dx12.c Adds BANANA_DX12_FORCE_UNAVAILABLE env override to force headless availability result.
scripts/run-native-coverage.sh Updates coverage inventory logic (declaration-only headers, actionable denominator, HTML display/sorting).
artifacts/native/k3h4-scaling-benchmark.json Updates benchmark timing series values.

Comment thread src/native/engine/runtime/netcode/link/netcode_link.c Outdated
Comment thread scripts/run-native-coverage.sh
LahkLeKey and others added 2 commits June 21, 2026 14:02
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@LahkLeKey LahkLeKey merged commit 63e2f37 into main Jun 21, 2026
10 checks passed
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.

3 participants