Skip to content

Add description field to healthcheck results - #377

Open
rjeffman wants to merge 2 commits into
freeipa:masterfrom
rjeffman:source_description
Open

Add description field to healthcheck results#377
rjeffman wants to merge 2 commits into
freeipa:masterfrom
rjeffman:source_description

Conversation

@rjeffman

@rjeffman rjeffman commented Apr 1, 2026

Copy link
Copy Markdown
Member

Add a description class attribute to Plugin that flows through to Result and appears in JSON output when set. This makes healthcheck results self-documenting by including human-readable descriptions of what each check does.

The description field is optional and only included in JSON output when not None, maintaining backward compatibility with existing consumers.

Added descriptions to 54 checks documented in README.md across dogtag, ipa, meta, and system modules. Checks without descriptions in the README inherit None and omit the field from output.

Assisted-by: Claude Sonnet 4.5 noreply@anthropic.com

Summary by Sourcery

Add an optional human-readable description field to health check results and populate it across key plugins for more self-describing output.

New Features:

  • Expose an optional description attribute on plugins that propagates into Result objects and JSON output when set.

Enhancements:

  • Populate description text for numerous IPA, Dogtag, meta, and system health checks to document what each check validates in the JSON output.

Tests:

  • Add tests covering Result description behavior, JSON serialization/deserialization with and without descriptions, and backward compatibility when the field is absent.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • In Result.__init__, an explicit description argument is only used when source/check are provided, and is ignored when a plugin is passed; consider either allowing the explicit value to override plugin.description or clearly documenting this behavior to avoid surprising callers.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In `Result.__init__`, an explicit `description` argument is only used when `source`/`check` are provided, and is ignored when a `plugin` is passed; consider either allowing the explicit value to override `plugin.description` or clearly documenting this behavior to avoid surprising callers.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@rjeffman
rjeffman marked this pull request as draft April 1, 2026 14:06
rjeffman added 2 commits April 1, 2026 11:11
Add a description class attribute to Plugin that flows through to
Result and appears in JSON output when set. This makes healthcheck
results self-documenting by including human-readable descriptions
of what each check does.

The description field is optional and only included in JSON output
when not None, maintaining backward compatibility with existing
consumers.

Added descriptions to 54 checks documented in README.md across
dogtag, ipa, meta, and system modules. Checks without descriptions
in the README inherit None and omit the field from output.

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
Add comprehensive tests covering all description field use cases:
- Result with plugin that has description set
- Result with plugin without description (backward compatibility)
- Result with explicit description parameter
- json_to_results() with description in input data
- json_to_results() without description (backward compatibility)

Assisted-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
@rjeffman
rjeffman force-pushed the source_description branch from 2c6c270 to 597fde4 Compare April 1, 2026 14:12
@rjeffman
rjeffman marked this pull request as ready for review April 1, 2026 14:14

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • For the service checks in meta/services.py, all the description values follow the same pattern ("Checks if the X service is running"); consider deriving the description from service_name in a shared base/helper to avoid repetition and reduce the chance of these drifting out of sync.
  • In Results.output(), the description field is only omitted when it is None; if empty strings or whitespace-only descriptions should also be treated as "unset" for output/backward-compatibility, consider normalizing or adjusting the condition to check for truthiness instead.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- For the service checks in `meta/services.py`, all the `description` values follow the same pattern ("Checks if the X service is running"); consider deriving the description from `service_name` in a shared base/helper to avoid repetition and reduce the chance of these drifting out of sync.
- In `Results.output()`, the description field is only omitted when it is `None`; if empty strings or whitespace-only descriptions should also be treated as "unset" for output/backward-compatibility, consider normalizing or adjusting the condition to check for truthiness instead.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

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.

1 participant