fix: emit one log line per user check log entry#9317
Merged
ogenstad merged 1 commit intoMay 21, 2026
Conversation
The run_user_check flow iterated over check_run.log_entries, which is a single formatted string rather than the structured list of log records. Iterating a string in Python yields one character at a time, so the Prefect flow logger received one warning event per character instead of one per log entry. The loop now iterates check_run.logs and renders each entry as a single line via a new format_check_log_entry helper. Fixes opsmill#8224
Contributor
Author
|
Thx! Glad to contribute |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_user_checkiterated overcheck_run.log_entries, which is a single formatted string rather than the structured list of log records. Iterating a string in Python yields one character at a time, so the Prefect flow logger received one warning event per character instead of one per log entry.check_run.logs(the structuredlist[dict[str, Any]]) and renders each entry as a single line via a newformat_check_log_entryhelper. The string assignment tocheck.message.value(stored in Neo4j and shown in the check message panel) is unchanged.Scope
Backend only. The SDK property
log_entriesis left intact: even with its current naming, the calling code is wrong to iterate it as a list. Any SDK clarification (return type annotation, naming) is orthogonal and can be addressed separately if desired.Test plan
backend/tests/unit/git/test_tasks.pycovering the formatter on five shapes of log entries, including a regression assertion that no\nis produced per record.uv run pytest backend/tests/unit/git/runs 13/13 green locally.uv run invoke formatanduv run invoke lint(ruff, ty, mypy) all pass.stableconfirmed the bug end to end (a custom check repo plus a proposed change produced oneprefect.flow_runs warningper character indocker logs infrahub-task-worker-1).Summary by cubic
Fixes user-check logs emitting one character per line; each check log record now logs as a single warning line. Fixes #8224.
check_run.logs(structured list) instead ofcheck_run.log_entries(string) and useformat_check_log_entryto render one line per entry.Written for commit f8570d3. Summary will update on new commits. Review in cubic