Skip to content

fix: allocate four digits to Android monthly MICRO - #7

Merged
ygpark80 merged 1 commit into
mainfrom
fix/android-version-code-counter
Oct 15, 2026
Merged

ygpark80 merged 1 commit into
mainfrom
fix/android-version-code-counter

Conversation

@ygpark80

@ygpark80 ygpark80 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

User description

Three-component Android versions previously multiplied MICRO by 100, so 26.10.100 and 26.11.0 both produced 26110000. Pack the default YY.MM.MICRO as YYMMXXXX instead: 26.10.100 → 26100100, with MICRO 0–9999. Reject overflow, malformed values, and codes outside Google Play’s 1–2100000000 range before writing the target file. Preserve four-component packing with explicit two-digit bounds.

Document the migration constraint: the corrected mapping can lower an existing app’s code within the same month, so a release must exceed its highest already-distributed code. Do not change component counts within a version sequence or rewrite old tags. Store/device migration floors are not discoverable by oneup and have not been verified by this PR.

Add a PR Cargo gate and real CLI integration coverage using temporary Git repositories for both Gradle syntaxes, including MICRO 100, 9999, and exhausted capacity without file changes. Apply the existing Clippy suggestions needed for the strict gate; these are behavior-preserving.

Validation: cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (67 unit tests + 1 CLI integration test), cargo build, actionlint .github/workflows/ci.yml, and git diff --check all passed locally. No package release is performed by this PR.


CodeAnt-AI Description

Prevent Android version-code collisions as monthly MICRO values grow

What Changed

  • Three-component Android versions now reserve four digits for MICRO, so values such as 26.10.100 no longer overlap with the next month.
  • Invalid components and codes outside Google Play’s supported range are rejected before the Gradle file is changed. Four-component version packing remains supported with component limits.
  • Documents how to check existing distributed codes before migrating, since the corrected mapping can produce a lower code.

Impact

✅ Non-overlapping monthly Android version codes
✅ Invalid codes rejected before Gradle files change
✅ Clearer migration guidance for existing Android apps

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Map three-component CalVer to YYMMXXXX; retain four-component packing with checked component bounds and the Play versionCode limit. Document migration from the old MICRO*100 mapping.

Validate cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test (67 unit + 1 CLI integration), cargo build, and actionlint. Add the same Cargo gate to PR CI; apply existing Clippy suggestions without changing behavior.
@codeant-ai

codeant-ai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 1a33f1f Oct 15, 2026 · 10:27 10:31

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a5b074f8-6681-4a38-908e-e1f20ca5827d
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Oct 15, 2026
Comment thread src/target.rs
let code_re = Regex::new(r#"(versionCode\s*=?\s*)(\d+)"#).unwrap();
if code_re.is_match(&output) {
let code = version_code(new_version);
let code = version_code(new_version)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: version_code can fail after earlier targets were written, leaving non-Gradle files updated while this Gradle file and later targets remain unchanged.

Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Incomplete implementation

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/target.rs
**Line:** 183:183
**Comment:**
	*Incomplete Implementation: `version_code` can fail after earlier targets were written, leaving non-Gradle files updated while this Gradle file and later targets remain unchanged.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread src/target.rs
Comment on lines +247 to +248
if a > 2100 || b > 99 {
bail!("Android version components exceed versionCode capacity: {version}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: A valid YY.MICRO format pads its output to three parts, placing MICRO in b; values above 99 are then rejected as if they were months.

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Api mismatch

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** src/target.rs
**Line:** 247:248
**Comment:**
	*Api Mismatch: A valid `YY.MICRO` format pads its output to three parts, placing MICRO in `b`; values above 99 are then rejected as if they were months.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. The CLI reads the date again; crossing a month or year boundary before it runs makes the tag prefix stale and the expected version wrong.

Logic error · tests/android_version_code.rs:6-8

@codeant-ai

codeant-ai Bot commented Oct 15, 2026

Copy link
Copy Markdown

CodeAnt PR Risk: Medium Risk

  • The PR needs attention before merging because Android version-code derivation assumes component positions rather than the configured format.
  • A supported YY.MICRO format may be rejected or encoded incorrectly when MICRO exceeds 99; verify format-aware handling and add a regression test.

Assessed commit: 1a33f1ff65d9

@ygpark80
ygpark80 merged commit 9903bbf into main Oct 15, 2026
1 check passed
@ygpark80
ygpark80 deleted the fix/android-version-code-counter branch October 15, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant