kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Remove the old Resource-layer methods and un-suffix the _v2 custom methods

Open AlexVelezLl opened this issue 4 months ago • 1 comments

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

Overview

Final cleanup step of the resource-layer consolidation. Once every plugin and package has migrated to the new methods (tracked by #15057), remove the old methods and the now-unused caching machinery, and rename the temporary _v2 custom methods back to their original names.

Complexity: Medium Target branch: develop

Context

The migration (#15057) intentionally left the old and new methods coexisting, and duplicated shared custom methods with a _v2 suffix so not-yet-migrated consumers kept working. Once all migrations land, the old surface becomes dead code and the _v2 names are just temporary scaffolding.

The Change

With every consumer now on the new methods, remove the old surface and clean up the scaffolding:

  • Remove the old base methods: fetchModel, fetchCollection, createModel, saveModel, deleteModel, saveCollection, deleteCollection, and the raw get / list / create.
  • Remove the cache-management helpers: clearCache, getModel, getCollection, addModel, findModel, removeModel, removeCollection, unCacheModel, unCacheCollection.
  • Remove the Model and Collection classes and any leftover force / JS-cache logic.
  • Rename each _v2 custom method back to its original name (e.g. createuseronremote_v2 → createuseronremote), replacing the old implementation, and update its call sites.
  • Before deleting any method, confirm there are no remaining references to it.

Out of Scope

Handled in other issues:

  • Migrating plugins/packages to the new methods (#15057).
  • Moving scattered client calls into resources.
  • Cross-package type inference improvements.
  • Documentation updates.

Acceptance Criteria

  • [ ] Old base methods and cache-management helpers are removed from the Resource class.
  • [ ] Model and Collection classes and any force / JS-cache logic are removed.
  • [ ] No _v2-suffixed methods remain; each is restored to its original name, the old implementation replaced, and call sites updated.
  • [ ] No references to any removed method remain anywhere in the codebase.
  • [ ] Tests that referenced removed methods are updated; the full test suite passes.

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.

AlexVelezLl avatar Jul 23 '26 14:07 AlexVelezLl

Plan: Delete the legacy Model/Collection resource layer and its cache machinery from packages/kolibri/apiResource.js, and drop the _v2 suffix from every temporary custom method (issue #15068).

  • [ ] Move the last fetchModel / fetchCollection consumers onto retrieve / list
  • [ ] Rename TaskResource's _v2 methods
  • [ ] Rename ContentNodeResource / ContentNodeProgressResource _v2 methods and delete their base-method overrides
  • [ ] Rename the remaining _v2 methods
  • [ ] Delete the old base surface from Resource
  • [ ] Point the two docs pages at the surviving methods
  • [ ] Self-review the produced code

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
  • Ran the project's full test suite and linter before committing
  • For UI changes: captured live screenshots to verify rendering
  • For backend changes: verified with example API/CLI output

rtibblesbot avatar Aug 31 '26 13:08 rtibblesbot