Skip to content

feat: bounded reverse-dep mode, inspect changed/graph, top-level doctor - #23

Merged
HansRobo merged 1 commit into
mainfrom
feat/r8-rdeps-depth-inspect-doctor
Jun 3, 2026
Merged

HansRobo merged 1 commit into
mainfrom
feat/r8-rdeps-depth-inspect-doctor

Conversation

@HansRobo

@HansRobo HansRobo commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary

Implements R8 of the release roadmap (target tag v6.5.0, minor). All additions are non-breaking and default behaviour is unchanged.

  • cwm ws build --rdeps-depth N — bound the reverse-dependency (ABI affected) rebuild to N levels (1 = direct consumers only), a middle ground between the full transitive walk (default) and --no-rdeps (skip entirely). The two flags are mutually exclusive. Implemented as a level-by-level BFS in DependencyGraphAnalyzer.get_reverse_deps(max_depth=...), threaded through compute_changeset and run_workspace_colcon (ws test is unaffected, defaulting to None).
  • cwm inspect changed [-w BRANCH] [--json] — preview changed packages and their reverse-dep rebuild set without building, reusing the same compute_changeset pipeline as ws build so the preview never diverges from the real build scope.
  • cwm inspect graph [-w BRANCH] [--json] — scan-only dump of the package dependency DAG (build/build_export edges) via a new public forward_edges() accessor (copy-returning to protect the internal map).
  • cwm doctor [--json] — cross-cutting health check aggregating base + worktree state (reusing status_cmd helpers) plus a stale base build-dir count; deep stale-CMakeCache diagnosis and repair are delegated to cwm base doctor --fix (no duplicate implementation).

Reuse / design notes

  • Worktree resolution (resolve_worktree), change detection (compute_changeset), and worktree-status collection (_collect_base / _collect_worktrees / _print_base_status) are reused rather than reimplemented.
  • get_reverse_deps keeps full backward compatibility: max_depth=None is the original transitive closure.

Tests

  • test_dependency_graph.py: depth-bounded BFS (chain_ws fixture) + forward_edges immutability; verifies the default matches the full closure.
  • New test_inspect_changed_cmd.py, test_inspect_graph_cmd.py, test_doctor_cmd.py.
  • test_cli_structure.py: updated command ordering + top-level doctor registration.
  • Full suite: 244 passed, ruff check clean.

Verification (manual, minimal ROS WS)

  • cwm inspect changed -w <branch> --json matches ws build --dry-run.
  • cwm ws build --rdeps-depth 1 rebuilds only direct consumers; --rdeps-depth 1 --no-rdeps errors (UsageError).
  • cwm inspect graph -w <branch> prints the DAG adjacency.
  • cwm doctor aggregates base + all worktrees, reports stale count pointing at base doctor, and flags missing worktrees.

…vel doctor

Adds three non-breaking capabilities (all default behaviour unchanged):

- `ws build --rdeps-depth N`: bound the reverse-dependency (ABI affected)
  rebuild to N levels as a middle ground between the full transitive walk
  (default) and `--no-rdeps`. Implemented as a level-by-level BFS in
  `get_reverse_deps(max_depth=...)`, threaded through `compute_changeset` and
  `run_workspace_colcon`. Mutually exclusive with `--no-rdeps`.
- `inspect changed`: preview changed packages and their rebuild set without
  building, reusing the same `compute_changeset` pipeline as `ws build`.
- `inspect graph`: scan-only dump of the package dependency DAG via a new
  public `forward_edges()` accessor.
- top-level `doctor`: cross-cutting health check aggregating base/worktree
  state (reusing status helpers) plus a stale base build-dir count, delegating
  deep stale-CMakeCache diagnosis/repair to `base doctor`.

Registers the new subcommands and updates README accordingly.
@HansRobo HansRobo added the release:minor Bump minor version on merge label Jun 3, 2026
@HansRobo
HansRobo merged commit 0655d36 into main Jun 3, 2026
11 of 12 checks passed
@HansRobo
HansRobo deleted the feat/r8-rdeps-depth-inspect-doctor branch June 3, 2026 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:minor Bump minor version on merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant