Skip to content

fix(sentry): распознавать pre-release версии с точкой в rc.N#4124

Merged
nixel2007 merged 1 commit into
developfrom
fix/sentry-prerelease-environment-rc-dot
Jun 15, 2026
Merged

fix(sentry): распознавать pre-release версии с точкой в rc.N#4124
nixel2007 merged 1 commit into
developfrom
fix/sentry-prerelease-environment-rc-dot

Conversation

@nixel2007

@nixel2007 nixel2007 commented Jun 15, 2026

Copy link
Copy Markdown
Member

Проблема

В Sentry-issue BSL-LANGUAGE-SERVER-W7 событие релиза [email protected] помечено окружением feature, хотя должно быть pre-release.

Причина: SentryScopeConfigurer.getEnvironment() вычисляет environment регуляркой по строке версии. Регулярка для pre-release — \d+\.\d+\.\d+-r[ca]\d+ — ожидала формат 1.0.0-rc2 (без точки между rc и номером). Реальная semver-версия 1.0.0-rc.2 содержит точку, поэтому не матчилась, проваливалась до else и получала feature.

GitHub-маркировка тега как pre-release на это вычисление не влияет — environment зависит только от строки версии.

Изменения

  • Разрешена необязательная точка в регулярке: -r[ca]\.?\d+ (покрывает оба формата — rc2 и rc.2).
  • Логика маппинга версия→environment вынесена в package-private resolveEnvironment(String), чтобы тестировать без поднятия Spring-контекста.
  • Добавлен параметризованный тест на все ветки маппинга (production / pre-release / develop / feature), включая регрессию 1.0.0-rc.2.

Fixes BSL-LANGUAGE-SERVER-W7

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced pre-release version pattern recognition for release and candidate versions to accommodate optional dot formatting before version numbers.
  • Tests

    • Added parameterized test suite to validate version-to-environment resolution across various version string formats.

Регулярка для pre-release ожидала формат `1.0.0-rc2` без точки, поэтому
semver-версии вида `1.0.0-rc.2` не матчились и попадали в environment
`feature` вместо `pre-release`. Разрешена необязательная точка между
`rc`/`ra` и номером.

Логика маппинга версия→environment вынесена в package-private
`resolveEnvironment(String)` и покрыта параметризованным тестом.

Fixes BSL-LANGUAGE-SERVER-W7

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1e81f93e-17c9-43e8-a055-e3ec15beb048

📥 Commits

Reviewing files that changed from the base of the PR and between b0d3bfc and 5294f3a.

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

📝 Walkthrough

Walkthrough

SentryScopeConfigurer.getEnvironment() is refactored to delegate to a new package-private static helper resolveEnvironment(String version). The extracted helper updates the pre-release version regex to allow an optional dot before the numeric suffix. A @ParameterizedTest using @CsvSource is added to cover the helper across multiple version strings.

Changes

Sentry Environment Resolution Refactor

Layer / File(s) Summary
resolveEnvironment helper and getEnvironment delegation
src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurer.java
getEnvironment() now returns resolveEnvironment(serverInfo.getVersion()). The new static helper contains the extracted mapping logic and changes the -r/-c pre-release regex to treat the dot before the numeric suffix as optional.
Parameterized test for resolveEnvironment
src/test/java/com/github/_1c_syntax/bsl/languageserver/aop/sentry/SentryScopeConfigurerTest.java
Adds ParameterizedTest/CsvSource imports and a CSV-driven testResolveEnvironment method that asserts correct environment values across the provided version strings.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐇 A helper was born from a method so long,
Extracting the logic where it now belongs.
The regex was tweaked—dots optional, you see—
Pre-release versions parsed more carefully.
Now tests parade through each version with cheer,
The environment mapped, crystal-perfectly clear! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title references the main technical fix: making the dot optional in pre-release version regex matching for rc/ra formats.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sentry-prerelease-environment-rc-dot

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.

@sonarqubecloud

sonarqubecloud Bot commented Jun 15, 2026

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
75.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 3 432 files  ± 0   3 432 suites  ±0   1h 41m 35s ⏱️ + 7m 0s
 3 414 tests +10   3 396 ✅ +10   18 💤 ±0  0 ❌ ±0 
20 484 runs  +60  20 376 ✅ +60  108 💤 ±0  0 ❌ ±0 

Results for commit 5294f3a. ± Comparison against base commit b0d3bfc.

@nixel2007
nixel2007 merged commit 543db08 into develop Jun 15, 2026
35 of 37 checks passed
@nixel2007
nixel2007 deleted the fix/sentry-prerelease-environment-rc-dot branch June 15, 2026 16:05
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