Migrate user_profile to the new resource-layer methods - #15183
Migrate user_profile to the new resource-layer methods#15183rtibblesbot wants to merge 5 commits into
Conversation
Build Artifacts
Smoke test screenshot |
02adddd to
70dcce6
Compare
|
|
70dcce6 to
8df7091
Compare
|
Resolved without intervention: a fresh run on the same SHA (31629087140) built the EXE green. No re-run needed. |
|
Added a QA steps section to the body — same request as on #15182, applied across the family's open PRs. |
AlexVelezLl
left a comment
There was a problem hiding this comment.
Just couple of small details :).
| /** | ||
| * @name fetchModel | ||
| * @function | ||
| * @returns {NetworkLocation} | ||
| */ | ||
|
|
||
| /** | ||
| * @name fetchCollection | ||
| * @function | ||
| * @returns {NetworkLocation[]} | ||
| */ |
There was a problem hiding this comment.
Lets also remove these comments, please.
There was a problem hiding this comment.
Gone — all six. grep -rn "@name fetch\(Model\|Collection\)" over kolibri/ and packages/ matches only this file: two stubs in each of the three resources. Same deletion as #15163's hunk.
| function updateConnectionStatus(id) { | ||
| const url = urls['kolibri:core:networklocation_update_connection_status'](id); | ||
| return this.client({ url, method: 'post' }).then(response => { | ||
| return response.data; | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Fetch the facilities advertised by a remote network location. | ||
| * @param {string} id - network location id | ||
| * @returns {{facilities: [{id: string}]}} the facilities listing from the remote device | ||
| */ | ||
| function fetchFacilities(id) { | ||
| return this.client({ | ||
| url: urls['kolibri:core:networklocation_facilities_detail'](id), | ||
| }).then(response => { | ||
| return response.data; | ||
| }); | ||
| } |
There was a problem hiding this comment.
Could we turn this into the NetworkLocationResource object and use this.request instead?
There was a problem hiding this comment.
Done — fetchFacilities is now a NetworkLocationResource method over this.request; the standalone and the _v2 sibling I had added are both gone.
- The standalone resolved
networklocation_facilities_detailfor all three resources, so the static and dynamic registrations pointed at thenetworklocationendpoint regardless.requestcannot do that, and nothing called them — dropped. grep -rn "NetworkLocationResource\.fetchFacilities": one caller,SelectDeviceModalGroup/api.js:46, onNetworkLocationResourceand unchanged.SelectFacility.vue:125is back tofetchFacilities, so that file no longer differs from develop.updateConnectionStatusis the same shape in this file, but it is Migrate kolibri-common to the new resource methods #15163's to rewrite — left alone so two branches do not both move it.
There was a problem hiding this comment.
Landed in develop via #15163 while this sat — fetchFacilities_v2 and updateConnectionStatus_v2 on NetworkLocationResource over this.request, and the @name stubs gone. That covers this thread and the two siblings on this file.
The rebase takes develop's copy whole, so NetworkLocationResource.js is out of this PR's diff; user_profile now calls fetchFacilities_v2 at SelectFacility.vue:125.
8df7091 to
ac94342
Compare
|
Red again on |
| @@ -32,69 +32,27 @@ function updateConnectionStatus(id) { | |||
| }); | |||
| } | |||
There was a problem hiding this comment.
Should we move this one, too?
There was a problem hiding this comment.
Done — updateConnectionStatus is now a NetworkLocationResource method over this.request({ method: 'POST', action: 'update_connection_status', routeParams: id }), same URL and verb as the hardcoded urls[...] call. Its only caller (SelectDeviceModalGroup/api.js:75) is unchanged.
Swept the branch for the same class — legacy this.client({ url: urls[...] }) custom methods on any resource this PR touches: one file matched (git diff --name-only upstream/develop...HEAD | xargs grep -l "this.client("), and it had exactly this one function left. urls is now an unused import there and is dropped.
Static/dynamic registrations dropped too: grep -rn "StaticNetworkLocationResource\|DynamicNetworkLocationResource" shows only create/delete calls in api.js, so neither updateConnectionStatus was ever called.
No spec here for the same reason as fetchFacilities — #15163 adds NetworkLocationResource.spec.js covering both, and a partial copy would be an add/add conflict. Verified locally with a throwaway spec: URL .../networklocation_update_connection_status/dev-1, method POST, resolves response.data.
f9aea87 to
2c14075
Compare
|
Removed the |
2c14075 to
5f55fd2
Compare
|
Rebased onto Re-verified after the rebase: Also re-swept the AC over the 141 new develop commits, in case one had landed a legacy call in this plugin: |
|
Holding off on changes while this PR is in Change the board status when QA is done and I'll pick up any outstanding review feedback, CI failures and conflicts on the next cycle. @rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly How was this generated?
|
|
Hey @rtibblesbot! Please rebase. |
`fetchFacilities_v2` landed on `NetworkLocationResource` with learningequality#15163. The legacy standalone stays in place: the resource is shared outside this plugin, so learningequality#15057 moves the call site only. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The read and the writes move together: `fetchModel` is what marked the model
synced, which is what made `saveModel(..., { exists: true })` PATCH a diff
rather than the whole cached object.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`force: true` has no successor — the cache it bypassed is gone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The spec factory drops `clear` rather than keeping it, so a missed call site throws instead of passing silently. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
5f55fd2 to
07b312f
Compare
|
Rebased onto #15163 merged there in the meantime with the same Re-swept the plugin for the class afterwards —
|
|
@rtibblesbot Once this is ready for the manual testing (labeled Needs QA, could you please separate clearly the QA guidelines for code review (if necessary) from the instructions for manual QA? As of now they seem to be mixed... 🤔 |
|
Split, @radinamatic — Reviewer guidance now has What moved out of the QA half: the Swept my other five open PRs for the same mix: four matched, three needed the fix.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly |
Summary
retrieve/list, the two profile writes becomeupdate, the profile page's user read becomesuseRetrieve.fetchFacilities_v2, added by Migrate kolibri-common to the new resource methods #15163.References
user_profileto the new Resource-layer methods #15064. Recipe Migrate all plugins and shared packages to the new Resource-layer methods #15057, methods Add new simplified Resource-layer methods (additive, non-breaking) #15056.Reviewer guidance
Code review
For a developer reading the diff.
SelectFacility.vue:125—NetworkLocationResourceis shared outside this plugin, so the recipe's shared-_v2branch applies: the call site moves, the legacy standalone stays for the static/dynamic resources.actions.js:13—updategets nobaseline;ProfileEditPage.getUpdates()(:181) already diffs against the loaded user. The save is still a single-fieldPATCH /api/auth/facilityuser/<id>/.ProfilePage.spec.js:31— the module automock is dropped: it stubsuseRetrievetoo, so the spec spies on the realretrieve.force(useCurrentUser,ProfileEditPage.vue:173) now always hit the network, and aMergeFacilitypoll tick coalesces onto an in-flight GET rather than queueing behind it.useCurrentUserno longer leavesisLoadingtrue after a failed fetch.clear_v2resolvesresponse.data, which all three call sites discard.retrieve,clear_v2) needs one user on two devices, soMergeFacility.spec.jsis its only cover./profile/#/editreports one KDSKSelectplaceholder-contrast axe AA violation, present on develop too; no markup or style line is in this diff.QA steps
For a tester installing the build artifacts in a VM. No UI change — every screen below should behave as on develop. Rows 3 and 6 need a second user in the facility; rows 5 and 6 need a second VM on the network running any released Kolibri.
AI usage
Claude Code applied the shared migration recipe and rewrote the two specs whose mocks named the replaced methods. Verified with Jest, prek, and manual QA in a browser against a local server.
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
🟡 Waiting for feedback
Last updated: 2026-08-25 00:29 UTC