Skip to content

Fix Cache compatibility shim and async REST v1 capabilities fallback #1

Description

@ahuimanu

Summary
Two regressions were found in the typed-cache / async REST work:

  1. Cache compatibility shim preserved the import name but not old behavior. Existing callers using Cache.meta(...) or Cache(api).load('/datarefs') would fail because Cache.meta raised NotImplementedError and load no longer accepted a path argument.
  2. AsyncXPRestAPI.capabilities() built the v1 fallback probe from rest_url. When api_version was already v1 or v2, appending /v1/datarefs/count could produce a duplicated version path such as /api/v2/v1/datarefs/count, causing capabilities to stay empty for v1-only APIs.

Expected behavior

  • Cache.meta(...) keeps the old dataref/command heuristic for compatibility.
  • Cache(api).load('/datarefs') and Cache(api).load('/commands') continue to work for existing callers.
  • Async capabilities fallback probes the unversioned API root: /api/v1/datarefs/count.

Fix status
A local fix has been implemented with regression tests:

  • TestCacheCompatibility covers Cache.meta(...) and Cache(api).load(path).
  • TestAsyncXPRestAPICapabilities covers the v1 fallback URL.

Verification

  • uv run python -m unittest discover -v
  • uv run ruff check xpwebapi tests
  • uv run ruff format --check xpwebapi tests

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions