Skip to content

Conversation

@WSXYT
Copy link
Collaborator

@WSXYT WSXYT commented Jan 11, 2026

This pull request refines the initialization of Sentry in main.py to ensure error reporting is only enabled in development environments. The main change is that Sentry is now initialized only when the version number indicates a development build (contains 0.0.0), instead of always being set up with an environment variable.

Error reporting environment handling:

  • Sentry initialization now occurs only if VERSION contains 0.0.0, restricting error reporting to development builds and preventing it from running in production.
  • The explicit environment parameter is removed from the Sentry setup, simplifying the configuration and relying solely on the version check.

Copilot AI review requested due to automatic review settings January 11, 2026 07:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modifies Sentry error reporting initialization to restrict it to development builds only. The change wraps Sentry initialization in a conditional check that only executes when the VERSION contains "0.0.0", and removes the explicit environment parameter from the Sentry configuration.

Changes:

  • Sentry initialization is now conditional based on VERSION containing "0.0.0" (development builds only)
  • Removed the environment variable and parameter from Sentry configuration
  • Updated code comment to reflect development-only initialization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +41 to +42
# 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry
if "0.0.0" in VERSION:
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

The comment states "仅在开发环境(版本号包含 0.0.0)下初始化 Sentry" (Only initialize Sentry in development environment when version contains 0.0.0). While this accurately describes the code, it contradicts standard error monitoring practices where Sentry should be enabled in production to track real-world errors. The PR title "开发环境不上报,上报版本信息" (Development environment does not report, report version information) and the comment suggest intentionally disabling production error reporting, which may not be the desired behavior for effective error monitoring.

Suggested change
# 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry
if "0.0.0" in VERSION:
# 在非开发环境(版本号不包含 0.0.0)下初始化 Sentry
if "0.0.0" not in VERSION:

Copilot uses AI. Check for mistakes.
Comment on lines +41 to +42
# 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry
if "0.0.0" in VERSION:
Copy link

Copilot AI Jan 11, 2026

Choose a reason for hiding this comment

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

The logic here appears to be inverted. The code now only initializes Sentry when VERSION contains "0.0.0" (development builds), which means error reporting will NOT be active in production builds. Typically, error monitoring systems like Sentry are most valuable in production environments where you need to track real user-facing errors. The condition should likely be inverted to if "0.0.0" not in VERSION: to enable Sentry only in production, or the conditional should be removed entirely to enable it in both environments with different configurations.

Suggested change
# 仅在开发环境(版本号包含 0.0.0)下初始化 Sentry
if "0.0.0" in VERSION:
# 在非开发环境(版本号不包含 0.0.0)下初始化 Sentry
if "0.0.0" not in VERSION:

Copilot uses AI. Check for mistakes.
@lzy98276 lzy98276 merged commit fadab88 into SECTL:master Jan 11, 2026
11 of 13 checks passed
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