Skip to content

[0.1.5] Limit concurrency: discard stale annotation results per file; add SDK env tests - #33

Merged
unurgunite merged 1 commit into
v0.1.5from
feature/concurrency-one-check-per-file
Jul 5, 2026
Merged

[0.1.5] Limit concurrency: discard stale annotation results per file; add SDK env tests#33
unurgunite merged 1 commit into
v0.1.5from
feature/concurrency-one-check-per-file

Conversation

@unurgunite

@unurgunite unurgunite commented Jul 5, 2026

Copy link
Copy Markdown
Member

Description

Two changes in this PR:

1. Concurrency: discard stale annotation results per file

When the IDE triggers multiple rapid annotations for the same file (e.g. during a series of quick saves), only the last check result is now applied. Each file has a generation counter (ConcurrentHashMap in DocscribeAnnotator.fileGeneration) — if a newer check starts while an older one is still running, the older result is discarded on completion.

Before: rapid saves triggered N concurrent bundle exec docscribe calls for the same file. All N results were applied in sequence, with the last one overwriting — wasted work and potential race conditions.

After: each file has a generation counter incremented at the start of doAnnotate(). On completion, the saved generation is compared to the current value. If they differ, the result is discarded. Only the latest check's annotations reach the editor.

2. Tests + KDoc for Ruby SDK environment

PR #32 added buildSdkEnvironment() and DefaultCommandExecutor(environment) but lacked tests and docs:

  • DefaultCommandExecutor — KDoc for environment parameter (how SDK PATH injection works)
  • DefaultCommandExecutor with environment does not throw — integration test verifying the env constructor works with runDocscribe()

Files

File Change
DocscribeAnnotator.kt Generation counter + discard logic + KDoc
DocscribeAnnotatorTest.kt 3 new tests: null-safe return, generation increments, per-file isolation
DocscribeRunner.kt KDoc for DefaultCommandExecutor.environment
DocscribeRunnerTest.kt Test for DefaultCommandExecutor(environment)
CHANGELOG.md Entry for stale result discard

Checklist

  • Tests pass (./gradlew test)
  • Formatting clean (./gradlew spotlessCheck)
  • Static analysis clean (./gradlew detekt)
  • Plugin verified (./gradlew verifyPlugin)
  • CHANGELOG updated

@unurgunite unurgunite self-assigned this Jul 5, 2026
@unurgunite unurgunite added the enhancement New feature or request label Jul 5, 2026
@unurgunite
unurgunite merged commit e11bc23 into v0.1.5 Jul 5, 2026
1 check passed
@unurgunite
unurgunite deleted the feature/concurrency-one-check-per-file branch July 5, 2026 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant