Repository navigation
Centralize dictionary loading policy - #66
Merged
Merged
Conversation
- Make SdefFileProvider own recovery, persistence, result mapping, and registry initialization - Keep cache generation mechanical while distinguishing missing bundled definitions from copy failures - Cover typed failures, cancellation, interruption, recovery, and legacy compatibility boundaries Impact: dictionary loads report actionable failures without changing existing nullable caller behavior
Reviewer's GuideCentralizes dictionary loading policy by moving error and recovery handling into SdefFileProvider, simplifying SdefDictionaryFileGenerator, and adding a comprehensive test suite for dictionary load behavior and failure modes. Sequence diagram for centralized dictionary loading policysequenceDiagram
actor DictionaryClient
participant SdefFileProvider
participant SdefDictionaryFileGenerator
participant RegistryService as AppleScriptSystemDictionaryRegistryService
participant PersistenceService as SdefPersistenceService
DictionaryClient->>SdefFileProvider: loadDictionary(applicationIoFile, applicationName)
SdefFileProvider->>RegistryService: getDictionaryInfoByNameInternal(applicationName)
RegistryService-->>SdefFileProvider: DictionaryInfo?
SdefFileProvider->>SdefFileProvider: generateFile(applicationName, applicationIoFile, generateDictionaryFile, recoverDictionaryFile)
activate SdefFileProvider
SdefFileProvider->>SdefDictionaryFileGenerator: generateDictionaryFile(applicationName, applicationIoFile)
alt [generateDictionaryFile succeeds]
SdefDictionaryFileGenerator-->>SdefFileProvider: dictionaryFile
else [DeveloperToolsNotInstalledException]
SdefDictionaryFileGenerator--xSdefFileProvider: DeveloperToolsNotInstalledException
SdefFileProvider->>SdefFileProvider: recoverDictionaryFile(applicationName, applicationIoFile)
SdefFileProvider->>SdefDictionaryFileGenerator: recoverDictionaryFile(applicationName, applicationIoFile)
SdefDictionaryFileGenerator-->>SdefFileProvider: dictionaryFile?
end
deactivate SdefFileProvider
alt [dictionaryFile is null]
SdefFileProvider-->>DictionaryClient: DictionaryLoadResult.Failed
else [dictionaryFile available]
SdefFileProvider->>SdefFileProvider: registerDictionary(applicationName, applicationIoFile, dictionaryFile)
SdefFileProvider->>PersistenceService: addDictionaryInfo(DictionaryInfo)
SdefFileProvider->>RegistryService: initializeDictionaryFromInfoInternal(DictionaryInfo)
RegistryService-->>SdefFileProvider: Boolean
alt [initialized]
SdefFileProvider-->>DictionaryClient: DictionaryLoadResult.Loaded
else [initialization failed]
SdefFileProvider-->>DictionaryClient: DictionaryLoadResult.Failed
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
barad1tos
marked this pull request as ready for review
August 13, 2026 21:24
There was a problem hiding this comment.
Sorry @barad1tos, you have reached your weekly rate limit of 1500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
── Summary ─────────────────────────────────
Dictionary loading split error handling, recovery, persistence, and registry initialization between the file provider and cache generator, which made typed failures unreliable and could persist transient copy failures as permanently non-scriptable applications.
Centralize loading policy in
SdefFileProviderwhile keepingSdefDictionaryFileGeneratorfocused on file production and preserving every existing nullable caller boundary.── Changes ─────────────────────────────────
── Validation ──────────────────────────────
./gradlew ktlintCheck detekt check build verifyPlugin --warning-mode all— Passed; coverage held, generated sources matched, the service graph remained acyclic, and Plugin Verifier reported compatibility with IC 2025.1, IC 2025.2, and IU 2026.1../gradlew test --tests com.intellij.plugin.applescript.test.service.DictionaryLoadPolicyTest --tests com.intellij.plugin.applescript.test.service.SdefFileProviderTest --tests com.intellij.plugin.applescript.test.service.DictionaryStartupPipelineTest --tests com.intellij.plugin.applescript.test.service.CoroutineColdStartTest --tests com.intellij.plugin.applescript.test.service.ParserDictionaryLookupFreezeTest --tests com.intellij.plugin.applescript.test.codeinsight.AppleScriptCodeInsightTest --rerun-tasks ktlintCheck detekt verifyServiceDependencyGraph --warning-mode all— Passed.── Notes ───────────────────────────────────
The public
fetchandcreateAndInitializeInfoJVM descriptors are preserved. The nullable compatibility path still returnsnullfor expected loading failures, while unexpected programming errors retain their previous propagation boundary.Pre-existing EDT blocking and shell process-tree teardown remain separate architecture slices so this PR stays limited to loading ownership and transition safety.