Skip to content

chore: fix logging and std out printing - #2798

Open
Tofel wants to merge 2 commits into
dx-5122-alerts-assertion-p13from
dx-5122-alerts-assertion-p14
Open

chore: fix logging and std out printing#2798
Tofel wants to merge 2 commits into
dx-5122-alerts-assertion-p13from
dx-5122-alerts-assertion-p14

Conversation

@Tofel

@Tofel Tofel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Improves human-facing output for check/watch:

  • New style.go noteStyler colourises notes by prefix and inserts section breaks — colour only when the destination is a TTY and NO_COLOR is unset.
  • table.go output is restructured into titled sections (RESULTS / VIOLATIONS / THRESHOLDS) with a coloured violations footer.
  • The from < StartedAt bound is now compared at whole-second granularity (in coverage.go and the check.go fail-fast), so a --from in the same second as the recording's start is not judged early.
  • StartupSummary is reformatted onto multiple lines.

Review focus: style.go (colour/NO_COLOR) and the whole-second truncation in coverage.go/check.go.

@Tofel
Tofel requested a review from a team as a code owner September 3, 2026 11:27
@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

📊 API Diff Results

No changes detected for module github.com/smartcontractkit/chainlink-testing-framework/grafana-alertcheck

View full report

Copilot AI lite review requested due to automatic review settings September 4, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new noteStyler.Write can drop buffered output on write errors due to advancing the pending buffer before confirming writes succeed.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR refines the CLI’s human-facing output (notes + tables) while tightening time-bound handling around recorder start times, aiming to make logs more readable and reduce false “from before recording started” failures caused by sub-second header timestamps.

Changes:

  • Compare from vs StartedAt at whole-second granularity (and update error formatting to RFC3339Nano) with added unit tests for boundary cases.
  • Improve operator-facing output formatting: multi-line startup summary, earlier min-observed note, titled tables, and a structured THRESHOLDS section.
  • Add a CLI-only notes/table styling layer (ANSI color when writing to a terminal; plain text otherwise) and route Notes through it in check and watch.
File summaries
File Description
grafana-alertcheck/internal/gate/schedule.go Makes startup summary/warning multi-line and more readable.
grafana-alertcheck/internal/gate/coverage.go Applies whole-second comparison for from bounds; uses RFC3339Nano in message.
grafana-alertcheck/internal/gate/coverage_test.go Adds tests covering same-second and boundary-crossing cases for from bounds.
grafana-alertcheck/internal/gate/check.go Uses whole-second comparison for recorder-mode fail-fast; prints min-observed earlier.
grafana-alertcheck/internal/gate/check_test.go Adds recorder-mode test ensuring same-second from passes.
grafana-alertcheck/cmd/grafana-alertcheck/watch.go Routes gate notes through the new note styler.
grafana-alertcheck/cmd/grafana-alertcheck/check.go Routes gate notes through the new note styler.
grafana-alertcheck/cmd/grafana-alertcheck/table.go Adds section titles, thresholds table, and colored “violations” footer when terminal output.
grafana-alertcheck/cmd/grafana-alertcheck/table_test.go Updates assertions for the new table/footer format.
grafana-alertcheck/cmd/grafana-alertcheck/style.go Introduces terminal-detection, note line styling, and section spacing behavior.
Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread grafana-alertcheck/cmd/grafana-alertcheck/style.go
Comment thread grafana-alertcheck/cmd/grafana-alertcheck/style.go
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p14 branch from e0a1a11 to 24afb29 Compare September 4, 2026 15:03
@Tofel
Tofel force-pushed the dx-5122-alerts-assertion-p14 branch from 24afb29 to bb77d7f Compare September 4, 2026 15:15
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