Skip to content

Move version and changelog to files - #1109

Merged
evanpelle merged 6 commits into
mainfrom
version
Jun 10, 2025
Merged

evanpelle merged 6 commits into
mainfrom
version

Conversation

@scottanderson

@scottanderson scottanderson commented Jun 9, 2025 •

Copy link
Copy Markdown
Contributor

Description:

Move these assets to files so that they can be replaced with generated assets in the future.

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 9, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes introduce dynamic loading of the game version and changelog via new resource files and client logic. The header now displays a version fetched at runtime. The news modal content is rendered from markdown, replacing hardcoded HTML. The Dockerfile and dependencies are updated for reproducible builds and markdown support.

Changes

File(s) Change Summary
Dockerfile Updated to quote GIT_COMMIT value and use npm ci for clean installs.
src/client/Main.ts Loads version and changelog dynamically; updates UI based on fetched resources.
src/client/index.html Replaces static version with a div showing "Loading version..." for dynamic update.
package.json Adds lit-markdown as a new dependency.
resources/changelog.md, resources/version.txt Adds new files for changelog (markdown) and version identifier (text).
src/client/NewsModal.ts News modal now renders markdown from a property instead of static HTML content.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Client (Main.ts)
    participant Server
    participant NewsModal

    User->>Client (Main.ts): Loads page
    Client (Main.ts)->>Server: Fetch /version.txt
    Server-->>Client (Main.ts): Returns version string
    Client (Main.ts)->>index.html: Updates #game-version text

    Client (Main.ts)->>Server: Fetch /changelog.md
    Server-->>Client (Main.ts): Returns changelog markdown
    Client (Main.ts)->>NewsModal: Sets markdown property
    NewsModal->>NewsModal: Renders markdown content
Loading

Poem

The version now loads with a flicker and gleam,
Markdown in modals—no more static dream!
Changelog appears, fresh from the file,
Dynamic and tidy, in idiomatic style.
With clean installs and quotes in place,
The code moves forward—at a brisk, steady pace!
🚀

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-06-09T07_37_48_904Z-debug-0.log


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4336f8c and 4b23488.

📒 Files selected for processing (2)
  • Dockerfile (3 hunks)
  • src/client/Main.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Dockerfile
  • src/client/Main.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Deploy to openfront.dev

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.

@scottanderson scottanderson moved this from Triage to Development in OpenFront Release Management Jun 9, 2025
@scottanderson scottanderson self-assigned this Jun 9, 2025

@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: 6

🧹 Nitpick comments (3)
Dockerfile (3)

26-31: Document purpose of GAME_CHANGELOG and GAME_VERSION build args
Add a brief comment above these ARG/ENV lines explaining why we’re embedding changelog and version into the image. This will help future maintainers understand their usage.


42-42: Clarify the .git directory hack
Why is an empty .git folder created before npm ci? Please add a comment or remove this step if it’s no longer needed.


52-54: Combine RUN steps to reduce layers
You can merge the three echo commands into one RUN block to keep the image lean:

- RUN echo "$GIT_COMMIT" > static/commit.txt
- RUN echo "$GAME_CHANGELOG" > static/changelog.txt
- RUN echo "$GAME_VERSION" > static/version.txt
+ RUN \
+   echo "$GIT_COMMIT"       > static/commit.txt && \
+   echo "$GAME_CHANGELOG"   > static/changelog.txt && \
+   echo "$GAME_VERSION"     > static/version.txt
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 40cd223 and 686a0e1.

📒 Files selected for processing (6)
  • .github/workflows/deploy.yml (1 hunks)
  • Dockerfile (3 hunks)
  • deploy.sh (1 hunks)
  • src/client/Main.ts (1 hunks)
  • src/client/index.html (1 hunks)
  • webpack.config.js (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/client/Main.ts (1)
webpack.config.js (1)
  • gameVersion (14-15)
🪛 GitHub Actions: 🧪 CI
webpack.config.js

[error] 15-15: Build failed: Command 'git describe --tags' failed with fatal error 'No names found, cannot describe anything.' causing webpack config load failure.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Deploy to openfront.dev
🔇 Additional comments (1)
webpack.config.js (1)

127-127: Approve injection of GAME_VERSION into client bundle
Good use of DefinePlugin to expose process.env.GAME_VERSION to the client code.

Comment thread src/client/index.html
Comment on lines +206 to +208
<div id="game-version" class="l-header__highlightText">
Loading version...
</div>

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.

🛠️ Refactor suggestion

⚠️ Potential issue

Wrap placeholder text in translation and add ARIA live region
The hardcoded “Loading version...” must go through translateText() (e.g. via data-i18n) to support i18n, and you should add aria-live="polite" so screen readers announce the version update:

<div id="game-version" class="l-header__highlightText" data-i18n="main.loading_version" aria-live="polite">
  <!-- translated at runtime -->
</div>

Add main.loading_version to en.json.

🤖 Prompt for AI Agents
In src/client/index.html around lines 206 to 208, the placeholder text "Loading
version..." is hardcoded and not internationalized. Replace the text with an
empty div that uses the attribute data-i18n="main.loading_version" to enable
translation via translateText(), and add aria-live="polite" to the div to ensure
screen readers announce updates. Additionally, add the key
"main.loading_version" with the appropriate translation string to the en.json
localization file.

Comment thread .github/workflows/deploy.yml Outdated
VERSION_TAG: latest
run: |
echo "::group::deploy.sh"
git fetch --filter=tree:0 --prune --unshallow

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.

🛠️ Refactor suggestion

Use checkout with full history instead of manual git fetch
Instead of running git fetch later, set fetch-depth: 0 on the actions/checkout step to pull all tags and history up front:

- uses: actions/checkout@v4
  with:
    fetch-depth: 0

This removes the need for manual unshallowing.

🤖 Prompt for AI Agents
In .github/workflows/deploy.yml at line 129, the manual git fetch command with
unshallowing is used to get full history. Replace this by setting fetch-depth: 0
in the actions/checkout step earlier in the workflow to fetch the entire git
history and tags upfront, eliminating the need for the manual git fetch command.

Comment thread deploy.sh Outdated
Comment on lines 151 to 152
--build-arg GAME_VERSION=$GAME_VERSION \
--build-arg GIT_COMMIT=$GIT_COMMIT \

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.

⚠️ Potential issue

Pass GAME_CHANGELOG or remove unused arg
The Dockerfile expects --build-arg GAME_CHANGELOG, but this script never sets it. Either compute and pass GAME_CHANGELOG here or drop that build arg from the Dockerfile.

🤖 Prompt for AI Agents
In deploy.sh around lines 151 to 152, the script passes build arguments
GAME_VERSION and GIT_COMMIT but does not set or pass GAME_CHANGELOG, which the
Dockerfile expects. To fix this, either compute the GAME_CHANGELOG value in the
script and add it as a build argument like --build-arg
GAME_CHANGELOG=$GAME_CHANGELOG, or if GAME_CHANGELOG is not needed, remove the
corresponding build-arg line from the Dockerfile to avoid passing an unset
argument.

Comment thread deploy.sh Outdated
Comment on lines +141 to +144
# Get game version for build info
GAME_VERSION=$(git describe --tags)
echo "Game version: $GAME_VERSION"

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.

⚠️ Potential issue

Guard against missing tags and handle failures
git describe --tags will crash if no tags are present. Wrap it to fallback gracefully and/or use --always:

- GAME_VERSION=$(git describe --tags)
+ GAME_VERSION=$(git describe --tags --always 2>/dev/null || echo "unknown")

Also consider adding or removing GAME_CHANGELOG if it’s not being set.

📝 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
# Get game version for build info
GAME_VERSION=$(git describe --tags)
echo "Game version: $GAME_VERSION"
# Get game version for build info
- GAME_VERSION=$(git describe --tags)
+ GAME_VERSION=$(git describe --tags --always 2>/dev/null || echo "unknown")
echo "Game version: $GAME_VERSION"
🤖 Prompt for AI Agents
In deploy.sh around lines 141 to 144, the command `git describe --tags` can fail
if no tags exist, causing the script to crash. Modify the command to use `git
describe --tags --always` to ensure it returns a value even without tags.
Additionally, add error handling to fallback gracefully if the command fails.
Review the usage of `GAME_CHANGELOG` and remove or set it appropriately if it is
not currently handled.

Comment thread webpack.config.js Outdated
Comment on lines 14 to 16
const gameVersion =
process.env.GAME_VERSION ?? execSync("git describe --tags").toString().trim();

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.

🛠️ Refactor suggestion

⚠️ Potential issue

Add fallback for git describe in webpack config
execSync("git describe --tags") will throw if no tags exist and break the build. Wrap the call in a try/catch or use --always and default to "unknown":

- const gameVersion =
-   process.env.GAME_VERSION ?? execSync("git describe --tags").toString().trim();
+ let gameVersion = process.env.GAME_VERSION;
+ if (!gameVersion) {
+   try {
+     gameVersion = execSync("git describe --tags --always").toString().trim();
+   } catch {
+     gameVersion = "unknown";
+   }
+ }
📝 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
const gameVersion =
process.env.GAME_VERSION ?? execSync("git describe --tags").toString().trim();
let gameVersion = process.env.GAME_VERSION;
if (!gameVersion) {
try {
gameVersion = execSync("git describe --tags --always").toString().trim();
} catch {
gameVersion = "unknown";
}
}
🧰 Tools
🪛 GitHub Actions: 🧪 CI

[error] 15-15: Build failed: Command 'git describe --tags' failed with fatal error 'No names found, cannot describe anything.' causing webpack config load failure.

🤖 Prompt for AI Agents
In webpack.config.js around lines 14 to 16, the call to execSync("git describe
--tags") can throw an error if no git tags exist, causing the build to break. To
fix this, wrap the execSync call in a try/catch block or modify the command to
use "git describe --tags --always" and provide a default fallback value like
"unknown" if the command fails or returns empty. This will ensure the build does
not break due to missing git tags.

Comment thread src/client/Main.ts Outdated
Comment on lines +62 to +74
const gameVersion = document.getElementById(
"game-version",
) as HTMLDivElement;
if (!gameVersion) {
console.warn("Game version element not found");
}
fetch("/version.txt")
.then((response) => {
return response.ok ? response.text() : "Failed to load version";
})
.then((version) => {
gameVersion.innerText = version;
});

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.

⚠️ Potential issue

Fix null pointer bug and improve error handling.

The code checks if gameVersion is null but still tries to use it in the .then() block. This will cause a runtime error if the element doesn't exist.

Also, the fetch error handling only covers HTTP errors but not network failures.

Apply this diff to fix the issues:

-const gameVersion = document.getElementById(
-  "game-version",
-) as HTMLDivElement;
-if (!gameVersion) {
-  console.warn("Game version element not found");
-}
-fetch("/version.txt")
-  .then((response) => {
-    return response.ok ? response.text() : "Failed to load version";
-  })
-  .then((version) => {
-    gameVersion.innerText = version;
-  });
+const gameVersion = document.getElementById(
+  "game-version",
+) as HTMLDivElement;
+if (!gameVersion) {
+  console.warn("Game version element not found");
+  return;
+}
+
+fetch("/version.txt")
+  .then((response) => {
+    if (!response.ok) {
+      throw new Error(`HTTP ${response.status}`);
+    }
+    return response.text();
+  })
+  .then((version) => {
+    gameVersion.innerText = version;
+  })
+  .catch((error) => {
+    console.warn("Failed to load version:", error);
+    gameVersion.innerText = "Failed to load version";
+  });
📝 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
const gameVersion = document.getElementById(
"game-version",
) as HTMLDivElement;
if (!gameVersion) {
console.warn("Game version element not found");
}
fetch("/version.txt")
.then((response) => {
return response.ok ? response.text() : "Failed to load version";
})
.then((version) => {
gameVersion.innerText = version;
});
const gameVersion = document.getElementById(
"game-version",
) as HTMLDivElement;
if (!gameVersion) {
console.warn("Game version element not found");
return;
}
fetch("/version.txt")
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.text();
})
.then((version) => {
gameVersion.innerText = version;
})
.catch((error) => {
console.warn("Failed to load version:", error);
gameVersion.innerText = "Failed to load version";
});
🤖 Prompt for AI Agents
In src/client/Main.ts around lines 62 to 74, the code checks if the gameVersion
element exists but still uses it without guarding against null, causing a
potential runtime error. To fix this, add a return or conditional to avoid using
gameVersion if it is null. Also, improve fetch error handling by adding a
.catch() block to handle network failures and log or handle those errors
appropriately.

@scottanderson scottanderson changed the title Generate game version from git tags Move version and changelog to resources Jun 9, 2025
@scottanderson scottanderson changed the title Move version and changelog to resources Move version and changelog to files Jun 9, 2025

@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

🧹 Nitpick comments (2)
src/client/NewsModal.ts (2)

2-2: Consider if the markdown library is necessary.

Adding lit-markdown introduces a new dependency. For simple news content, basic HTML might be enough. If markdown is required, ensure this library is the best choice for the project.

Alternative approach using template literals for simple formatting:

-import { resolveMarkdown } from "lit-markdown";

Then in the render method, use simple HTML templates instead of markdown processing.


15-15: Use lowercase primitive type.

TypeScript style guide recommends using lowercase string instead of String for primitive types.

-  @property({ type: String }) markdown = "Loading...";
+  @property({ type: String }) markdown: string = "Loading...";
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f446d70 and 4336f8c.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • Dockerfile (3 hunks)
  • package.json (1 hunks)
  • resources/changelog.md (1 hunks)
  • resources/version.txt (1 hunks)
  • src/client/Main.ts (2 hunks)
  • src/client/NewsModal.ts (3 hunks)
✅ Files skipped from review due to trivial changes (3)
  • package.json
  • resources/version.txt
  • resources/changelog.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • Dockerfile
  • src/client/Main.ts

Comment thread src/client/NewsModal.ts
Comment on lines +57 to +60
${resolveMarkdown(this.markdown, {
includeImages: true,
includeCodeBlockClassNames: true,
})}

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.

⚠️ Potential issue

Add security measures and error handling for markdown rendering.

Enabling images and code blocks in markdown can create security risks. Consider these concerns:

  1. Security: Images can be used for tracking or XSS attacks
  2. Performance: External images can slow down the modal
  3. Error handling: No fallback if markdown parsing fails

Consider this safer approach:

-                ${resolveMarkdown(this.markdown, {
-                  includeImages: true,
-                  includeCodeBlockClassNames: true,
-                })}
+                ${this.renderSafeMarkdown()}

Add a helper method:

private renderSafeMarkdown() {
  try {
    return resolveMarkdown(this.markdown, {
      includeImages: false, // Disable for security
      includeCodeBlockClassNames: false, // Disable unless needed
    });
  } catch (error) {
    console.error('Markdown rendering failed:', error);
    return html`<p>Failed to load content. Please try again.</p>`;
  }
}
🤖 Prompt for AI Agents
In src/client/NewsModal.ts around lines 57 to 60, the current markdown rendering
enables images and code block class names without error handling, which poses
security and performance risks. Refactor by creating a helper method that
disables image inclusion and code block class names for safety, wraps the
markdown rendering in a try-catch block to handle errors gracefully, logs any
rendering errors, and returns a fallback HTML message if rendering fails.
Replace the direct call to resolveMarkdown with this new safe rendering method.

@scottanderson
scottanderson marked this pull request as ready for review June 9, 2025 07:35
@scottanderson
scottanderson requested a review from a team as a code owner June 9, 2025 07:35
@scottanderson
scottanderson requested a review from evanpelle June 9, 2025 07:35

@evanpelle evanpelle left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

@evanpelle
evanpelle merged commit 790b052 into main Jun 10, 2025
@evanpelle
evanpelle deleted the version branch June 10, 2025 17:07
@github-project-automation github-project-automation Bot moved this from Development to Complete in OpenFront Release Management Jun 10, 2025
evanpelle pushed a commit that referenced this pull request Jun 10, 2025
## Description:

Move these assets to files so that they can be replaced with generated
assets in the future.

## 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

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
its-sii pushed a commit to its-sii/OpenFrontIO-fork that referenced this pull request Jun 12, 2025
## Description:

Move these assets to files so that they can be replaced with generated
assets in the future.

## 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

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
ghisloufou pushed a commit to ghisloufou/OpenFrontIO that referenced this pull request Jun 14, 2025
## Description:

Move these assets to files so that they can be replaced with generated
assets in the future.

## 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

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Jun 17, 2025
5 tasks done
scottanderson added a commit that referenced this pull request Jun 28, 2025
Move these assets to files so that they can be replaced with generated
assets in the future.

- [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

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
scottanderson added a commit that referenced this pull request Jul 7, 2025
Move these assets to files so that they can be replaced with generated
assets in the future.

- [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

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
@coderabbitai coderabbitai Bot mentioned this pull request Aug 3, 2025
4 of 5 tasks
Celant added a commit that referenced this pull request Nov 6, 2026
… did (#6287)

Client half of the stacked-gift work. The server side is in
openfrontio/infra#1107, #1108 and #1109, and this needs those deployed
to show anything new. On an older API it falls back to `subscription`
and behaves as it does today.

A player can now hold a paid subscription and a free one at once. A
Steam purchase at or below the paid tier moves the next payment back
instead of granting a month. This PR makes each outcome explain itself,
so nobody has to open a ticket to find out what happened.

## What changes

- **Account modal.** It shows a tile for each subscription when there
are two. The paid tile is never hidden behind the gift.
  - Paid tile: "Steam Plus · next payment 23 Nov · $4.99/mo"
- Gift tile: "Sovereign from your Steam purchase · ends 23 Dec · 25
plutonium a day"
- A moved payment reads "Next payment 23 Dec (free month from the Deluxe
Edition)". A past-due paid sub is no longer hidden behind a gift.
- **Notices on boot.** These go through the existing `BootInterrupts`
ordering:
- **Stacked welcome:** "Thanks for your Steam purchase. You've got
Sovereign until 23 Dec, on top of your Steam Plus, so that's an extra 25
plutonium a day. Your Steam Plus still renews on 23 Nov as normal."
- **Renewal moved** (the new `renewal_pushed` server message): "You
already have Sovereign, so the Deluxe Edition gives you a free month
instead. Your next payment is on 23 Dec." It is marked seen the way
`report_thanks` is.
- **Gift ending in 3 days:** "Your Sovereign month ends on 23 Dec. After
that you'll be back on Steam Plus." Without a paid sub it says
"Subscribe to keep your perks." It shows once per end date.
- **Subscribing over a gift.**
  - A higher gift: "You'll keep your Sovereign until 23 Dec as well."
- A same or lower gift: "You pay for the first month today. You've still
got 12 free days, so your next payment moves 12 days later." This now
holds on both rails, so the Stripe "the days are not refunded" copy is
gone.
- Tier changes and the "Subscribed" marking in the store follow the paid
row.

## Known gap

A gift row doesn't say which Steam product funded it, so the stacked
welcome and the gift tile say "your Steam purchase" rather than naming
the Deluxe Edition. The moved-payment copy can name the product, because
the server sends `renewalPushedBy`. Naming the product on a gift row
needs a small server field, which can follow.

## Tests

Typecheck, lint, oxfmt and `test:changed` pass (5390 tests). There are
new cases in BootInterrupts, SteamGrantNotices, SteamNotices,
SubscriptionPanel, GrantedSubscriptionPurchase and ApiSchemas.

Screenshots will follow from the preview deploy once the infra PRs are
on staging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Celant added a commit that referenced this pull request Nov 6, 2026
… did (#6287)

Client half of the stacked-gift work. The server side is in
openfrontio/infra#1107, #1108 and #1109, and this needs those deployed
to show anything new. On an older API it falls back to `subscription`
and behaves as it does today.

A player can now hold a paid subscription and a free one at once. A
Steam purchase at or below the paid tier moves the next payment back
instead of granting a month. This PR makes each outcome explain itself,
so nobody has to open a ticket to find out what happened.

- **Account modal.** It shows a tile for each subscription when there
are two. The paid tile is never hidden behind the gift.
  - Paid tile: "Steam Plus · next payment 23 Nov · $4.99/mo"
- Gift tile: "Sovereign from your Steam purchase · ends 23 Dec · 25
plutonium a day"
- A moved payment reads "Next payment 23 Dec (free month from the Deluxe
Edition)". A past-due paid sub is no longer hidden behind a gift.
- **Notices on boot.** These go through the existing `BootInterrupts`
ordering:
- **Stacked welcome:** "Thanks for your Steam purchase. You've got
Sovereign until 23 Dec, on top of your Steam Plus, so that's an extra 25
plutonium a day. Your Steam Plus still renews on 23 Nov as normal."
- **Renewal moved** (the new `renewal_pushed` server message): "You
already have Sovereign, so the Deluxe Edition gives you a free month
instead. Your next payment is on 23 Dec." It is marked seen the way
`report_thanks` is.
- **Gift ending in 3 days:** "Your Sovereign month ends on 23 Dec. After
that you'll be back on Steam Plus." Without a paid sub it says
"Subscribe to keep your perks." It shows once per end date.
- **Subscribing over a gift.**
  - A higher gift: "You'll keep your Sovereign until 23 Dec as well."
- A same or lower gift: "You pay for the first month today. You've still
got 12 free days, so your next payment moves 12 days later." This now
holds on both rails, so the Stripe "the days are not refunded" copy is
gone.
- Tier changes and the "Subscribed" marking in the store follow the paid
row.

A gift row doesn't say which Steam product funded it, so the stacked
welcome and the gift tile say "your Steam purchase" rather than naming
the Deluxe Edition. The moved-payment copy can name the product, because
the server sends `renewalPushedBy`. Naming the product on a gift row
needs a small server field, which can follow.

Typecheck, lint, oxfmt and `test:changed` pass (5390 tests). There are
new cases in BootInterrupts, SteamGrantNotices, SteamNotices,
SubscriptionPanel, GrantedSubscriptionPurchase and ApiSchemas.

Screenshots will follow from the preview deploy once the infra PRs are
on staging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8ed9d42)

Conflicts resolved for v35 by Claude.

This branch was previously deployed

1 inactive deployment
staging — 4b234881 Deployed Jun 9, 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.

2 participants