Skip to content

Conversation

@jsonify
Copy link
Owner

@jsonify jsonify commented Jul 24, 2025

Enhance the error handling mechanism during user authentication to provide clearer feedback and improve user experience.

Enhance the error handling mechanism during user authentication to provide clearer feedback and improve user experience.
@jsonify jsonify merged commit 0b157f7 into main Jul 24, 2025
3 of 4 checks passed
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @jsonify, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a comprehensive automated version management system for the ClickIt application. It establishes GitHub release tags as the single source of truth for the application's version, ensuring synchronization across the Info.plist (which dictates the UI version), build processes, and release artifacts. This system includes new scripts for syncing, validating, and updating versions, as well as integrating these checks into Fastlane lanes and git pre-commit hooks. It's important to note that the PR title and description (Improve error handling in user authentication) do not accurately reflect the changes implemented, which are entirely focused on versioning.

Highlights

  • Automated Version Management System: Implemented a new system where GitHub release tags serve as the single source of truth for the application's version. This ensures synchronization across the Info.plist (which dictates the UI version), build processes, and release artifacts.
  • New Versioning Scripts: Added dedicated shell scripts (sync-version-from-github.sh, validate-github-version-sync.sh, update-version.sh) to automate version synchronization, validation, and the entire release workflow, including updating Info.plist, committing, and tagging.
  • Fastlane Integration: Introduced new Fastlane lanes (validate_github_sync, sync_version_with_github) and integrated version validation and auto-sync capabilities into the existing dev lane for a more streamlined development experience.
  • Git Pre-commit Hook: Added a new pre-commit hook (.githooks/pre-commit) and an installation script (scripts/install-git-hooks.sh) to provide warnings about version mismatches before commits, promoting version consistency.
  • Build Process Enhancements: Modified build_app_unified.sh to dynamically read the application version from Info.plist and include a validation step against the latest GitHub release tag during the build process, alerting developers to potential discrepancies.
  • Info.plist Version Update: Updated the CFBundleShortVersionString in ClickIt/Info.plist from 1.2.0 to 1.4.15 as part of the versioning system setup.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@jsonify jsonify deleted the feature/version-update-sync branch July 24, 2025 11:50
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces an excellent and comprehensive version management system that automates synchronizing the project's version from GitHub releases. This is a great improvement for maintainability and ensuring version consistency. My review includes a critical fix for a typo in a script, suggestions to handle edge cases where a version might not be found, and recommendations to reduce code duplication for better long-term maintenance. I also noted that the PR title and description seem to be for a different change and could be updated to reflect this new versioning system.

/usr/libexec/PlistBuddy -c "Set CFBundleShortVersionString $NEW_VERSION" ClickIt/Info.plist

# Verify the change
UPDATED_VERSION=$(/usr/libexec/PListBuddy -c "Print CFBundleShortVersionString" ClickIt/Info.plist)
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There is a typo in the command PListBuddy. It should be PlistBuddy. This typo will cause the script to fail at this verification step.

Suggested change
UPDATED_VERSION=$(/usr/libexec/PListBuddy -c "Print CFBundleShortVersionString" ClickIt/Info.plist)
UPDATED_VERSION=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" ClickIt/Info.plist)

Comment on lines +417 to +442
# Get versions
plist_version = sh("/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClickIt/Info.plist", log: false).strip
github_tag = sh("gh release list --limit 1 --json tagName --jq '.[0].tagName'", log: false).strip
github_version = github_tag.gsub(/^v/, '')

UI.message("📋 Version Status:")
UI.message(" Info.plist (UI): #{plist_version}")
UI.message(" GitHub Release: #{github_version}")

if plist_version != github_version
UI.error("")
UI.error("❌ VERSION MISMATCH DETECTED!")
UI.error(" The UI will show v#{plist_version}")
UI.error(" But the latest release is #{github_tag}")
UI.error("")
UI.error("🔧 To fix, run: fastlane sync_version_with_github")
UI.user_error!("Version synchronization required")
else
UI.success("✅ Versions are synchronized")
UI.success(" UI will display: v#{plist_version}")
UI.success(" GitHub release: #{github_tag}")
end

rescue => exception
UI.error("❌ GitHub CLI not available or authentication failed")
raise exception
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and avoid duplicating logic, this lane could be simplified to execute the validate-github-version-sync.sh script directly. The shell script already contains all the necessary validation logic and user-friendly output.

        # Get versions
        plist_version = sh("/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClickIt/Info.plist", log: false).strip
        github_tag = sh("gh release list --limit 1 --json tagName --jq '.[0].tagName'", log: false).strip
        github_version = github_tag.gsub(/^v/, '')

        UI.message("📋 Version Status:")
        UI.message("   Info.plist (UI): #{plist_version}")
        UI.message("   GitHub Release: #{github_version}")

        if plist_version != github_version
          UI.error("")
          UI.error("❌ VERSION MISMATCH DETECTED!")
          UI.error("   The UI will show v#{plist_version}")
          UI.error("   But the latest release is #{github_tag}")
          UI.error("")
          UI.error("🔧 To fix, run: fastlane sync_version_with_github")
          UI.user_error!("Version synchronization required")
        else
          UI.success("✅ Versions are synchronized")
          UI.success("   UI will display: v#{plist_version}")
          UI.success("   GitHub release: #{github_tag}")
        end

Comment on lines +456 to +502
begin
# Try GitHub CLI first
latest_release = sh("gh release list --limit 1 --json tagName --jq '.[0].tagName'", log: false).strip
version = latest_release.gsub(/^v/, '')

UI.message("📦 Latest GitHub release: #{latest_release}")
UI.message("📝 Extracted version: #{version}")

rescue => gh_exception
# Fallback to git tags if GitHub CLI fails
UI.message("⚠️ GitHub CLI unavailable, falling back to git tags...")
begin
latest_tag = sh("git describe --tags --abbrev=0", log: false).strip
version = latest_tag.gsub(/^v/, '')
UI.message("📦 Latest git tag: #{latest_tag}")
UI.message("📝 Extracted version: #{version}")
rescue => git_exception
if options[:auto_sync]
UI.error("❌ Cannot determine latest version (GitHub CLI and git tags both failed)")
raise "Auto-sync failed: No version source available"
else
UI.error("❌ GitHub CLI not available or not authenticated")
UI.message("Install GitHub CLI: brew install gh")
UI.message("Authenticate: gh auth login")
raise gh_exception
end
end
end

# Get current Info.plist version
current_version = sh("/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClickIt/Info.plist", log: false).strip

if version != current_version
UI.message("⚠️ Version mismatch detected!")
UI.message(" Info.plist: #{current_version}")
UI.message(" Latest release/tag: #{version}")
UI.message("")
UI.message("🔧 Updating Info.plist to match latest version...")

# Update Info.plist
sh("/usr/libexec/PlistBuddy -c 'Set CFBundleShortVersionString #{version}' ClickIt/Info.plist")

UI.success("✅ Info.plist updated to v#{version}")
UI.success("🔄 UI will now display v#{version}")
else
UI.success("✅ Versions are synchronized (v#{version})")
end
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

Similar to validate_github_sync, this lane duplicates logic already present in scripts/sync-version-from-github.sh. To keep the logic centralized and easier to maintain, this lane should call the shell script instead of reimplementing the version fetching and Info.plist update logic.

        # Try GitHub CLI first
        latest_release = sh("gh release list --limit 1 --json tagName --jq '.[0].tagName'", log: false).strip
        version = latest_release.gsub(/^v/, '')

        UI.message("📦 Latest GitHub release: #{latest_release}")
        UI.message("📝 Extracted version: #{version}")

      rescue => gh_exception
        # Fallback to git tags if GitHub CLI fails
        UI.message("⚠️  GitHub CLI unavailable, falling back to git tags...")
        begin
          latest_tag = sh("git describe --tags --abbrev=0", log: false).strip
          version = latest_tag.gsub(/^v/, '')
          UI.message("📦 Latest git tag: #{latest_tag}")
          UI.message("📝 Extracted version: #{version}")
        rescue => git_exception
          if options[:auto_sync]
            UI.error("❌ Cannot determine latest version (GitHub CLI and git tags both failed)")
            raise "Auto-sync failed: No version source available"
          else
            UI.error("❌ GitHub CLI not available or not authenticated")
            UI.message("Install GitHub CLI: brew install gh")
            UI.message("Authenticate: gh auth login")
            raise gh_exception
          end
        end
      end

      # Get current Info.plist version
      current_version = sh("/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' ClickIt/Info.plist", log: false).strip

      if version != current_version
        UI.message("⚠️  Version mismatch detected!")
        UI.message("   Info.plist: #{current_version}")
        UI.message("   Latest release/tag: #{version}")
        UI.message("")
        UI.message("🔧 Updating Info.plist to match latest version...")

        # Update Info.plist
        sh("/usr/libexec/PlistBuddy -c 'Set CFBundleShortVersionString #{version}' ClickIt/Info.plist")

        UI.success("✅ Info.plist updated to v#{version}")
        UI.success("🔄 UI will now display v#{version}")
      else
        UI.success("✅ Versions are synchronized (v#{version})")
      end

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