Skip to content

Conversation

@Chaffelson
Copy link
Owner

nipyapi 1.4.0

Status: Ready for review

Summary

CLI exit code standardization, bulletins descendants filtering, batch parameter updates, and enhanced status reporting.

Breaking Changes

None - all changes are backward compatible.

CLI Improvements

Standardized error exit codes - CLI now exits with code 1 when result contains error or errors key:

# Script can now rely on exit codes for operational failures
if nipyapi ci verify_config --process_group_id "$PG_ID"; then
    nipyapi ci start_flow --process_group_id "$PG_ID"
else
    echo "Verification failed"
    exit 1
fi

Previously, operational failures (e.g., verification failed) returned exit 0 with failure info in JSON. Now they return exit 1.

Error field convention documented for CI function authors - include error key for failures.

New Features

Module Feature Description
bulletins get_bulletin_board(descendants=True) Include bulletins from child process groups
canvas list_all_controllers(greedy, identifier_type) Flexible PG resolution - accepts ID, name, or entity
ci get_status() throughput stats New fields: flowfiles_in/out, bytes_in/out/read/written
parameters list_orphaned_contexts() Find unbound parameter contexts
parameters rename_parameter_context() Rename a parameter context
layout PORT_QUEUE_BOX_WIDTH Constant for port-to-port queue boxes (240px)

Performance

Batch parameter updates - configure_inherited_params() now batches all parameters per context into a single API call, avoiding multiple stop/disable/update/enable/restart cycles.

Bug Fixes

  • Fixed parameter value removal to correctly handle value=None vs omitted value
  • Fixed bulletin board to include controller service bulletins via group_id regex pattern
  • CI cleanup() and verify_config() now use error key for failures (CLI exit code support)

Documentation

  • CLI error handling guide with exit code convention
  • CI error field convention for function authors
  • Parameter value semantics (None vs "" vs omitted)

Commits

25dfa24 docs: add 1.4.0 release notes to history
77d474e feat(cli): standardize error field convention for non-zero exit codes
4537ce5 docs(layout): add PORT_QUEUE_BOX_WIDTH constant
f7dacb3 perf(ci): batch parameter updates to reduce cycle overhead
f443cd4 feat(ci): enhance get_status with throughput stats and descendant bulletins
e78dc68 feat(canvas): add name lookup support to list_all_controllers
6c0fa61 feat(bulletins): add descendants parameter to get_bulletin_board
b08e32b fix(parameters): correct parameter value removal and add rename_parameter_context

Testing

All 682 tests pass against NiFi 2.7.2 single-user profile.

…eter_context

- Fix prepare_parameter to properly unset parameter values using value_removed flag
- Previously, passing None or omitting value could result in empty string or null
  instead of actually removing the parameter value
- Add _NOT_PROVIDED sentinel to distinguish omitted value from explicit None
- prepare_parameter now correctly handles: omit (preserve existing), None (remove),
  empty string (set to ""), or value (set)
- Add rename_parameter_context() for lightweight context renaming
- Use config.long_max_wait for update_parameter_context timeout
- Include description in get_parameter_ownership_map output
- Add comprehensive tests for new functionality
- Add descendants=True parameter to filter bulletins by process group hierarchy
- When True (default), includes bulletins from all child process groups
- When False, only returns bulletins from components directly in the specified PG
- Builds regex pattern of all PG IDs for efficient API filtering
- Add greedy and identifier_type parameters for flexible PG resolution
- Supports UUID, name, or ProcessGroupEntity as pg_id input
- Uses resolve_entity for consistent behavior with other canvas functions
…letins

- Add flowfiles_in/out, bytes_in/out, bytes_read/written stats
- Use descendants=True for bulletin collection to match processor/controller scope
- Update docstring to document bulletin counts
- Batch all parameters per context into single update_parameter_context call
- Avoids multiple stop/disable/update/enable/restart cycles per parameter
- Preserve parameter descriptions during updates
- Add tests for empty string and None value handling
- Document that port-to-port connections use larger queue boxes (240 vs 224)
- Clarify existing QUEUE_BOX_WIDTH is for processor-to-processor connections
- CLI now exits with code 1 when result dict contains 'error' or 'errors' key
- Update cleanup.py: change 'message' to 'error' for failure cases
- Update verify_config.py: add 'error' key with failed component names
- Add tests for error key detection and exit code behavior
- Document error field convention in cli.rst and ci.rst for CI authors

This enables scripts to rely on exit codes for operational failures,
not just Python exceptions. CI functions should include an 'error' key
when operations fail to trigger non-zero exit.
@Chaffelson Chaffelson self-assigned this Jan 15, 2026
@codecov
Copy link

codecov bot commented Jan 15, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.63%. Comparing base (944d82a) to head (25dfa24).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
nipyapi/ci/configure_inherited_params.py 77.77% 2 Missing ⚠️
nipyapi/canvas.py 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #402      +/-   ##
==========================================
+ Coverage   76.51%   76.63%   +0.11%     
==========================================
  Files          41       41              
  Lines        4739     4780      +41     
==========================================
+ Hits         3626     3663      +37     
- Misses       1113     1117       +4     

☔ 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
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.

This looks fine to me. My one set of feedback is that the field names of all these return values, and the parameter checks for specific values etc that are strings should be either constants or string enums ( if there is a specific valid set of values ).
This can be a follow on.

result["queued_flowfiles"] = str(agg.flow_files_queued or 0)
result["queued_bytes"] = str(agg.bytes_queued or 0)
result["active_threads"] = str(agg.active_thread_count or 0)
# Throughput stats (cumulative over stats retention period, typically 5 min)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of raw strings, all these standard result fields should be constants

@Chaffelson Chaffelson merged commit a8b7f19 into main Jan 16, 2026
12 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