kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

Migrate `packages/kolibri-common` to the new Resource-layer methods

Open AlexVelezLl opened this issue 4 months ago • 8 comments

❌ 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 packages/kolibri-common package to the new resource-layer methods, following the shared recipe in #15057.

Complexity: High Target branch: develop

Context

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

The Change

Apply the #15057 recipe to every resource usage in packages/kolibri-common:

  • Replace old base-method calls with the new ones (fetchModel→retrieve, fetchCollection→list, saveModel→create/update, deleteModel→delete, saveCollection→bulkCreate, deleteCollection→bulkDelete, 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 packages/kolibri-common; otherwise add/point at a _v2 shared method (see #15057).
  • Use useRetrieve / useList for reactive reads, if possible.

Acceptance Criteria

  • [ ] No code in packages/kolibri-common 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 packages/kolibri-common.

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

Watching for resolution on behalf of learningequality/kolibri#15062.

rtibblesbot avatar Aug 04 '26 14:08 rtibblesbot

Hey @rtibblesbot! I have unmarked the learn issues as a blocker. Could you start implementing this task now?

AlexVelezLl avatar Aug 07 '26 14:08 AlexVelezLl

Plan: Move every resource call site in packages/kolibri-common off the legacy Model/Collection methods onto the new Resource methods from #15056, per the #15057 recipe.

  • [x] ContentNodeResource.list writes through to the node cache
  • [x] Content-node and exam reads in the composables and quiz utils
  • [x] MasteryLogResource.fetchMostRecentDiff onto request, and the quiz report
  • [x] PortalResource onto request, and the two registration modals
  • [x] NetworkLocationResource _v2 methods and the device-selection API
  • [x] The sync-schedule components
  • [x] Facility composables and the impact-story banner
  • [x] Documentation sweep and acceptance greps
  • [x] 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 07 '26 18:08 rtibblesbot

All four acceptance criteria are met by PR #15163. The - [ ] boxes above cannot be ticked from this account — PATCH /issues/15061 returns rtibblesbot does not have the correct permissions to execute UpdateIssue. A maintainer needs to tick them.

Per-criterion evidence: https://github.com/learningequality/kolibri/pull/15163#issuecomment-5221272076


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

rtibblesbot avatar Aug 08 '26 00:08 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Aug 08 '26 06:08 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Aug 10 '26 17:08 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Aug 12 '26 19:08 rtibblesbot

The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.

rtibblesbot avatar Aug 13 '26 18:08 rtibblesbot