Skip to content

Add tools/check_news_roundtrip.R to validate NEWS.md parse/write fidelity#1044

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/create-news-md-check-script
Draft

Add tools/check_news_roundtrip.R to validate NEWS.md parse/write fidelity#1044
Copilot wants to merge 2 commits intomainfrom
copilot/create-news-md-check-script

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 26, 2026

Adds a developer script that finds all NEWS.md files reachable from the CWD and verifies that fledge's parse → write cycle is lossless.

Changes

  • tools/check_news_roundtrip.R — uses fs::dir_ls() to discover all NEWS.md files recursively, then for each:

    1. Reads lines with brio::read_lines()
    2. Parses via read_news() (internal fledge)
    3. Reconstructs via write_news_sections() + preamble
    4. Compares reconstructed content against original; exits with status 1 on any mismatch or parse error
  • .Rbuildignore — adds ^tools$ to exclude the directory from package builds

Usage

Rscript tools/check_news_roundtrip.R

Example output:

Found 5 NEWS.md file(s)

# A tibble: 5 × 3
  file                                           status message
1 NEWS.md                                        ok     ""
2 tests/testthat/_snaps/auto/NEWS.md             fail   "Roundtrip mismatch"
...

Failed files:
 - tests/testthat/_snaps/auto/NEWS.md

Files flagged as fail are ones where fledge would normalize content on next write (e.g. trailing blank lines stripped by write_news_section).

Original prompt

This section details on the original issue you should resolve

<issue_title>Create script that iterates through NEWS.md files and checks roundtrip</issue_title>
<issue_description>Look into all directories reachable from the CWD, search for files named NEWS.md . Pure R code, using fs and tidyverse. Store it in tools/, build-ignore the directory.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Copilot AI changed the title [WIP] Add script to check roundtrip for NEWS.md files Add tools/check_news_roundtrip.R to validate NEWS.md parse/write fidelity Feb 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Create script that iterates through NEWS.md files and checks roundtrip

2 participants