Repository navigation
fix(fetchSCAN): account for change in SCAN report front matter - #488
Merged
Merged
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add mocked parser fixtures and make API failure skips reliably distinguish client regressions.
Review effort: Lite
Findings: 2
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.
AndrewBrown-USDA
force-pushed
the
fix/fetchscan-test1
branch
from
September 30, 2026 22:37
07b04e2 to
65b45e5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.