Skip to content

Migrate policies to the new Resource-layer methods #15066

Description

@AlexVelezLl

This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Overview

Migrate the policies plugin to the new resource-layer methods, following the shared recipe in #15057.

Complexity: Low
Target branch: develop

Context

policies currently uses the old resource methods. This task applies the migration recipe from #15057 to this plugin only. The new methods already exist (#15056), and the old ones still work, so this change is isolated to policies.

The Change

Apply the #15057 recipe to every resource usage in policies:

  • Replace old base-method calls with the new ones (fetchModelretrieve, fetchCollectionlist, saveModelcreate/update, deleteModeldelete, saveCollectionbulkCreate, deleteCollectionbulkDelete, raw get/list/create).
  • Remove cache-management calls (clearCache, getModel, getCollection, addModel, …).
  • Custom methods: rewrite onto request if the resource is defined and used only within policies; otherwise add/point at a _v2 shared method (see Migrate all plugins and shared packages to the new Resource-layer methods #15057).
  • Use useRetrieve / useList for reactive reads, if possible.

Acceptance Criteria

  • No code in policies calls the old base methods or cache-management helpers.
  • Custom methods handled per the recipe (in-place rewrite for target-only resources, or shared _v2 with the original left intact).
  • Reactive reads use useRetrieve / useList where possible.
  • Tests that call/mock replaced methods are updated; pnpm test-jest passes for policies.

AI usage

I used Claude Code to help draft this issue from the resource-layer refactor plan. I reviewed and edited it and confirmed the scope myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions