Skip to content

fix(fetchSCAN): account for change in SCAN report front matter - #488

Merged
AndrewBrown-USDA merged 3 commits into
masterfrom
fix/fetchscan-test1
Sep 30, 2026
Merged

AndrewBrown-USDA merged 3 commits into
masterfrom
fix/fetchscan-test1

Conversation

@AndrewBrown-USDA

Copy link
Copy Markdown
Collaborator

Makes correction to fetchSCAN() report parsing logic to correct for a change in the number of blank lines at the beginning of the response.

It is odd that this is an issue, but follows a trend we have seen over past 8 years... this is now the 3rd time this class of formatting change has occurred.

To avoid the churn (in case this ever increases again or is reverted) I used trimws() to remove all the leading whitespace lines, returning to the pre-2018 behavior (skip=2). Also added better tests that do not rely on the live web service, and improved logic for handling errors in existing tests.

Copilot AI 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.

Copilot review overview

🟡 Changes recommended

Add mocked parser fixtures and make API failure skips reliably distinguish client regressions.

Review effort: Lite
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates fetchSCAN() to handle variable leading blank lines in SCAN responses and improves test coverage and API failure handling.

Changes:

  • Trims response whitespace before parsing with skip = 2.
  • Adds deterministic formatter tests.
  • Improves handling of live API failures.
File Summary
R/​fetchSCAN.R Adjusts SCAN response front-matter parsing.
tests/​testthat/​test-fetchSCAN.R Adds formatter tests and API error handling; parser-path coverage and skip logic need changes.

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

Comment thread R/fetchSCAN.R
Comment thread tests/testthat/test-fetchSCAN.R
@AndrewBrown-USDA
AndrewBrown-USDA merged commit f67b791 into master Sep 30, 2026
5 checks passed
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