Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Extension scanner writes its cache into the installed package directory #23

Open

Description

@tercel

Summary

ExtensionScanner writes its metadata cache into the installed package directory:

_cache_file: Path = Path(__file__).parent / ".executor_cache.json"

In a read-only or root-owned site-packages (Docker images, system Python, Nix, some venvs), this write fails. The failure is downgraded to a warning, so it is easy to miss.

Environment

  • apflow 0.24.3 (main @ 479d578)

Evidence

  • src/apflow/core/extensions/scanner.py:81 — cache path under Path(__file__).parent
  • src/apflow/core/extensions/scanner.py:441-463 — write with warning-only failure handling

Impact

  • Scanner performance regresses silently on every process start.
  • Installed packages are mutated, which breaks immutable-image assumptions and can confuse package verification.
  • In containerized deployments, the warning is often hidden by log settings.

Proposed fix

  • Store the cache under a user/platform cache directory (platformdirs.user_cache_dir("apflow")) or an env-configured path (APFLOW_CACHE_DIR).
  • Validate writability and degrade explicitly (debug log), not with a warning storm.
  • Optionally allow disabling the cache.

Acceptance criteria

  • Scanner works with a read-only site-packages.
  • The cache location is documented and configurable.
  • A test simulates a read-only package directory.

Workaround

Pre-warm the cache in a writable image layer, or ignore the warning.

Activity

  1. added
    bug
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions