Skip to content

[Web Import] Enable persistent cache to avoid re-fetching icons on every plugin restart#912

Merged
egorikftp merged 2 commits into
mainfrom
feature/cache
Feb 28, 2026
Merged

[Web Import] Enable persistent cache to avoid re-fetching icons on every plugin restart#912
egorikftp merged 2 commits into
mainfrom
feature/cache

Conversation

@egorikftp

Copy link
Copy Markdown
Member

ref: https://ktor.io/docs/client-caching.html#persistent_cache

Demo:

95552cce-0fad-49d2-b936-0bdbcd34c7ed.mov

📝 Changelog

If this PR introduces user-facing changes, please update the relevant Unreleased section in changelogs:

@coderabbitai

coderabbitai Bot commented Feb 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56b689b and f2f6134.

📒 Files selected for processing (1)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt
🚧 Files skipped from review as they are similar to previous changes (1)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt

Walkthrough

Adds HTTP response caching to the Ktor HttpClient used by the IDE plugin by installing HttpCache with filesystem-backed storage at systemPath/valkyrie/http-cache. The change ensures the cache directory is created (errors logged) and configures FileStorage as the cache storage. A changelog entry documents the addition under Web Import. No public API declarations were changed.

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes a reference to relevant documentation, a demo link, and the changelog checklist template, but the checklist boxes remain unchecked despite the changelog being updated. Check the IntelliJ Plugin checkbox since the CHANGELOG.md was updated with the feature entry, or clarify why the changelog update doesn't warrant checking the box.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: enabling persistent HTTP caching for web imports to prevent re-fetching icons on plugin restart.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/cache

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt (1)

35-35: Use a cache-specific subdirectory for cleaner storage boundaries.

Using .../valkyrie/http-cache (instead of just .../valkyrie) makes cleanup and future storage separation safer.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt`
at line 35, The cacheDir currently points to the generic Valkyrie system folder;
change it to a cache-specific subdirectory so HTTP cache files live under a
dedicated folder. Update the expression that sets cacheDir in NetworkModule (the
variable named cacheDir using
Paths.get(PathManager.getSystemPath()).resolve("valkyrie")) to resolve an
additional "http-cache" segment (e.g., resolve("valkyrie").resolve("http-cache")
or equivalent) so the path becomes .../valkyrie/http-cache.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt`:
- Around line 34-38: The HttpCache setup in NetworkModule.kt currently calls
Files.createDirectories(...) and constructs FileStorage(cacheFile) without
protection, so filesystem errors can break HttpClient construction; wrap the
install(HttpCache) cacheDir/cacheFile creation and
publicStorage(FileStorage(...)) call in a try/catch that on failure logs a
warning and falls back to an in-memory/no-op cache (i.e., skip publicStorage or
use a memory-based storage) so HttpClient still constructs and web import
degrades gracefully; refer to the install(HttpCache) block, cacheDir/cacheFile,
and publicStorage(FileStorage(cacheFile)) when applying the change.

---

Nitpick comments:
In
`@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt`:
- Line 35: The cacheDir currently points to the generic Valkyrie system folder;
change it to a cache-specific subdirectory so HTTP cache files live under a
dedicated folder. Update the expression that sets cacheDir in NetworkModule (the
variable named cacheDir using
Paths.get(PathManager.getSystemPath()).resolve("valkyrie")) to resolve an
additional "http-cache" segment (e.g., resolve("valkyrie").resolve("http-cache")
or equivalent) so the path becomes .../valkyrie/http-cache.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e7b773 and 56b689b.

📒 Files selected for processing (2)
  • tools/idea-plugin/CHANGELOG.md
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/webimport/common/di/NetworkModule.kt

@egorikftp egorikftp merged commit ba4cc82 into main Feb 28, 2026
3 checks passed
@egorikftp egorikftp deleted the feature/cache branch February 28, 2026 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants