[PR #7073] [MERGED] fix(cli): preserve literal Markdown table facts #7623

Closed
opened 2026-11-03 13:39:11 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/7073
Author: @Plastic-time
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/25/2026
Merged by: @morluto

Base: main ← Head: codex/fix-markdown-table-literals-20261025


📝 Commits (3)

  • c346143 fix(cli): preserve literal Markdown table facts
  • 26b6fab test(cli): retain capacity diagnostics through Markdown escaping
  • 8f1fd0d fix(cli): keep intraword underscores readable in Markdown tables

📊 Changes

5 files changed (+137 additions, -15 deletions)

View changed files

📝 docs/cli.md (+4 -2)
📝 src/cli/cliOutputFormatter.ts (+16 -2)
📝 tests/boundary/cli/filteredArrayOutput.test.ts (+11 -10)
➕ tests/boundary/cli/markdownLiteralCells.test.ts (+105 -0)
📝 tests/boundary/cli/markdownNestedFacts.test.ts (+1 -1)

📄 Description

Summary

Markdown table output treats captured text such as __name__, backticks, link/image syntax, and strikethrough as markup. A rendered report can therefore change an Evidence key, value, or nested JSON fact even though JSON output retains the source.

Escape inline Markdown syntax at the existing table-cell owner. Table headers, key/value tables, object-row tables, and standalone reports all use that owner. No issue is linked because this was reproduced directly on main 8e6a9578. Related #7062 fixes headings; this change addresses table contents independently. A three-way merge with its current head is conflict-free.

Contract and boundary impact

  • Semantic owner: src/cli/cliOutputFormatter.ts#escapeTableCell; the existing backslash/pipe passes are replaced by one character escape pass before line-break rendering. Underscore runs between letters or digits cannot open or close emphasis, so they stay unescaped and identifiers such as source_index remain readable in raw Markdown.
  • Ordinary presentation fix; no new capability or maintainer scope decision required.
  • CLI: raw Markdown now includes escapes for inline syntax. For example, a cell containing __name__ renders as the literal __name__, rather than name in bold. JSON, saved Evidence, schemas and MCP output are unchanged.
  • Provider/platform, artifact identity, target authority, cleanup and package/generated metadata: unchanged.

Expected effects:

  • Documentation or usability only; no target interaction.

Evidence and regression coverage

A compiled inspect-evidence-bundle --format md --filter-output records.0.normalized_result regression renders the result with the existing VitePress dependency and reads table text through parse5. It compares visible keys and values to the original data, including nested JSON, code/emphasis/strike/link/image syntax, existing backslashes, pipes, HTML/entities, empty text, zero, false and null. JSON output and the saved bundle are exact controls; standalone reports exercise the same data.

Applicable boundary cases: raw identity/normalization, missing/empty/scalar distinctions, and public output delivery. Existing delimiter/newline, failure-output and 150,000-row capacity regressions remain covered. No resource lifecycle changes.

  • Observed, derived and inferred claims remain distinguishable.
  • Artifact identity, source provenance and failed attempts remain preserved.
  • Unsupported or uncertain outcomes remain visible.

Validation performed

Windows x64, Node 24.22.1 / npm 11.16.0:

  • Unchanged upstream runtime plus the new regression: 105 existing tests passed; only the new rendered-text assertion failed. Captured __name__ became name, link markup displayed only its label, and image syntax became an image.
  • Final relevant CLI coverage: 196 passed, 1 platform skip across 11 files, including the rendered-text regression and large inventory page. After updating old raw-Markdown assertions, the affected 13-test subset was rerun and passed.
  • npm run check — passed, including architecture guards, reachability reporting and typed lint (0 errors).
  • npm run docs:check — passed, including 9 consistency tests.
  • lint-staged, npm run check:fast, and git diff --check — passed. Hook commands ran directly under Windows Node because the Git Bash Node shim failed before executing them.

Hosted CI on the initial c3461437 runtime change passed source tests, documentation, static checks, package build and the Linux native package baseline. Shard 1 failed six legacy raw-text assertions in tests/acceptance/cliFormattingCapacity.test.ts; the other seven shards were cancelled. This acceptance file was missing from the initial local selection.

Follow-up 26b6fab5 changed only those test assertions. It is superseded by 8f1fd0d: intraword underscores are no longer escaped, so diagnostic identifiers such as formatted_characters, target_unavailable and invalid_request appear unchanged and the original assertions in cliFormattingCapacity, analysisViewCli and filteredFailureOutput are restored exactly as on main. Boundary runs (__proto__, _name_, snake_case_) are still escaped.

  • Same-host upstream production source (8e6a9578) with the original capacity test: 22 passed, 1 Windows SIGPIPE skip. The initial PR reproduced all six Markdown assertion failures; one separate local fixture-cleanup EBUSY also occurred and did not recur in the baseline or fixed runs.
  • Fixed capacity, literal-cell, formatting-recovery, filtered-failure and update-alias files: 45 passed, 1 platform skip across five files.
  • npm run check, lint-staged, npm run check:fast and git diff --check passed again after the test correction.

Head 8f1fd0d (Windows x64, Node 24.20.0 with --engine-strict=false; Windows addon restored from rea-agents@6.7.0 per native/windows/README.md):

  • All 13 test files that exercise Markdown CLI output: 227 passed, 2 skipped, including the literal-cell regression extended with x__y__z _a_b_ 中_文 snake_case_ (raw output keeps intraword underscores; rendered cells match the source).
  • npm run typecheck, oxlint, oxfmt --check, lint-staged (pre-commit) and npm run check:fast (pre-push) passed.

The 26b6fab5 shard 8 failures (cdpSvgXlinkHref headless Chrome timeout, javascriptAnalysisResources MCP heap budget) do not reach cliOutputFormatter, which only the CLI uses. Latest-head hosted CI is pending. Greptile rated the initial runtime change 5/5 with no inline findings. The Codex review attempt did not complete and published no actionable inline comments. macOS and external analysis providers were not exercised. An initial sandboxed multi-file run lost Vite's temporary files; normal-host baseline and fixed runs completed without that runner error.

Compatibility, safety, and release

Rendered table facts retain their supplied inline syntax. Raw Markdown consumers will see additional escapes for inline syntax at word boundaries; intraword underscores are unchanged; programmatic consumers can use JSON. Heading and non-table scalar rendering are outside this change. No dependency, schema, migration or release-metadata change.

Author readiness

Human owner: @Plastic-time

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Concrete problem, focused outcome and conventional title.
  • Scope, owning boundary, source preservation and representative output documented.
  • Relevant tests and docs updated; no generated artifacts, secrets or unrelated cleanup.
  • Latest-head required CI and human readiness confirmed.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/7073 **Author:** [@Plastic-time](https://github.com/Plastic-time) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/fix-markdown-table-literals-20261025` --- ### 📝 Commits (3) - [`c346143`](https://github.com/morluto/rea/commit/c346143723049bc540a18fd3b612904329e1a77b) fix(cli): preserve literal Markdown table facts - [`26b6fab`](https://github.com/morluto/rea/commit/26b6fab5bc7ad99527a61d391ef3660d52f42e0a) test(cli): retain capacity diagnostics through Markdown escaping - [`8f1fd0d`](https://github.com/morluto/rea/commit/8f1fd0d53b0a2ec7d6eb35f552d5f2f6c966ff5c) fix(cli): keep intraword underscores readable in Markdown tables ### 📊 Changes **5 files changed** (+137 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `docs/cli.md` (+4 -2) 📝 `src/cli/cliOutputFormatter.ts` (+16 -2) 📝 `tests/boundary/cli/filteredArrayOutput.test.ts` (+11 -10) ➕ `tests/boundary/cli/markdownLiteralCells.test.ts` (+105 -0) 📝 `tests/boundary/cli/markdownNestedFacts.test.ts` (+1 -1) </details> ### 📄 Description ## Summary Markdown table output treats captured text such as `__name__`, backticks, link/image syntax, and strikethrough as markup. A rendered report can therefore change an Evidence key, value, or nested JSON fact even though JSON output retains the source. Escape inline Markdown syntax at the existing table-cell owner. Table headers, key/value tables, object-row tables, and standalone reports all use that owner. No issue is linked because this was reproduced directly on main `8e6a9578`. Related #7062 fixes headings; this change addresses table contents independently. A three-way merge with its current head is conflict-free. ## Contract and boundary impact - Semantic owner: `src/cli/cliOutputFormatter.ts#escapeTableCell`; the existing backslash/pipe passes are replaced by one character escape pass before line-break rendering. Underscore runs between letters or digits cannot open or close emphasis, so they stay unescaped and identifiers such as `source_index` remain readable in raw Markdown. - Ordinary presentation fix; no new capability or maintainer scope decision required. - CLI: raw Markdown now includes escapes for inline syntax. For example, a cell containing `__name__` renders as the literal `__name__`, rather than `name` in bold. JSON, saved Evidence, schemas and MCP output are unchanged. - Provider/platform, artifact identity, target authority, cleanup and package/generated metadata: unchanged. Expected effects: - [x] Documentation or usability only; no target interaction. ## Evidence and regression coverage A compiled `inspect-evidence-bundle --format md --filter-output records.0.normalized_result` regression renders the result with the existing VitePress dependency and reads table text through parse5. It compares visible keys and values to the original data, including nested JSON, code/emphasis/strike/link/image syntax, existing backslashes, pipes, HTML/entities, empty text, zero, false and null. JSON output and the saved bundle are exact controls; standalone reports exercise the same data. Applicable boundary cases: raw identity/normalization, missing/empty/scalar distinctions, and public output delivery. Existing delimiter/newline, failure-output and 150,000-row capacity regressions remain covered. No resource lifecycle changes. - [x] Observed, derived and inferred claims remain distinguishable. - [x] Artifact identity, source provenance and failed attempts remain preserved. - [x] Unsupported or uncertain outcomes remain visible. ## Validation performed Windows x64, Node 24.22.1 / npm 11.16.0: - Unchanged upstream runtime plus the new regression: **105 existing tests passed; only the new rendered-text assertion failed**. Captured `__name__` became `name`, link markup displayed only its label, and image syntax became an image. - Final relevant CLI coverage: **196 passed, 1 platform skip across 11 files**, including the rendered-text regression and large inventory page. After updating old raw-Markdown assertions, the affected 13-test subset was rerun and passed. - `npm run check` — passed, including architecture guards, reachability reporting and typed lint (0 errors). - `npm run docs:check` — passed, including 9 consistency tests. - `lint-staged`, `npm run check:fast`, and `git diff --check` — passed. Hook commands ran directly under Windows Node because the Git Bash Node shim failed before executing them. Hosted CI on the initial `c3461437` runtime change passed source tests, documentation, static checks, package build and the Linux native package baseline. Shard 1 failed six legacy raw-text assertions in `tests/acceptance/cliFormattingCapacity.test.ts`; the other seven shards were cancelled. This acceptance file was missing from the initial local selection. Follow-up `26b6fab5` changed only those test assertions. It is superseded by `8f1fd0d`: intraword underscores are no longer escaped, so diagnostic identifiers such as `formatted_characters`, `target_unavailable` and `invalid_request` appear unchanged and the original assertions in `cliFormattingCapacity`, `analysisViewCli` and `filteredFailureOutput` are restored exactly as on main. Boundary runs (`__proto__`, `_name_`, `snake_case_`) are still escaped. - Same-host upstream production source (`8e6a9578`) with the original capacity test: **22 passed, 1 Windows SIGPIPE skip**. The initial PR reproduced all six Markdown assertion failures; one separate local fixture-cleanup EBUSY also occurred and did not recur in the baseline or fixed runs. - Fixed capacity, literal-cell, formatting-recovery, filtered-failure and update-alias files: **45 passed, 1 platform skip across five files**. - `npm run check`, `lint-staged`, `npm run check:fast` and `git diff --check` passed again after the test correction. Head `8f1fd0d` (Windows x64, Node 24.20.0 with `--engine-strict=false`; Windows addon restored from `rea-agents@6.7.0` per `native/windows/README.md`): - All 13 test files that exercise Markdown CLI output: **227 passed, 2 skipped**, including the literal-cell regression extended with `x__y__z _a_b_ 中_文 snake_case_` (raw output keeps intraword underscores; rendered cells match the source). - `npm run typecheck`, `oxlint`, `oxfmt --check`, `lint-staged` (pre-commit) and `npm run check:fast` (pre-push) passed. The `26b6fab5` shard 8 failures (`cdpSvgXlinkHref` headless Chrome timeout, `javascriptAnalysisResources` MCP heap budget) do not reach `cliOutputFormatter`, which only the CLI uses. Latest-head hosted CI is pending. Greptile rated the initial runtime change 5/5 with no inline findings. The Codex review attempt did not complete and published no actionable inline comments. macOS and external analysis providers were not exercised. An initial sandboxed multi-file run lost Vite's temporary files; normal-host baseline and fixed runs completed without that runner error. ## Compatibility, safety, and release Rendered table facts retain their supplied inline syntax. Raw Markdown consumers will see additional escapes for inline syntax at word boundaries; intraword underscores are unchanged; programmatic consumers can use JSON. Heading and non-table scalar rendering are outside this change. No dependency, schema, migration or release-metadata change. ## Author readiness Human owner: @Plastic-time - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] Concrete problem, focused outcome and conventional title. - [x] Scope, owning boundary, source preservation and representative output documented. - [x] Relevant tests and docs updated; no generated artifacts, secrets or unrelated cleanup. - [ ] Latest-head required CI and human readiness confirmed. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 13:39:11 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#7623
No description provided.