Skip to content

fix(report): keep benchmark evidence inside Markdown table cells - #453

Open
karanb192 wants to merge 2 commits into
alibaba:mainfrom
karanb192:fix/benchmark-markdown-cells
Open

karanb192 wants to merge 2 commits into
alibaba:mainfrom
karanb192:fix/benchmark-markdown-cells

Conversation

@karanb192

@karanb192 karanb192 commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

An expectation such as read | write created an extra column in benchmark.md, and a line break in the evidence split the row in two.

The benchmark table now uses the existing Markdown report cell formatter for expectation text and evidence.

The formatter now also escapes backslashes before it escapes pipes. Before this change, a regex assertion such as count \| wc became count \\| wc. GFM renders that as a bare pipe and drops the backslash, and renderers that pair backslashes first split the row. The shared formatter also feeds the case table in the Markdown report, so backslashes there now render as written too.

Test plan

The regression calls WriteBenchmarkMarkdown and checks two complete output rows:

  1. A pipe in the expectation, plus multiline evidence that contains another pipe.
  2. A regex \| in the expectation, plus a Windows path in the evidence.

I rendered the old and new escaping with pandoc's GFM reader. The new escaping renders count \| wc in one cell, and the old one rendered count | wc.

Local checks: make verify and go test -race ./....

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T14:45:42.755213Z e14fbc0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e14fbc0e55

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

icon = "⏭️ SKIP"
}
fmt.Fprintf(sb, "| %s | %s | %s |\n", e.Text, icon, e.Evidence)
fmt.Fprintf(sb, "| %s | %s | %s |\n", markdownTableCell(e.Text), icon, markdownTableCell(e.Evidence))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Escape existing backslashes before adding pipe escapes

When an assertion contains a literal-pipe regex escape, as in examples/code-stats/evals/cases/exclude-dependencies.yaml:36-39, markdownTableCell changes \| into \\|. Markdown interprets the doubled backslash as an escaped backslash, leaving the pipe as a column delimiter. These existing regex assertions previously produced three-cell rows but now split into extra columns, so the result and evidence no longer align with their headers. Escape existing backslashes before escaping pipes, and add a regression case containing \|.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed in 11cebca. Backslashes are escaped before pipes, so \| renders as written in one cell. Checked with pandoc's GFM reader: the old output dropped the backslash rather than splitting the row.

A regex assertion such as `count \| wc` became `count \\| wc` in the
table. GFM renders that as a bare pipe, and renderers that pair
backslashes first split the row. Escaping the backslash as well keeps the
cell intact and shows the assertion as written.

This branch has not been deployed

No deployments
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