Skip to content

fix: resolve AstrBot runtime version from package metadata#143

Merged
zouyonghe merged 1 commit into
AstrBotDevs:mainfrom
zouyonghe:fix/runtime-version-tag-compat
Jun 26, 2026
Merged

fix: resolve AstrBot runtime version from package metadata#143
zouyonghe merged 1 commit into
AstrBotDevs:mainfrom
zouyonghe:fix/runtime-version-tag-compat

Conversation

@zouyonghe

@zouyonghe zouyonghe commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

  • support AstrBot tags where default.py assigns VERSION from astrbot.version
  • keep the existing static VERSION parser for tags that define VERSION directly
  • add regression coverage for VERSION = version

Why

The Build Desktop Tauri workflow now reaches prepare:resources for v4.26.1, but AstrBot v4.26.1 uses VERSION = version in astrbot/core/config/default.py. The existing parser only accepted quoted static VERSION values and failed before resource builds.

Validation

  • pnpm run test:prepare-resources
  • node --input-type=module -e "import { validateAstrbotRuntimeVersion } from './scripts/prepare-resources/version-sync.mjs'; await validateAstrbotRuntimeVersion({ sourceDir: '/var/folders/cw/k87qlccd33n262h66_dpbhl80000gn/T/opencode/astrbot-v4.26.1', expectedVersion: '4.26.1' }); console.log('runtime version ok');"

Co-Authored-By: Warp agent@warp.dev

Summary by Sourcery

Improve AstrBot runtime version resolution to support both static VERSION definitions and versions sourced from the package metadata.

Bug Fixes:

  • Ensure AstrBot runtime VERSION can be resolved when default.py assigns VERSION = version instead of a static string.

Tests:

  • Add regression test coverage for resolving VERSION from the AstrBot package version alongside existing static VERSION handling.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@zouyonghe zouyonghe merged commit 689d2e4 into AstrBotDevs:main Jun 26, 2026
4 checks passed

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request introduces support for resolving the AstrBot runtime version when it is dynamically assigned from the package's version in astrbot/init.py rather than being a static string. It also updates the test suite to cover this new behavior. The feedback suggests enhancing the regular expression used to detect this assignment so that it optionally supports the astrbot. prefix (e.g., VERSION = astrbot.version), ensuring robust matching.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

const content = await readFile(defaultConfigPath, 'utf8');
const match = /^\s*VERSION\s*=\s*["']([^"']+)["']\s*(?:#.*)?$/m.exec(content);
if (!match) {
if (/^\s*VERSION\s*=\s*__version__\s*(?:#.*)?$/m.test(content)) {

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.

medium

The PR description mentions supporting cases where default.py assigns VERSION from astrbot.__version__. However, the current regular expression only matches __version__ directly. To fully support both VERSION = __version__ and VERSION = astrbot.__version__ as described, we should make the astrbot. prefix optional in the regex.

Suggested change
if (/^\s*VERSION\s*=\s*__version__\s*(?:#.*)?$/m.test(content)) {
if (/^\s*VERSION\s*=\s*(?:astrbot\.)?__version__\s*(?:#.*)?$/m.test(content)) {

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.

1 participant