Skip to content

fix(runner): render structured markdown values as json - #2750

Merged
Mzack9999 merged 1 commit into
devfrom
fix/md-complex-values
Nov 19, 2026
Merged

Mzack9999 merged 1 commit into
devfrom
fix/md-complex-values

Conversation

@dogancanbakir

@dogancanbakir dogancanbakir commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Fixes #2748

Structured -md values now render as in the JSON output; []byte as base64, time as RFC3339, nil as empty.

Summary by CodeRabbit

  • Improvements
    • Markdown output now formats byte values as Base64, joins string and integer lists with commas, and escapes values for Markdown.
    • Timestamps use a consistent, precise format. Structured values are displayed as JSON, while nil pointers and values that cannot be formatted appear blank.

@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

formatMarkdownValue now uses specific formats for byte slices, string and integer slices, timestamps, and other accessible values. Tests cover these formats, nil pointers, empty slices, and structs.

Changes

Markdown value formatting

Layer / File(s) Summary
Format values and verify output
runner/md_output.go, runner/md_output_test.go
The formatter base64-encodes nonempty byte slices, joins string and integer slices with , and Markdown-escapes the result, and formats time.Time values as RFC3339Nano. It JSON-marshals other accessible values. Nil pointers, inaccessible values, and JSON marshal failures produce empty strings. Tests cover these outputs and related cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: vishnu0906, mzack9999

Merge Risk: Minimal · up to fcb34

Markdown output now renders byte slices as base64, timestamps as RFC3339, and structs as JSON, which addresses the reported issue. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: structured values in Markdown output now render as JSON. The raw summary confirms that formatMarkdownValue now JSON-marshals structured values, base64-encodes byte sli…
Linked Issues check Passed Issue #2748 asks that -md stop printing Go syntax for structured fields (cpe, wordpress) and monotonic-clock timestamps. At the reviewed head, formatMarkdownValue in runner/md_output.go now ha…
Out of Scope Changes check Passed The whole-PR diff from the merge base touches two files: runner/md_output.go and runner/md_output_test.go. The md_output.go diff only changes formatMarkdownValue and adds the imports it needs (`enco…
Full details: Title check

Explanation

The title names the main change: structured values in Markdown output now render as JSON. The raw summary confirms that formatMarkdownValue now JSON-marshals structured values, base64-encodes byte slices, and renders nil pointers as empty strings. The PR objectives match this change and link it to issue #2748. The title uses the conventional fix(runner) prefix and stays within a single concise sentence. It does not cover every detail, such as base64 encoding or RFC3339Nano timestamps, which is expected.

Full details: Linked Issues check

Explanation

Issue #2748 asks that -md stop printing Go syntax for structured fields (cpe, wordpress) and monotonic-clock timestamps. At the reviewed head, formatMarkdownValue in runner/md_output.go now handles these cases:

  • Non-nil structs and pointers-to-structs fall through to json.Marshal, then escapeMarkdown. This replaces %v, so &{...} no longer appears.
  • Nil pointers return an empty string. This replaces <nil>.
  • time.Time values use Format(time.RFC3339Nano). Format drops the monotonic reading, so m=+... no longer appears.
    The PR description also specifies []byte as base64. The code encodes []byte with base64.StdEncoding. The summary states that runner/md_output_test.go adds tests for these cases. I did not read the test file, so test coverage rests on the summary. No non-coding requirements exist in #2748.
Full details: Out of Scope Changes check

Explanation

The whole-PR diff from the merge base touches two files: runner/md_output.go and runner/md_output_test.go. The md_output.go diff only changes formatMarkdownValue and adds the imports it needs (encoding/base64, encoding/json, time). Every change maps to the Markdown value formatting that #2748 covers. The test file changes, per the summary, cover the same formatting paths. No unrelated changes were found.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the Markdown rows,
And watches base64 bytes flow.
Commas join the strings in line,
Timestamps keep their format fine.
JSON gives structs a shape to show,
Then off through clover fields I go.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 43033733-4f98-46d8-875d-5310bc27b455
Commits

Reviewing files that changed from the base of the PR and between 2226531 and fcb34f7.

Files selected for processing: 2

  • runner/md_output.go
  • runner/md_output_test.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@Mzack9999
Mzack9999 merged commit bbcd4a0 into dev Nov 19, 2026
12 checks passed
@Mzack9999
Mzack9999 deleted the fix/md-complex-values branch November 19, 2026 16:55
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.

-md prints Go structs for cpe, wordpress and timestamp

2 participants