Skip to content

fix: scope verify_config controller service verification to target PG#408

Merged
Chaffelson merged 1 commit into
mainfrom
fix/verify-config-ancestor-scoping
Apr 29, 2026
Merged

fix: scope verify_config controller service verification to target PG#408
Chaffelson merged 1 commit into
mainfrom
fix/verify-config-ancestor-scoping

Conversation

@Chaffelson
Copy link
Copy Markdown
Owner

Summary

ci.verify_config(process_group_id) was silently verifying controller services inherited from ancestor process groups (root and any intermediate PGs), not just those belonging to the target PG. This meant a misconfigured CS on root — or on a completely unrelated flow's parent — could cause CI to fail for an unrelated child flow.

Root cause: canvas.list_all_controllers calls FlowApi.get_controller_services_from_group without setting include_ancestor_groups. The NiFi REST API defaults this flag to true server-side, so inherited services are always returned unless explicitly opted out.

Processor scoping was already correct (ProcessGroupsApi.get_processors with include_descendant_groups=True — processors are owned by exactly one PG, no inheritance exists).

Changes

  • nipyapi/canvas.pylist_all_controllers: add include_ancestors: bool = True kwarg. Default True preserves existing behaviour (existing tests pass unchanged). Threads the flag into both NiFi version branches as include_ancestor_groups=include_ancestors.

  • nipyapi/ci/verify_config.py_verify_controllers: pass include_ancestors=False so CI only sees CSes owned by the target PG. Updated docstrings to state the scope contract explicitly.

  • docs/history.rst — "Unreleased" entry describing the fix.

Testing

  • New test test_list_all_controllers_excludes_ancestors in test_canvas.py: creates a three-level PG hierarchy, asserts include_ancestors=False returns only the targeted PG's CS; asserts default (True) still returns ancestor CSes (backwards-compat).

  • New test test_verify_config_ignores_ancestor_controllers in test_ci.py: creates parent + child PGs with a CS on each, calls verify_config(child.id), asserts only the child's CS appears in results.

  • All 8 targeted tests pass; 681 full-suite tests pass; pre-commit (black, isort, flake8, pylint 10.00/10) clean.

ci.verify_config was verifying controller services inherited from ancestor
process groups (root and any intermediate PGs) because NiFi's REST API
returns ancestor services by default (includeAncestorGroups=true server
default) and canvas.list_all_controllers never overrode this.

A broken CS on root or a sibling flow's ancestor could cause CI to fail
for an unrelated child flow.

Changes:
- canvas.list_all_controllers: add include_ancestors kwarg (default True
  preserves existing behaviour and test expectations)
- ci.verify_config._verify_controllers: pass include_ancestors=False so
  only CSes owned by the target PG are verified
- Add regression tests for both the helper and the CI function
- Update docs/history.rst
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.82%. Comparing base (7f85f00) to head (381b8a6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
nipyapi/canvas.py 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #408   +/-   ##
=======================================
  Coverage   76.81%   76.82%           
=======================================
  Files          41       41           
  Lines        4831     4832    +1     
=======================================
+ Hits         3711     3712    +1     
  Misses       1120     1120           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@ottobackwards ottobackwards left a comment

Choose a reason for hiding this comment

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

LGTM!

@Chaffelson Chaffelson merged commit 5cc5e94 into main Apr 29, 2026
12 checks passed
@Chaffelson Chaffelson deleted the fix/verify-config-ancestor-scoping branch April 29, 2026 16:20
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.

2 participants