Add comprehensive test suite covering indexes, references, and providers#55
Merged
Conversation
Static review of every Kotlin source file under src/main/kotlin/com/github/xepozz/spiral/, written by per-file review subagents seeded with an IntelliJ Platform best-practices checklist. - analysis/README.md indexes high-signal findings by severity - analysis/_CONTEXT.md is the shared reviewer brief (project conventions + threading / dumb-mode / index / reference / completion guidelines) - one report per source file, mirroring the package layout, with severity-tagged findings and file:line locations https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
The original MyPluginTest.kt was a template leftover referencing services.MyProjectService which does not exist. compileTestKotlin failed against it, blocking any new tests. This replaces it with a trivial sanity check and drops the matching template testData/rename fixtures. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Add shared Spiral FQN constants so feature modules (config/env folding, container references) no longer hardcode them. Other worktrees can consume these from one location. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Worktree subagents use absolute paths via Edit, which resolve to the main worktree rather than their isolated worktree path. As a result their fixes (config/, container/, forms/, router/, scaffolder/, views/) are accumulating here. These should be coherent with each agent's own worktree branch and will reconcile cleanly when those branches are merged. Console, cqrs, and prototyped+references agents are still running; further fixes will land in subsequent commits. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Test files written by router and views worktree agents via absolute paths landed in main rather than their isolated worktrees. Collecting them here so the stop hook unblocks; they overlap with the same agents' own worktree-branch commits and will reconcile at merge time. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Worktrees created for parallel subagent isolation live under .claude/worktrees/ and should never enter version control. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Router agent finalized further router/index refactors after the WIP commit; absolute Edit paths landed them in main. Aligns with the worktree-agent-ac7d65370436ebfce branch. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Two compile fixes:
- Add VIEWS_RENDER_SIGNATURE constant to SpiralFrameworkClasses
(scaffolder/views agent referenced it but its addition didn't leak).
- Add com.intellij.openapi.diagnostic.debug import to
SpiralProjectGenerator so the lazy Logger.debug { ... } calls
resolve.
Pull in test files written by worktree agents that did not leak to
main: foundation tests (SpellcheckingDictionaryProviderTest,
SpiralFrameworkClassesTest, ObjectStreamDataExternalizerTest), all
cqrs tests, prototyped + references tests, and console tests.
compileKotlin + compileTestKotlin -x patchPluginXml: exit 0.
https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Root cause of the failing test wave: gradle.properties did not declare com.intellij.modules.json in platformBundledPlugins. Without it the PHP plugin refused to load in the test sandbox (Plugin 'PHP' requires plugin 'com.intellij.modules.json' to be installed), which cascaded to every Spiral plugin extension never being registered — producing the "Index is not created for Spiral.X" wave. Real production bugs uncovered by the resulting tests: - ObjectStreamDataExternalizer.read NPE on null payloads (`as T` -> `as T?`). - SpiralConsoleCommandRunConfigurationSettings aliased workingDirectory and documentRoot onto the binary state slot. - CqrsHandlersImplicitUsageProvider.isClassWithCustomizedInitialization returned true unconditionally, marking every PHP class as having customized init. - CqrsHandlersLineMarkerProvider matched on PhpClass but the platform calls line markers on leaf elements only; re-anchored to the class-name identifier. Test fixes apply BasePlatformTestCase-appropriate patterns: explicit doHighlighting/CodeFoldingManager triggers, FileBasedIndex ensureUpToDate / smart-mode wrappers, caret placement adjustments. ./gradlew test -x patchPluginXml: 76/76 passing, exit 0. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Code review (5 finder angles + 1-vote verification) flagged three call sites that consume PrototypedIndex / CqrsIndexUtil without the dumb-mode wrapper their own KDoc/contract requires: - prototyped/PrototypedCompletion.kt:46 — completion popup at a PrototypeTrait site during indexing would throw IndexNotReadyException. - cqrs/CqrsHandlersLineMarkerProvider.kt:30 — gutter pass over a Command/Query class during indexing would crash and silently drop every CQRS line marker. - prototyped/PrototypedPropertyReference.kt:29 — getVariants() called during indexing would crash completion. Fix: early-return when DumbService.isDumb(project), so the IDE simply shows no result until indexes are ready, instead of erroring. ./gradlew test -x patchPluginXml: 76/76 passing, exit 0. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
Summarize the user-visible changes from the multi-agent review pass: new test suite, settings-corruption + NPE + CQRS over-reporting + missing gutter icons + dumb-mode guard regressions. https://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6
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
This PR adds a comprehensive test suite with 30 new test classes covering the plugin's core functionality: file-based indexes, PSI references, line markers, folding, run configurations, and implicit usage providers. Additionally, it includes a static code analysis directory documenting per-file findings and recommendations.
Key Changes
Test Coverage (30 new test classes)
RouterNamesIndexTest,RouterUrlsIndexTest,RouterReferenceVariantsTest,SpiralEndpointsProviderTest,RoutesImplicitUsageProviderTestCqrsCommandIndexTest,CqrsQueryIndexTest,CqrsCommandHandlerIndexTest,CqrsQueryHandlerIndexTest,CqrsIndexUtilTest,CqrsHandlersLineMarkerProviderTest,CqrsHandlersImplicitUsageProviderTestConsoleCommandNameExtractionTest,ConsoleCommandLineMarkerProviderTest,SpiralConsoleCommandRunConfigurationSettingsTestConfigSectionIndexTest,PrototypedIndexTest,EnvFoldingBuilderTestViewsNamespaceIndexTest,ViewFileReferenceTest,PHPLanguageInjectorTestContainerReferenceContributorTestPrototypedCompletionTestDirectoryReferenceTest,FunctionsReferenceContributorTestSpiralFrameworkClassesTest,ObjectStreamDataExternalizerTest,SpellcheckingDictionaryProviderTestCode Improvements
RouteReferenceContributor,PrototypedIndex,ConfigSectionIndex, andRoutedata classAbstractRouterIndexwith improved logging and dumb-mode handlingRouterIndexUtilwith dumb-mode awareness and better error handlingSpiralBundlemessage keys for endpoints UI (endpoints.group.root,endpoints.group.name,endpoints.endpoint.method)SpiralGroupto useWeakReferencefor project references (memory leak prevention)rename/foo.xml,rename/foo_after.xml)PHPLanguageInjectorto remove commented-out codeSpiralEndpointsProviderwith bundle message usageContainerReferenceContributorwith explicit importsSpiralFrameworkClasseswith additional constants for container and viewsSpiralConsoleCommandRunConfigurationSettingsstate delegate backingStatic Analysis Documentation
analysis/directory with per-file code review reportsanalysis/_CONTEXT.mdwith shared analysis context and conventionsanalysis/README.mddocumenting the analysis structure and severity tagsConfiguration & Build
gradle.propertieswith additional test dependenciesCHANGELOG.mdwith unreleased section documenting test suite additionNotable Implementation Details
BasePlatformTestCasewith proper fixture configurationhttps://claude.ai/code/session_01SKogXRGoKRw1AV4SpzUTW6