Skip to content

Fix GitHub Copilot identified issues in rc-5.0.1 cross-merge - #3433

Open
andrew-platt wants to merge 3 commits into
OpenFAST:rc-5.0.1from
andrew-platt:b/MiscBugsFromCrossMerge
Open

Fix GitHub Copilot identified issues in rc-5.0.1 cross-merge#3433
andrew-platt wants to merge 3 commits into
OpenFAST:rc-5.0.1from
andrew-platt:b/MiscBugsFromCrossMerge

Conversation

@andrew-platt

Copy link
Copy Markdown
Collaborator

Ready to merge

Feature or improvement description

Fix three code quality issues identified by GitHub Copilot in PR #3432:

  1. AeroAcoustics.f90: Prevent out-of-bounds array access

    • Add guard for single-node case (NumBlNds==1)
    • Calculate LastElemPct safely without accessing NumBlNds-1 index
    • When NumBlNds==1, treat element as spanning entire blade (100%)
  2. IfW_FlowField.f90: Improve error messaging for cubic interpolation

    • Clarify why acceleration field is required for cubic velocity interpolation
    • Provide context-specific error messages for three scenarios:
      • Both acceleration output and cubic interpolation enabled
      • Only acceleration output requested * Only cubic velocity interpolation enabled
  3. FVW_IO.f90: Add I/O error handling in ResolveGridAxis

    • Add iostat check to grid point list file read loop
    • Return controlled error with line number and filename on read failure
    • Prevent unhandled runtime crashes from malformed/truncated files

Additional supporting information
These issues were found during review of a cross-merge from rc-5.0.1 to dev with PR #3482

Generative AI usage
Co-authored-by: GitHub Copilot noreply@github.com
Co-authored-by: Claude Sonnet 4.5 noreply@anthropic.com

Test results, if applicable
No results affected

@andrew-platt andrew-platt added this to the v5.0.1 milestone Aug 17, 2026
@andrew-platt
andrew-platt requested a lite review from Copilot August 17, 2026 20:41
@andrew-platt andrew-platt self-assigned this Aug 17, 2026
@andrew-platt andrew-platt added the Code-dev: cross-merges and maintenance Cross-merges between development branches. This is mostly code development maintenance. label Aug 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses three code-quality issues found during an rc-5.0.1dev cross-merge, focusing on safer edge-case handling and clearer runtime diagnostics.

Changes:

  • Prevents an out-of-bounds access in AeroAcoustics blade-span percentage checks when NumBlNds == 1.
  • Improves InflowWind fatal error messaging when cubic velocity interpolation and/or acceleration output requires a valid acceleration field.
  • Adds iostat checking while reading OLAF grid point list files to fail gracefully on malformed/truncated input.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
modules/inflowwind/src/IfW_FlowField.f90 Expands validation/error paths for cases where cubic time interpolation requires a valid acceleration field.
modules/aerodyn/src/FVW_IO.f90 Adds iostat handling to prevent uncontrolled crashes when reading grid point list files.
modules/aerodyn/src/AeroAcoustics.f90 Guards last-element percentage calculation for single-node blades to avoid invalid indexing.
Suppressed comments (1)

modules/inflowwind/src/IfW_FlowField.f90:92

  • The cubic-interpolation fatal message repeats “accel field” after stating “acceleration field”, which is inconsistent and slightly harder to read. Using consistent wording would improve clarity.
      else  ! FF%VelInterpCubic
         call SetErrStat(ErrID_Fatal, "Cubic velocity interpolation requires a valid acceleration field, but accel field is not valid", &
                         ErrStat, ErrMsg, RoutineName)

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

Comment thread modules/inflowwind/src/IfW_FlowField.f90
Comment thread modules/aerodyn/src/FVW_IO.f90 Outdated
andrew-platt and others added 3 commits August 17, 2026 14:50
Fix three code quality issues identified by GitHub Copilot in PR OpenFAST#3432:

1. AeroAcoustics.f90: Prevent out-of-bounds array access
   - Add guard for single-node case (NumBlNds==1)
   - Calculate LastElemPct safely without accessing NumBlNds-1 index
   - When NumBlNds==1, treat element as spanning entire blade (100%)

2. IfW_FlowField.f90: Improve error messaging for cubic interpolation
   - Clarify why acceleration field is required for cubic velocity interpolation
   - Provide context-specific error messages for three scenarios:
     * Both acceleration output and cubic interpolation enabled
     * Only acceleration output requested
     * Only cubic velocity interpolation enabled

3. FVW_IO.f90: Add I/O error handling in ResolveGridAxis
   - Add iostat check to grid point list file read loop
   - Return controlled error with line number and filename on read failure
   - Prevent unhandled runtime crashes from malformed/truncated files

Co-authored-by: GitHub Copilot <noreply@github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix three code quality issues identified by GitHub Copilot in PR OpenFAST#3432:

1. AeroAcoustics.f90: Prevent out-of-bounds array access
   - Add guard for single-node case (NumBlNds==1)
   - Calculate LastElemPct safely without accessing NumBlNds-1 index
   - When NumBlNds==1, treat element as spanning entire blade (100%)

2. IfW_FlowField.f90: Improve error messaging for cubic interpolation
   - Clarify why acceleration field is required for cubic velocity interpolation
   - Provide context-specific error messages for three scenarios:
     * Both acceleration output and cubic interpolation enabled
     * Only acceleration output requested
     * Only cubic velocity interpolation enabled

3. FVW_IO.f90: Add I/O error handling in ResolveGridAxis
   - Add iostat check to grid point list file read loop
   - Return controlled error with line number and filename on read failure
   - Prevent unhandled runtime crashes from malformed/truncated files

Co-authored-by: GitHub Copilot <noreply@github.com>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Address two wording improvements suggested by Copilot in PR OpenFAST#3433:

1. IfW_FlowField.f90: Use consistent terminology
   - Changed 'accel field' to 'the acceleration field' in all three
     error messages for consistency within the same conditional block

2. FVW_IO.f90: Improve read error diagnostics
   - Changed 'line j' to 'grid point #j' (j is entry index, not line)
   - Added iostat code to error message for better troubleshooting
   - List-directed READ can consume multiple values per line, so
     reporting it as a line number was misleading

Co-authored-by: GitHub Copilot <noreply@github.com>
@andrew-platt
andrew-platt force-pushed the b/MiscBugsFromCrossMerge branch from cdbf154 to fb960d8 Compare August 17, 2026 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code-dev: cross-merges and maintenance Cross-merges between development branches. This is mostly code development maintenance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants