Repository navigation
Conversation
a0402b9 to
b555d94
Compare
| if (!m) | ||
| throw new Error(_('Unable to parse the list of upgradable packages.')); |
There was a problem hiding this comment.
Throwing here rejects updateLists(), and nothing catches that rejection — updateLists(listData) at package-manager.js:1387`` runs inside requestAnimationFrame with no handler — so one odd line leaves the whole Software page stuck on the loading spinner, with Install/Remove unreachable too. `apk list -u` is human-readable output rather than a stable interface (unlike the `--format json` queries the other two actions use), so a provided/renamed package or an extra line is a realistic input. Degrade to skipping the line instead of killing the view.
| if (!m) | |
| throw new Error(_('Unable to parse the list of upgradable packages.')); | |
| if (!m) | |
| continue; |
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 4d30618. Unrecognized lines are now skipped, and one notification per parse warns that the update list may be incomplete. Valid entries still render. The regression test covers mixed valid/invalid output and entirely invalid output, and verifies that install/remove controls remain usable.
| ;; | ||
| list-upgradable) | ||
| if [ $ipkg_bin = "apk" ]; then | ||
| $ipkg_bin list -u |
There was a problem hiding this comment.
The list-installed and list-available apk branches above both redirect stderr; this one doesn't, so apk's index/signature warnings land in the rpcd log on every refresh.
| $ipkg_bin list -u | |
| $ipkg_bin list -u 2>/dev/null |
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 4d30618: added 2>/dev/null to the apk list -u branch, matching the other read-only queries. The command's exit status is preserved.
| const upgrade = L.hasSystemFeature('apk') ? packages.upgradable[name] : inst && inst.version !== pkg.version; | ||
|
|
||
| ver = truncateVersion(pkg.version || '-'); | ||
| ver = truncateVersion((upgrade && upgrade.version) || pkg.version || '-'); |
There was a problem hiding this comment.
- On the opkg path
upgradeis a boolean, soupgrade && upgrade.versionevaluatestrue.versionand relies on it beingundefinedto fall through topkg.version. Give the two paths separate variables, or keepupgradea package object in both. - On the apk path the row now mixes sources:
veris apk's candidate version while the size and description columns below still come frompackages.available.pkgs[name], which is exactly the other-repository candidate this PR set out to stop trusting.
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 4d30618. upgrade is now used only as a condition, with no property access on an opkg boolean. APK rows use the selected candidate consistently for version, size, description and filtering on both Updates and Available tabs. Missing candidate metadata stays unknown instead of falling back to another version. Installed-tab and opkg behavior are preserved. Added regression coverage for these cases.
| @@ -0,0 +1,110 @@ | |||
| 'use strict'; | |||
|
|
|||
| // Run with: node applications/luci-app-package-manager/tests/apk-upgradable.cjs | |||
There was a problem hiding this comment.
nit: nothing runs this — no workflow invokes it, and eslint.yml's filter is \.(js|json|md)$, so a .cjs file isn't even linted. Combined with the harness depending on the exact source string \nreturn view.extend({, it will silently rot on the next refactor of the view. The other two tests/ dirs in the tree ship a run_tests.sh; is there a runner planned for this one?
Generated by Claude Code
There was a problem hiding this comment.
Addressed in 4d30618. Added tests/run_tests.sh and a step invoking it in the existing ESLint workflow, reusing its Node setup. Renamed the test to .js so the current lint filter includes it. The harness now executes the complete, unmodified view source with vm.compileFunction() instead of matching/replacing the exact return view.extend text, and it exercises the actual pagination/table-rendering path. The runner and repository ESLint both pass locally; no new dependencies were added.
b555d94 to
4d30618
Compare
|
Cc: @systemcrash |
| } | ||
|
|
||
| if (skipped) | ||
| ui.addNotification(null, E('p', {}, _('Some upgrade entries could not be parsed. The update list may be incomplete.')), 'warning'); |
There was a problem hiding this comment.
nit: updateLists() runs again after every install/remove/upgrade,`` so a system with one persistently unparseable line gets a fresh banner per operation and LuCI notifications stack until dismissed. Consider raising it once per page load (module-level flag) or logging to the console instead.
Generated by Claude Code
There was a problem hiding this comment.
Addressed in cb0cff6. A module-level guard now limits this warning to once per page load; updateLists() does not reset it. Regression coverage verifies repeated refreshes, dismissal followed by valid/invalid refreshes, and that loading a fresh view allows the warning again.
| - name: Test package manager | ||
| run: sh applications/luci-app-package-manager/tests/run_tests.sh |
There was a problem hiding this comment.
nit: this step is unscoped and sits before the lint steps, so a failure in one app's test turns the repo-wide ESLint check red on unrelated PRs and skips the lint output they came for. A separate job (here or in its own workflow) keeps the two results independent.
Generated by Claude Code
There was a problem hiding this comment.
Addressed in cb0cff6. Moved the runner into a dedicated package-manager.yml workflow with path filters for this package and the workflow itself. It has no dependency on ESLint and uses Node.js 24 with read-only repository permissions. The existing ESLint workflow is now unchanged by this PR, so a package-manager test failure no longer suppresses lint output or runs on unrelated-only changes. The runner, repository ESLint and local workflow/path-filter checks pass.
4d30618 to
cb0cff6
Compare
cb0cff6 to
604fbab
Compare
|
If you're going to scrape apk text output, you should consider using $ apk version
Installed: Available:
libopenssl-conf-3.5.8-r2 < 3.5.8-r3
libopenssl3-3.5.8-r2 < 3.5.8-r3
libusb-1.0-0-1.0.29-r1 < 1.0.29-r2
luci-26.256.49187~22e4e76 < 26.257.65361~d19bf13
luci-app-attendedsysupgrade-26.256.49187~22e4e76 < 26.257.65361~d19bf13
luci-app-firewall-26.256.49187~22e4e76 < 26.257.65361~d19bf13
... |
Read apk list -u through the package manager wrapper instead of inferring APK upgrades from the available version with the JavaScript comparator. This avoids false upgrades for hash-based versions and packages installed from tagged repositories. Use the native list for both the Updates tab and available-package upgrade buttons. Use matching candidate metadata for versions, sizes, descriptions and details. Skip unrecognized output lines and warn once per page load instead of rejecting the page refresh. Keep opkg and package operations unchanged. Add a dependency-free Node regression check with a shell runner and a path-filtered workflow independent of ESLint. Cover filtering, candidate metadata, malformed output, warning deduplication, refreshes, command failures and the opkg path. Signed-off-by: Terry Tang <terrytyc@gmail.com>
dadc9d6 to
7e19655
Compare
Pull request details
Description
Use
apk list -uas the source of APK upgrade candidates instead of inferring upgrades from the available-package map with the JavaScript version comparator.The Updates tab can disagree with the command line: in the reported case LuCI shows four updates while
apk list -ulists onlyappfilterandbase-files. A kernel hash is compared as numeric version components, and a package installed from a tagged repository is compared against a different repository's version.This change:
list-upgradablewrapper action and its exact RPC file ACL entry.apk list -uis intentional: this lists available upgrades, not anapk upgrade --simulatetransaction. Execution-time constraints remain the package manager's responsibility.Originally submitted as immortalwrt/luci#709; submitted upstream at an ImmortalWrt maintainer's request. This PR is based directly on OpenWrt LuCI master
289a7260434d4b8212a9cc6cf6160cb1935270c1, without downstream-only commits.Tests
Run the dependency-free regression check:
A dedicated
.github/workflows/package-manager.ymlworkflow invokes this runner on Node.js 24, only for changes toapplications/luci-app-package-manager/**or the workflow itself. It runs independently of ESLint; the ESLint workflow is unchanged by this PR. The test is named.jsso it remains included in ESLint's existing lint filter. The harness executes the complete, unmodified view source in a function instead of rewriting an exactreturn view.extendsource string.It covers the four-versus-two discrepancy, tagged candidate metadata/version selection, Available-tab buttons, upgrade details, numeric/hyphenated names, revisions, duplicate candidates, empty-list refreshes, mixed valid/invalid and entirely invalid output, incomplete-list warning deduplication across refreshes and after dismissal, warning reset on a fresh view load, missing candidate metadata, command failure propagation, the read ACL and unchanged opkg behavior.
git diff --checkpassed.Tested on
26.236.50544~cb5d434: equivalent ports of the initial list-alignment change and the first review revision (4d306187) were deployed and verified in Microsoft Edge. After reloading the frontend script, the Updates tab showed onlyappfilterandbase-files, matchingapk list -u.Checklist
PKG_VERSIONorPKG_RELEASEis defined in this package's Makefile to increment.