Skip to content

Индикатор хода работы, начатый до initialized, показывается клиенту - #4670

Merged
nixel2007 merged 2 commits into
developfrom
fix/client-progress-before-initialized
Nov 7, 2026
Merged

nixel2007 merged 2 commits into
developfrom
fix/client-progress-before-initialized

Conversation

@sfaqer

@sfaqer sfaqer commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

Что не так

Клиент VS Code (vscode-languageclient) вешает обработчик запроса window/workDoneProgress/create в initializeFeatures. Это происходит уже после ответа на initialize и после отправки initialized: в lib/common/client.js идут connection.initialize(...) → sendNotification(InitializedNotification) → initializeFeatures. Запрос на создание индикатора, пришедший раньше, обработать нечем: индикатор не создаётся, и уведомления о его ходе клиент пропускает. Спецификация LSP и не разрешает серверу слать запросы клиенту до ответа на initialize.

В develop чтение метаданных конфигурации идёт внутри initialize, и индикатор «Рассчитываем данные конфигурации...» создаётся там же. По зонду старта ERP он начинается на 3,2 с, а ответ на initialize уходит на 24,4 с. В VS Code вместо индикатора эти секунды — тишина.

Что сделано

  • WorkDoneProgressHelper до clientInitialized() индикаторы клиенту не отправляет, а запоминает их состояние: заголовок и последний отчёт.
  • BSLLanguageServer.initialized зовёт clientInitialized(). Индикаторы, не законченные к этому моменту, создаются у клиента с заголовком и последним отчётом и дальше идут как обычно. Законченные раньше не показываются вовсе.

В develop метаданные дочитываются внутри initialize, поэтому их индикатор теперь клиенту не уходит совсем — в VS Code он и раньше не показывался. Пользу видно вместе с #4617: там чтение метаданных и регистрация типов продолжаются после initialize, и их индикаторы теперь доходят до клиента.

Тесты

WorkDoneProgressHelperTest:

  • progressStartedBeforeClientInitializedIsShownWithItsStateWhenClientIsReady — индикатор, начатый и продвинутый до готовности клиента, по готовности создаётся у него с заголовком и последним отчётом, дальше идёт как обычно;
  • progressEndedBeforeClientInitializedIsNeverShown — законченный раньше клиенту не отправляется;
  • в прежних тестах клиент объявлен готовым.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Progress notifications now wait until the client is initialized. Any progress already underway is then reported with its latest status, while work that finishes beforehand stays hidden.

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Caution

Review failed

The pull request is closed.

No actionable comments were generated in the recent review.

Walkthrough

The language server now publishes a client-initialized event when it handles the initialized notification. Work-done progress is deferred until that event, then active reporters send their cached progress state to the client.

Changes: Client Initialization and Progress

Layer / File(s) Summary
Publish the client initialization event
src/main/java/com/github/_1c_syntax/bsl/languageserver/client/events/*, src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/Pointcuts.java, src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/lsp/BSLLanguageServerTest.java
The initialized pointcut and before advice publish ClientInitializedEvent. A test asserts that the server publishes exactly one event.
Defer progress until initialization
src/main/java/com/github/_1c_syntax/bsl/languageserver/client/WorkDoneProgressHelper.java, src/test/java/com/github/_1c_syntax/bsl/languageserver/client/WorkDoneProgressHelperTest.java
Progress reporters cache their state until client initialization. Active reporters send cached state after initialization; reporters that end before initialization are not created or reported.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant LanguageServer
  participant EventPublisherAspect
  participant SpringEventSystem
  participant WorkDoneProgressHelper
  participant LanguageClient
  LanguageServer->>EventPublisherAspect: handle initialized notification
  EventPublisherAspect->>SpringEventSystem: publish ClientInitializedEvent
  SpringEventSystem->>WorkDoneProgressHelper: deliver initialization event
  WorkDoneProgressHelper->>LanguageClient: create progress and send cached state
Loading

Suggested reviewers: claude, nixel2007

Merge Risk: Minimal · previous review 42ad7

Active progress can be shown when the client becomes ready, while work completed beforehand remains hidden. No actionable merge-blocking risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 18.52% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 27 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed 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 clearly describes the main change: progress started before initialized is shown to the client after initialization.
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.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

ℹ️ Recent review info

⚙️ Run configuration

  • Configuration used: Repository: 1c-syntax/bsl-language-server/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1d8001bc-bad4-4bc9-875c-c82eaba471c1
📥 Commits

Reviewing files that changed from the base of the PR and between f679307 and 42ad702.

📒 Files selected for processing: 7

  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/EventPublisherAspect.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/aop/Pointcuts.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/client/WorkDoneProgressHelper.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/client/events/ClientInitializedEvent.java
  • src/main/java/com/github/_1c_syntax/bsl/languageserver/client/events/package-info.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/client/WorkDoneProgressHelperTest.java
  • src/test/java/com/github/_1c_syntax/bsl/languageserver/lsp/BSLLanguageServerTest.java

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 4 386 files   4 386 suites   1h 9m 36s ⏱️
 4 668 tests  4 578 ✅  90 💤 0 ❌
28 104 runs  27 552 ✅ 552 💤 0 ❌

Results for commit e918ab9.

♻️ This comment has been updated with latest results.

@sfaqer
sfaqer force-pushed the fix/client-progress-before-initialized branch from 590b27d to 42ad702 Compare October 15, 2026 00:50
@sonarqubecloud

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

sfaqer and others added 2 commits November 7, 2026 20:50
…тся клиенту

Клиент VS Code вешает обработчик window/workDoneProgress/create только после ответа на
initialize и отправки initialized. Индикатор, который сервер создавал раньше — чтение
метаданных конфигурации идёт внутри initialize, — клиент отбрасывал, и на старте
рабочая область секунды молчала.

WorkDoneProgressHelper до уведомления initialized индикаторы клиенту не отправляет, а
запоминает их состояние. По initialized незаконченные создаются у клиента с заголовком
и последним отчётом; законченные раньше не показываются.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t, а не прямым вызовом из initialized

Аспект публикует ClientInitializedEvent при получении уведомления initialized (по образцу
LanguageServerInitializedEvent на initialize), WorkDoneProgressHelper его слушает.
BSLLanguageServer о помощнике индикаторов больше не знает. Событие лежит в client.events:
слою client правила архитектуры зависимостей не разрешают.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nixel2007
nixel2007 force-pushed the fix/client-progress-before-initialized branch from e918ab9 to 9fe82a1 Compare November 7, 2026 19:50
@nixel2007
nixel2007 merged commit f3d3270 into develop Nov 7, 2026
19 of 20 checks passed
@nixel2007
nixel2007 deleted the fix/client-progress-before-initialized branch November 7, 2026 19:51
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