Skip to content

Conversation

peternied
Copy link
Member

@peternied peternied commented Aug 13, 2025

Description

Add a check to the frontend to make sure that generated files are tracked or fails the build

Issues

Check List

  • New functionality includes testing
  • Public documentation issue/PR created, if applicable.

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.

Copy link
Collaborator

@jugal-chauhan jugal-chauhan left a comment

Choose a reason for hiding this comment

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

Thank you for these changes. I have a few minor NITs


commandLine 'bash', '-c', '''
changed=$(git diff --name-only -- frontend/src/generated/)
untracked=$(git ls-files --others --exclude-standard -- frontend/src/generated/)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Script will check for diff and untracked files, which is good. How will we handle cases where new generated files are added ?

Copy link
Member Author

Choose a reason for hiding this comment

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

If the are part of a commit on the branch they will not fail in either of these checks. The nature of the problem is that there were api changes and they didn't got through code review but instead were automatically picked up during the auto-generation process.

changed=$(git diff --name-only -- frontend/src/generated/)
untracked=$(git ls-files --others --exclude-standard -- frontend/src/generated/)
if [ -n "$changed$untracked" ]; then
echo "Error: Unstaged or untracked files under frontend/src/generated/:"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we modify the error message to be something like "Please commit the following generated files:..."

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated response to include resolution message

> Task :frontend:checkGeneratedFilesTracked FAILED
Error: Unstaged or untracked files under frontend/src/generated/:
frontend/src/generated/api/types.gen.ts
Please run ./gradlew frontend:generateBackendClient and commit the updated files

Copy link
Collaborator

@jugal-chauhan jugal-chauhan left a comment

Choose a reason for hiding this comment

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

Thank you for these changes

@peternied peternied merged commit 1389b68 into opensearch-project:main Oct 10, 2025
57 checks passed
@peternied peternied deleted the generated-files-are-tracked branch October 10, 2025 17:04
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (b29166c) to head (3da318d).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #1761   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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