Skip to content

Feat/scheme-response-builder - #988

Merged
Xoshbin merged 3 commits into
mainfrom
feat/scheme-response-builder
Nov 3, 2026
Merged

Xoshbin merged 3 commits into
mainfrom
feat/scheme-response-builder

Conversation

@Xoshbin

@Xoshbin Xoshbin commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner

Installing or updating an extension now writes a 128px PNG copy of each bundled PNG/JPEG/WebP/BMP icon larger than 128px, as a hidden file next to the original. Icon URLs carry ?icon, and asyar-extension:// serves the copy when it exists and the original otherwise (SVG, GIF, small images, linked dev extensions, older installs). Extension views always get the original files. Also serves .jpg/.jpeg/.webp/.gif/.bmp/.ico from extensions with their real image MIME types instead of text/plain.

Summary by CodeRabbit

  • New Features
    • Extension icons can be served as optimized 128px copies when available; original icons remain available as a fallback.
  • Bug Fixes
    • Icon copies are generated during extension installation and updates.
    • Custom resource requests handle URL prefixes, queries, and fragments consistently. Invalid paths are rejected, and missing resources return a not-found response.
    • Custom resource responses now consistently use no-store caching and include cross-origin access headers.
  • Documentation
    • Updated protocol documentation to describe icon-copy behavior and response caching.

…on URLs (#949 step 2)

Installing or updating an extension now writes a 128px PNG copy of each bundled PNG/JPEG/WebP/BMP icon larger than 128px, as a hidden file next to the original. Icon URLs carry ?icon, and asyar-extension:// serves the copy when it exists and the original otherwise (SVG, GIF, small images, linked dev extensions, older installs). Extension views always get the original files. Also serves .jpg/.jpeg/.webp/.gif/.bmp/.ico from extensions with their real image MIME types instead of text/plain.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The launcher now creates eligible 128px icon copies during extension installation and updates. Centralized URI handlers can serve a generated copy for extension icon requests. The launcher also applies shared response headers across its custom schemes, and the Ubuntu test-and-lint job removes selected preinstalled tool directories.

Changes: Extension icon copy flow

Layer / File(s) Summary
Collect and generate extension icon copies
asyar-launcher/src-tauri/src/extensions/mod.rs, asyar-launcher/src-tauri/src/icons.rs, asyar-launcher/src-tauri/src/icons/copies.rs, asyar-launcher/src-tauri/src/extensions/installer.rs, asyar-launcher/src-tauri/src/extensions/updater.rs
The manifest exposes icon paths from its icons, actions, commands, and command actions. Installation and update flows generate copies for eligible raster icons. The generator resolves icons under dist before the extension root, skips duplicate paths, and has tests for supported cases and failure conditions.
Centralize scheme registration and responses
asyar-launcher/src-tauri/src/uri_schemes/response.rs, asyar-launcher/src-tauri/src/uri_schemes.rs, asyar-launcher/src-tauri/src/lib.rs, docs/explanation/host-startup-and-installation.md, docs/explanation/asyar-extension-protocol.md
The launcher registers the extension, icon, and thumbnail schemes through a shared registry. Shared response handling applies CORS and no-store headers. Cache-file handling parses paths, rejects traversal, and returns 404 for missing files.
Select icon copies for extension requests
asyar-launcher/src-tauri/src/uri_schemes.rs, docs/explanation/asyar-extension-protocol.md
An extension request with the icon query uses an existing generated copy when available and otherwise serves the original file. Extension MIME matching is case-insensitive and includes additional image formats.

Ubuntu runner cleanup

Layer / File(s) Summary
Remove preinstalled runner directories
.github/workflows/test-and-lint.yml
The Ubuntu test-and-lint job removes selected Android, .NET, Haskell, and Boost directories before dependency installation, then reports remaining disk space.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ExtensionInstaller
  participant ExtensionManifest
  participant IconCopies
  participant Webview
  participant ExtensionScheme
  ExtensionInstaller->>ExtensionManifest: collect declared icon paths
  ExtensionInstaller->>IconCopies: generate eligible copies
  Webview->>ExtensionScheme: request extension icon with icon query
  ExtensionScheme->>IconCopies: check for generated copy
  ExtensionScheme-->>Webview: return copy or original file
Loading

Possibly related PRs

  • Xoshbin/asyar#964: Introduces Rust-resolved extension icon paths and bundled image icons through asyar-extension://, which connect to this change’s manifest icon collection and URI serving.
  • Xoshbin/asyar#956: Changes extension packaging so declared icon files are present in distributed packages, which this change reads during installation and update.
  • Xoshbin/asyar#989: Builds .asyar packages for local installation and documents install-time icon copying, which connects to this change’s installer behavior.
Merge Risk: Minimal · up to 49a43

The reviewed changes appear mergeable with no established actionable risk beyond normal validation.

Architecture risk: Low · up to 49a43

The change affects 2 systems.

Changed systems: asyar-launcher, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — asyar-launcher (service) was modified; 8 changed files map to changed impact.
  • observed — docs (service) was modified; 2 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in asyar-launcher/src-tauri/src/extensions/installer.rs: install_from_file now writes manifest icon copies into the extracted package before transferring it to the installation directory.
  • observed — Modified behavior in asyar-launcher/src-tauri/src/extensions/installer.rs: install_from_url now writes manifest icon copies after the manifest is read successfully during the compatibility check; manifest read failures still follow the existing warning path.
  • observed — Modified behavior in asyar-launcher/src-tauri/src/extensions/mod.rs: ExtensionManifest::icon_sources adds an iterator over raw icon strings from the manifest, top-level actions, commands, and command actions, skipping entries without icons.
  • observed — Modified behavior in asyar-launcher/src-tauri/src/extensions/mod.rs: ExtensionManifest::write_icon_copies adds a call to write icon copies into the supplied extension directory and logs the number written only when that number is greater than zero.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… 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 "Feat/scheme-response-builder" names a real part of the changeset: the new SchemeResponse builder in uri_schemes/response.rs and its use across the custom URI scheme handlers. However, it do…
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.
Full details: Title check

Explanation

The title "Feat/scheme-response-builder" names a real part of the changeset: the new SchemeResponse builder in uri_schemes/response.rs and its use across the custom URI scheme handlers. However, it does not name the main change, which is generating hidden 128px icon copies for installed or updated extensions and serving them through the ?icon query. It is also written as a branch name rather than a descriptive sentence. It is therefore partially related.

Full details: Docstring Coverage

Explanation

Docstring coverage is 53.85% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 26 functions across 8 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: edeb3b48-2476-40b8-b770-43e60e40191a
Commits

Reviewing files that changed from the base of the PR and between 7f84c17 and 49a434a.

Files selected for processing: 1
  • .github/workflows/test-and-lint.yml

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

Purge unused pre-installed toolchains (.NET, Android, Haskell, Boost) on
ubuntu-latest so target/ and GNU ld don't run out of disk space during
test binary linking.
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.

1 participant