Skip to content

Fix version retrieval in getEnvironment method to use serverInfo#3732

Merged
nixel2007 merged 1 commit into
developfrom
fix/sentry-release-detection
Jan 4, 2026
Merged

Fix version retrieval in getEnvironment method to use serverInfo#3732
nixel2007 merged 1 commit into
developfrom
fix/sentry-release-detection

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jan 4, 2026

Copy link
Copy Markdown
Member

Описание

Связанные задачи

Closes

Чеклист

Общие

  • Ветка PR обновлена из develop
  • Отладочные, закомментированные и прочие, не имеющие смысла участки кода удалены
  • Изменения покрыты тестами
  • Обязательные действия перед коммитом выполнены (запускал команду gradlew precommit)

Для диагностик

  • Описание диагностики заполнено для обоих языков (присутствуют файлы для обоих языков, для русского заполнено все подробно, перевод на английский можно опустить)

Дополнительно

Summary by CodeRabbit

  • Refactor
    • Updated internal environment configuration handling for improved consistency with server version information.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings January 4, 2026 08:44
@nixel2007
nixel2007 merged commit 455c9cc into develop Jan 4, 2026
19 of 21 checks passed
@nixel2007
nixel2007 deleted the fix/sentry-release-detection branch January 4, 2026 08:45
@coderabbitai

coderabbitai Bot commented Jan 4, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The PR modifies SentryScopeConfigurer.java to change how the environment string is derived. The getEnvironment() method now calls serverInfo.getVersion() directly instead of getVersion(), eliminating the "bsl-language-server@" prefix logic.

Changes

Cohort / File(s) Summary
Sentry Environment Configuration
src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java
Modified getEnvironment() method to use serverInfo.getVersion() instead of getVersion(), removing the "bsl-language-server@" prefix application in environment string derivation

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Poem

🐰 A version string, once dressed in prefix fine,
Now hops direct to Sentry's design,
Raw and true, no decoration worn,
Environment configured, cleanly born!

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e74fae3 and 9f2b23d.

📒 Files selected for processing (1)
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java

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.

Copilot AI 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.

Pull request overview

This PR fixes a bug in the SentryScopeConfigurer class where the getEnvironment() method was incorrectly using the getVersion() method, which returns a version string prefixed with "bsl-language-server@". This prefix caused the regex patterns used for environment classification to fail, preventing proper categorization of versions as production, pre-release, develop, or feature.

Key Changes:

  • Changed getEnvironment() to call serverInfo.getVersion() directly instead of the internal getVersion() method, ensuring the raw version string is used for regex matching
Comments suppressed due to low confidence (1)

src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java:96

  • The change to use serverInfo.getVersion() directly is correct and fixes a bug where the environment classification logic would fail to match version patterns due to the "bsl-language-server@" prefix. However, this logic lacks test coverage. Consider adding unit tests for the getEnvironment() method to verify it correctly classifies versions as "production", "pre-release", "develop", or "feature" based on version string patterns.
  private String getEnvironment() {
    String version = serverInfo.getVersion();
    String environment;

    if (version.matches("\\d+\\.\\d+\\.\\d+")) {
      environment = "production";
    } else if (version.matches("\\d+\\.\\d+\\.\\d+-r[ca]\\d+")) {
      environment = "pre-release";
    } else if (version.startsWith("develop-") && !version.contains("-DIRTY-")) {
      environment = "develop";
    } else {
      environment = "feature";
    }
    return environment;
  }

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