Skip to content

[Tracking] Testability refactoring + unit-test coverage + performance + autoware_utils consolidation across Core packages #1096

@youtalk

Description

@youtalk

Checklist

  • I've read the contribution guidelines.
  • I've searched other issues and no duplicate issues were found.
  • I've agreed with the maintainers that I can plan this task.

Description

This is an umbrella / tracking issue for an ongoing campaign to raise the engineering quality of autoware_core packages along four axes, one ROS package per pull request:

  1. Testability refactoring — extract pure, ROS-free logic out of node methods / anonymous namespaces behind additive dependency-injection and logging seams, so core algorithms can be unit-tested without spinning up a ROS graph.
  2. Unit-test coverage — add fast, deterministic unit tests (known-answer cases, edge/error branches, previously-untested helpers) and re-enable orphaned tests.
  3. Performance — apply benchmark-proven, output-identical memory/compute optimizations (e.g. reserve, sliding-window, binary search, allocation removal).
  4. De-duplication into autoware_utils — consolidate near-duplicate utility code into the canonical autoware_utils modules (moderate scope) to keep the Core codebase clean.

A hard constraint throughout: the public API/ABI stays additive-only (new ctors/overloads/free functions; [[deprecated]] shims for anything replaced; no struct-layout or extern template signature changes).

Purpose

  • Make Core's foundational algorithm packages unit-testable in isolation, replacing slow/flaky integration-only coverage with fast deterministic tests.
  • Increase test coverage measurably, package by package, under the existing Codecov gate.
  • Deliver measured performance improvements (every perf change ships with a micro-benchmark and an output-equivalence guard — no regressions).
  • Reduce duplicated utility code by consolidating it into autoware_utils, improving maintainability across the stack.
  • Do all of the above without breaking downstream consumers (additive-only API/ABI, validated with --packages-above).

Possible approaches

Every package follows the same repeatable 6-stage playbook, shipped as a single per-package PR (plus a prerequisite PR on autoware_utils when a symbol is promoted there):

  1. Characterize — capture the current green baseline (colcon test + downstream build with --packages-above); add characterization tests pinning current behavior of the code about to move.
  2. Seam (additive testability refactor) — add a DI ctor/overload taking the plain param struct (or injected clock/logger); keep the existing Node& ctor as a thin forwarding shim. Extract pure logic into named, header-declared free functions.
  3. Cover — add deterministic unit tests for the newly-exposed logic; re-enable orphaned tests; verify the lcov delta locally.
  4. Optimize — only benchmarkable, output-identical changes, each with a committed micro-benchmark (before/after numbers) and an equivalence guard test.
  5. Dedup (moderate) — replace near-duplicates of existing autoware_utils symbols; promote genuinely-shared helpers into the right autoware_utils module via a separate PR; never push lanelet/PCL/msg-specific types into generic utils.
  6. Verify & PR — full package test + --packages-above on the {humble, jazzy} containers; clang-tidy / cppcheck / pre-commit clean; open the per-package PR.

Execution is orchestrated so packages can progress in parallel, with each package validated by a dual-source build of autoware_core + autoware_utils together before submission.

Definition of done

Per-package PR (the bar every PR clears):

  • Public API unchanged (additive-only); ABI-safe; deprecation shims for replacements.
  • Measurable unit-test coverage increase (Codecov green; net-positive lcov delta).
  • Every performance change backed by a committed micro-benchmark (before/after) + an output-equivalence guard test (no regression).
  • Green CI across {humble, jazzy} × {agnocast, above}; lint clean.
  • Behavior-preserving: characterization + pre-existing tests still pass.
  • Any autoware_utils symbol move landed as a merged autoware_utils PR the Core PR depends on.

Campaign: every package below reaches the per-package DoD.

Scope & progress (per-package PRs)

All in-scope packages now have an open per-package PR (52 total). Each box is checked when its PR merges. Every PR clears the per-package DoD above and was verified green on the fork's build-and-test CI before submission.

api/

common/

control/

localization/

map/

perception/

planning/

sensing/

testing/

Related issues

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions