Skip to content

bug: Fix version number and changelog - #1293

Merged
scottanderson merged 1 commit into
mainfrom
deploy
Jun 28, 2025
Merged

scottanderson merged 1 commit into
mainfrom
deploy

Conversation

@scottanderson

@scottanderson scottanderson commented Jun 28, 2025 •

Copy link
Copy Markdown
Contributor

Description:

Fix missing version number and changelog in branch deploys.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory
  • I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
  • I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors

@coderabbitai

coderabbitai Bot commented Jun 28, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The build script was updated to only write the contents of CHANGELOG_MD and VERSION_TXT to their respective files if those variables are not empty. This prevents overwriting or creating empty resource files when the variables are unset or empty.

Changes

File(s) Change Summary
build.sh Updated to conditionally write to resources/changelog.md and resources/version.txt only if CHANGELOG_MD and VERSION_TXT variables are non-empty.

Sequence Diagram(s)

sequenceDiagram
    participant BuildScript
    participant FileSystem

    BuildScript->>BuildScript: Check CHANGELOG_MD
    alt CHANGELOG_MD not empty
        BuildScript->>FileSystem: Write resources/changelog.md
    end
    BuildScript->>BuildScript: Check VERSION_TXT
    alt VERSION_TXT not empty
        BuildScript->>FileSystem: Write resources/version.txt
    end
Loading

Possibly related PRs

  • openfrontio/OpenFrontIO#1109: Moves version and changelog data into files and updates client code to load them dynamically; closely related to this PR's handling of version and changelog files.
  • openfrontio/OpenFrontIO#1291: Expands build.sh to accept changelog and version arguments and writes them; both PRs modify the same script and file writing logic.

Suggested reviewers

  • evanpelle

Poem

When scripts decide to write or not,
They check if content’s there or not.
No empty files, no wasted ink,
Just tidy builds—don’t you think?
The changelog waits, the version too,
Only written if there’s something new!
📝✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
build.sh (1)

21-26: Usage text is now out-of-sync with the real argument list

The script now expects five positional params, but the help still documents only three.
Anyone following the usage hint will pass [metadata_file] as $3, shifting every later arg and causing the new CHANGELOG_MD / VERSION_TXT logic to silently mis-behave.

-echo "Usage: $0 [prod|staging] [version_tag] [metadata_file]"
+echo "Usage: $0 [prod|staging] [version_tag] [version_txt] [changelog_md] [metadata_file]"

Please update both usage lines (here and below) and the accompanying comments so they reflect the current contract.
A mismatched interface is a hard-to-trace production foot-gun.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 27dd920 and 8ca4f76.

📒 Files selected for processing (1)
  • build.sh (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: andrewNiziolek
PR: openfrontio/OpenFrontIO#1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: 🏗️ Build
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Deploy to openfront.dev

Comment thread build.sh
Comment on lines +77 to +82
if [ -n "$CHANGELOG_MD" ]; then
echo "$CHANGELOG_MD" > resources/changelog.md
fi
if [ -n "$VERSION_TXT" ]; then
echo "$VERSION_TXT" > resources/version.txt
fi

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.

💡 Verification agent

🧩 Analysis chain

echo blindly writes the literal string – is that really what you want?

Right now the code treats $CHANGELOG_MD / $VERSION_TXT as content, not file paths.
If the caller actually passes a path (very common in CI), the file will end up containing a single line like /tmp/changelog.md.

Consider accepting file paths and copying them, which scales better for long multi-line text:

-if [ -n "$CHANGELOG_MD" ]; then
-    echo "$CHANGELOG_MD" > resources/changelog.md
-fi
-if [ -n "$VERSION_TXT" ]; then
-    echo "$VERSION_TXT" > resources/version.txt
-fi
+if [ -n "$CHANGELOG_MD" ] && [ -f "$CHANGELOG_MD" ]; then
+    cp "$CHANGELOG_MD" resources/changelog.md
+fi
+if [ -n "$VERSION_TXT" ] && [ -f "$VERSION_TXT" ]; then
+    cp "$VERSION_TXT" resources/version.txt
+fi

This avoids accidental clobbering and makes intent unambiguous.
If the current behaviour (inline text) is desired, please add a short comment to state that, so future readers are not caught off-guard.


🏁 Script executed:

#!/bin/bash
set -e

# Locate build.sh
file=$(fd -t f build.sh | head -n1)
echo "Found build script at: $file"

# Show top of build.sh for context
echo "====== build.sh (1-150) ======"
sed -n '1,150p' "$file"

echo
echo "====== Lines around CHANGELOG_MD ======"
rg -nC3 'CHANGELOG_MD' "$file"

echo
echo "====== Lines around VERSION_TXT ======"
rg -nC3 'VERSION_TXT' "$file"

Length of output: 4259


Update build.sh to support both file paths and inline text for CHANGELOG_MD & VERSION_TXT

To avoid writing a literal filename when a path is passed, detect if the variable points to a real file—otherwise treat it as inline text.

Locations to update:

  • build.sh, around lines 77–82

Apply this diff:

- if [ -n "$CHANGELOG_MD" ]; then
-     echo "$CHANGELOG_MD" > resources/changelog.md
- fi
+ if [ -n "$CHANGELOG_MD" ]; then
+   if [ -f "$CHANGELOG_MD" ]; then
+     cp "$CHANGELOG_MD" resources/changelog.md
+   else
+     printf '%s\n' "$CHANGELOG_MD" > resources/changelog.md
+   fi
+ fi

- if [ -n "$VERSION_TXT" ]; then
-     echo "$VERSION_TXT" > resources/version.txt
- fi
+ if [ -n "$VERSION_TXT" ]; then
+   if [ -f "$VERSION_TXT" ]; then
+     cp "$VERSION_TXT" resources/version.txt
+   else
+     printf '%s\n' "$VERSION_TXT" > resources/version.txt
+   fi
+ fi

This makes intent clear and handles both long multi-line files or short inline values.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ -n "$CHANGELOG_MD" ]; then
echo "$CHANGELOG_MD" > resources/changelog.md
fi
if [ -n "$VERSION_TXT" ]; then
echo "$VERSION_TXT" > resources/version.txt
fi
if [ -n "$CHANGELOG_MD" ]; then
if [ -f "$CHANGELOG_MD" ]; then
cp "$CHANGELOG_MD" resources/changelog.md
else
printf '%s\n' "$CHANGELOG_MD" > resources/changelog.md
fi
fi
if [ -n "$VERSION_TXT" ]; then
if [ -f "$VERSION_TXT" ]; then
cp "$VERSION_TXT" resources/version.txt
else
printf '%s\n' "$VERSION_TXT" > resources/version.txt
fi
fi
🤖 Prompt for AI Agents
In build.sh around lines 77 to 82, update the handling of CHANGELOG_MD and
VERSION_TXT to check if the variable value is a path to an existing file. If it
is a file, use its contents to write to the target file; otherwise, treat the
variable as inline text and write it directly. This ensures both file paths and
inline text are supported correctly.

@github-project-automation github-project-automation Bot moved this from Triage to Development in OpenFront Release Management Jun 28, 2025
@scottanderson scottanderson added this to the v24 milestone Jun 28, 2025
@scottanderson
scottanderson marked this pull request as ready for review June 28, 2025 07:41
@scottanderson
scottanderson requested a review from a team as a code owner June 28, 2025 07:41
@scottanderson
scottanderson requested a review from evanpelle June 28, 2025 07:41
@scottanderson
scottanderson merged commit 149f922 into main Jun 28, 2025
@scottanderson
scottanderson deleted the deploy branch June 28, 2025 07:41
@github-project-automation github-project-automation Bot moved this from Development to Complete in OpenFront Release Management Jun 28, 2025
scottanderson added a commit that referenced this pull request Jun 28, 2025
## Description:

Fix missing version number and changelog in branch deploys.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
scottanderson added a commit that referenced this pull request Jul 7, 2025
## Description:

Fix missing version number and changelog in branch deploys.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

This branch was previously deployed

1 inactive deployment
staging — 8ca4f761 Deployed Jun 28, 2025 by openfrontio[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

1 participant