Skip to content

Fix stray fragment injection in updateVersion gradle task - #1913

Merged
heemin32 merged 1 commit into
opensearch-project:mainfrom
heemin32:updateVersion
Jul 27, 2026
Merged

Fix stray fragment injection in updateVersion gradle task#1913
heemin32 merged 1 commit into
opensearch-project:mainfrom
heemin32:updateVersion

Conversation

@heemin32

@heemin32 heemin32 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Description

When appending the current version to the rolling-upgrade BWC list, the
rolling section was sliced from updatedContent using a stale offset. Updating
the restart-upgrade section beforehand changed the string length, so the stale
offset pointed before the rolling job header and captured the tail of the
preceding line, injecting an invalid fragment into the workflow YAML.

Recompute the offset inline when extracting the rolling section, matching the
pattern used by the equivalent task in the search-relevance repo.

Related Issues

N/A

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.45%. Comparing base (d35bab4) to head (79ed864).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1913      +/-   ##
============================================
+ Coverage     83.43%   83.45%   +0.01%     
- Complexity     3898     3900       +2     
============================================
  Files           291      291              
  Lines         13844    13844              
  Branches       2304     2304              
============================================
+ Hits          11551    11553       +2     
+ Misses         1458     1457       -1     
+ Partials        835      834       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 No relevant tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@heemin32
heemin32 force-pushed the updateVersion branch 2 times, most recently from 7c0513a to 5bfbe93 Compare July 24, 2026 23:55
Comment thread build.gradle
def rollingSection = updatedContent.substring(updatedContent.indexOf('Rolling-Upgrade-BWCTests-NeuralSearch:'))
def rollingVersions = extractVersions(rollingSection)
if (!rollingVersions.isEmpty() && isCurrentVersionNewer(rollingVersions.last())) {
def updatedRollingSection = rollingSection.replaceFirst(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not introduced by this PR, but noticed while tracing: two replace regexes differ.

  • Restart: ^\s*bwc_version\s*:\s*\[... tolerates a space before the colon
  • Rolling: ^\s*bwc_version:\s*\[... requires no space before the colon

if the rolling bwc_version line were ever formatted as bwc_version :, extraction would succeed and log "Added …" while replaceFirst silently no-ops, silent failure

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Updated

When appending the current version to the rolling-upgrade BWC list, the
rolling section was sliced from updatedContent using a stale offset. Updating
the restart-upgrade section beforehand changed the string length, so the stale
offset pointed before the rolling job header and captured the tail of the
preceding line, injecting an invalid fragment into the workflow YAML.

Recompute the offset inline when extracting the rolling section, matching the
pattern used by the equivalent task in the search-relevance repo.

Signed-off-by: Heemin Kim <heemin@amazon.com>
@heemin32
heemin32 merged commit 5f9fba8 into opensearch-project:main Jul 27, 2026
32 of 88 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants