Skip to content

Conversation

johnou
Copy link

@johnou johnou commented Oct 5, 2025

Changes

Follow up on #106 fix formatting + add unit test.

Checklist

  • Read the contribution guide and accept the code of conduct
  • Readme (updated or not needed)
  • Tests (added, updated or not needed)

Summary by CodeRabbit

  • New Features

    • Added support for Unity image versions in the 6000.x.x series.
    • Tightened version validation to require full-pattern matches, improving reliability.
    • More explicit error messages for invalid version formats.
  • Tests

    • Added tests validating acceptance of “6000.0.0f0”.
    • Added tests ensuring invalid versions such as “1999.1.1f1” and “6000.1.invalid” are rejected with clear errors.

Copy link

coderabbitai bot commented Oct 5, 2025

Walkthrough

The version validation pattern in src/model/image-tag.ts now accepts versions starting with 6000.x and uses full-string anchoring. Corresponding tests in src/model/image-tag.test.ts were added to cover valid 6000.0.0f0 and new invalid cases, ensuring the constructor throws with the specific error message for bad versions.

Changes

Cohort / File(s) Summary
Model: Image tag validation
src/model/image-tag.ts
Updated versionPattern to `^(20\d{2}\.\d\.\w{3,4}
Tests: Image tag validation
src/model/image-tag.test.ts
Added tests accepting 6000.0.0f0; added invalid cases 1999.1.1f1 and 6000.1.invalid expecting specific error messages.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Dev as Caller
  participant IT as ImageTag
  participant VP as versionPattern

  Dev->>IT: new ImageTag(version)
  IT->>VP: Test version against /^(20\d{2}\.\d\.\w{3,4}|6000\.\d\.\w{3,4})$/
  alt Match (e.g., 2021.x or 6000.x)
    IT-->>Dev: Constructed instance
  else No match (e.g., 1999.1.1f1, 6000.1.invalid)
    IT-->>Dev: Throw Error("Invalid version \"${version}\".")
  end

  note over VP: New accepted major: 6000.x<br/>Anchors enforce full-string match
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

A hop, a skip, a regex tight,
Now 6000.x is set to flight.
Old dates denied, the checks align,
Anchors hold the version line.
Thump-thump! says QA in delight—
Carrots for code that validates right. 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The PR title includes the word “Draft:” and refers to “Unity 6.x,” which adds noise and doesn’t accurately reflect the change of adding support for the “6000.x” version format in the validation logic, so it fails to clearly summarize the main update. Please remove the “Draft:” prefix and revise the title to something concise and precise, for example “Support Unity 6000.x version in image-tag validation.”
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed The pull request description follows the required template by including the "Changes" and "Checklist" sections and provides a concise summary of formatting fixes and unit test additions while marking all checklist items, fulfilling the template requirements.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80a5195 and 19bd442.

📒 Files selected for processing (2)
  • src/model/image-tag.test.ts (1 hunks)
  • src/model/image-tag.ts (1 hunks)
🧰 Additional context used
🪛 ESLint
src/model/image-tag.test.ts

[error] 11-11: Replace 'accepts·%p·version·format', with ⏎······'accepts·%p·version·format',⏎·····

(prettier/prettier)


[error] 12-12: Insert ··

(prettier/prettier)


[error] 13-13: Replace } with ··},⏎····

(prettier/prettier)


[error] 16-16: English text in string literals is not allowed

(i18n-text/no-en)

🔇 Additional comments (1)
src/model/image-tag.ts (1)

30-30: Verify Unity minor version range. No multi-digit minor versions detected; if Unity allows minors ≥10 (e.g., 2022.10.0f0), update the regex to use \d+ for the minor segment:

return /^(20\d{2}\.\d+\.\w{3,4}|6000\.\d+\.\w{3,4})$/;

Comment on lines +11 to 13
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
expect(() => new ImageTag(version)).not.toThrow();
});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Fix formatting to comply with Prettier.

The test logic correctly validates the new Unity 6000.x version format alongside existing formats.

Apply this diff to fix the Prettier formatting issues:

-    test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
+    test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])(
+      'accepts %p version format',
+      (version) => {
-      expect(() => new ImageTag(version)).not.toThrow();
-    });
+        expect(() => new ImageTag(version)).not.toThrow();
+      },
+    );
📝 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
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])('accepts %p version format', (version) => {
expect(() => new ImageTag(version)).not.toThrow();
});
test.each(['2000.0.0f0', '2011.1.11f1', '6000.0.0f0'])(
'accepts %p version format',
(version) => {
expect(() => new ImageTag(version)).not.toThrow();
},
);
🧰 Tools
🪛 ESLint

[error] 11-11: Replace 'accepts·%p·version·format', with ⏎······'accepts·%p·version·format',⏎·····

(prettier/prettier)


[error] 12-12: Insert ··

(prettier/prettier)


[error] 13-13: Replace } with ··},⏎····

(prettier/prettier)

🤖 Prompt for AI Agents
In src/model/image-tag.test.ts around lines 11 to 13, the test block has
Prettier formatting violations; reformat the test.each invocation to comply with
the project's Prettier rules (apply proper indentation, spacing and trailing
commas as configured) — either run Prettier on this file or manually adjust
whitespace so the array, callback, and expect line match the repository style,
then save the file.

Comment on lines +15 to +17
test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
});
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Address i18n linting and formatting.

The test cases correctly validate that invalid version formats are rejected with the appropriate error message.

Apply this diff to fix the formatting and address the i18n linting warning:

-    test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
-      expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
-    });
+    test.each(['1999.1.1f1', '6000.1.invalid'])(
+      'rejects %p version format',
+      (version) => {
+        // eslint-disable-next-line i18n-text/no-en
+        expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
+      },
+    );

Alternatively, if test files should be excluded from i18n linting, update the ESLint configuration to exclude test files from this rule.

📝 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
test.each(['1999.1.1f1', '6000.1.invalid'])('rejects %p version format', (version) => {
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
});
test.each(['1999.1.1f1', '6000.1.invalid'])(
'rejects %p version format',
(version) => {
// eslint-disable-next-line i18n-text/no-en
expect(() => new ImageTag(version)).toThrow(`Invalid version "${version}".`);
},
);
🧰 Tools
🪛 ESLint

[error] 16-16: English text in string literals is not allowed

(i18n-text/no-en)

@johnou
Copy link
Author

johnou commented Oct 5, 2025

@webbertakken fyi I didn't commit changes to dist, should be done by maintainer for security reasons.

@johnou johnou changed the title Support Unity 6.x Draft: Support Unity 6.x Oct 5, 2025
@johnou
Copy link
Author

johnou commented Oct 5, 2025

dockerRepoVersion is now 3?

@webbertakken
Copy link
Member

We don't have the rule that this should be done by the maintainers. Please feel free to follow the normal flow.

Docker repo can be found here: https://github.com/game-ci/docker/releases

@johnou
Copy link
Author

johnou commented Oct 6, 2025

Thanks for the reply, just found out that game-ci/unity-builder handles all the license management. Will close this for now.

@johnou johnou closed this Oct 6, 2025
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