fix(garm-configurator): log full config validation error, shorten blocked status - #268
Conversation
…cked status Invalid configuration put the entire (often multi-line) pydantic validation error into the unit status message. Juju truncates status messages to their first line, so operators only saw the generic header (e.g. "1 validation error for RunnerConfig") and nothing reached juju debug-log. Match the sibling charms (planner-operator, webhook-gateway-operator): log the full detail at warning level and set a short, stable "Invalid charm config" status. warning (not error) is used because _reconcile runs on every event, so a persistently misconfigured charm would otherwise spam error-level logs.
There was a problem hiding this comment.
Pull request overview
This PR improves the operator experience for the garm-configurator charm when charm config validation fails: instead of putting a multi-line Pydantic validation error into Juju status (which gets truncated), it logs the full detail at WARNING level and sets a short, stable Blocked status message.
Changes:
- Log full
CharmConfigInvalidErrordetails at WARNING level during_reconcile. - Collapse Blocked unit status to a stable
Invalid charm configmessage. - Update Scenario-based unit tests to assert both the short Blocked status and presence of validation detail in warning logs; add a changelog entry.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/changelog.md | Adds a 2026-07-08 entry describing the user-visible status/logging behavior change. |
| charms/garm-configurator/src/charm.py | Logs config validation details at WARNING and sets a short BlockedStatus message. |
| charms/garm-configurator/tests/unit/test_charm.py | Updates invalid-config tests to check for the stable status and warning log detail via caplog. |
yanksyoon
left a comment
There was a problem hiding this comment.
Maybe we can think about how to raise errors that puts charm in blocked status with actionable message. LGTM!
Drop the status genericization from the previous commit. Only 1 of the ~15 CharmConfigInvalidError sites produced the multi-line pydantic message that Juju truncates to an unhelpful first line; the other 14 were already short, actionable single lines that displayed fine in the status. Collapsing every status to "Invalid charm config" regressed those. Restore BlockedStatus(e.msg) and keep only the logging addition, so the status stays actionable and the full detail is still discoverable in debug-log. Making the one pydantic path emit a single-line message (so its status is actionable too) is left to a follow-up.
Thanks. I changed it back to put the full msg in the status. |
What this PR does
When config validation fails,
garm-configuratorput the entire pydanticValidationError(often multi-line) straight into the unit status message. Juju truncates status messages to their first line, so operators only ever saw the generic header (e.g.1 validation error for RunnerConfig) with no field/reason, and nothing reachedjuju debug-log.This aligns the charm with its siblings (
planner-operator,webhook-gateway-operator): the full detail is logged at warning level, and the status is a short, stableInvalid charm config.warning(noterror) is used because_reconcileruns on every event, so a persistently misconfigured charm would otherwise spam error-level logs.Why we need it
The truncated status was actively misleading — an operator hitting an invalid runner option had no way to see which option or why without dumping
juju status --format=yaml. The actionable detail now lives indebug-logwhere operators expect it.Checklist
CONTRIBUTING.mdhas been updated upon changes to the contribution/development process (e.g. changes to the way tests are run)docs/changelog.mdwith user-relevant changesterraform fmtpasses andtflintreports no errorsAGENTS.md.copilot-collections.yamlor.github/instructions/: I re-checked theAGENTS.md"12-factor divergences" guidanceTest plan
tox -c tox.toml -e fmt lint static unitall pass incharms/garm-configurator(unit: 51/51).Invalid charm configstatus and that the specific validation detail is emitted as a WARNING log record (viacaplog). No parallel tests were added — existing ones were extended.Review focus
CharmConfigInvalidErrorpaths (not justRunnerConfig) collapses to the single genericInvalid charm config. This is intentional, but reviewers may want to confirm that losing the per-cause status text (e.g.Missing required configuration: openstack-auth-url) is acceptable — that detail now lives only in the log. If a shorter cause-specific status is preferred, that's a larger change to howCharmConfigInvalidError.msgis structured.Potential breaking changes / new dependencies
None. No new dependencies, APIs, or config options. Behavioral change is limited to status text + log output.