Skip to content

api: add versions to 'latest' API result#1577

Open
efahl wants to merge 1 commit intoopenwrt:mainfrom
efahl:expose-versions
Open

api: add versions to 'latest' API result#1577
efahl wants to merge 1 commit intoopenwrt:mainfrom
efahl:expose-versions

Conversation

@efahl
Copy link
Contributor

@efahl efahl commented Feb 11, 2026

In order to present a valid list of versions, downstream clients are currently parsing the upstream '.versions.json' and synthesizing (or not) a '-SNAPSHOT' version. Since we're doing this already inside ASU, we might as well make it available to clients.

This will allow us to rewrite Firmware Selector, which has a hard-coded regex to filter unsupported versions (which is currently wrong). With this change OFS will rely completely on the ASU server to tell it what is available.

Likewise, this allows a cleanup of owut to remove its similar parsing of the branches and .versions files.

It has no impact on LuCI ASU app, as it only uses the 'latest' list from this API call.


Additional comments

Should this actually be a new API: api/v1/versions instead of piling it onto the existing api/v1/latest??? This was simple and all the clients are already grabbing latest, so it seems like a good fit, but the endpoint name isn't the greatest.


Here's that regex, this PR pretty much eliminates all that code turning it into versions = get("api/v1/latest").versions and filtering out the -SNAPSHOT versions if the show_snapshot setting is turned off.

https://github.com/openwrt/firmware-selector-openwrt-org/blob/ea04cec0c9a507db3dabbc97ca6b6db4a58258e8/www/index.js#L828

In order to present a valid list of versions, downstream clients are
currently parsing the upstream '.versions.json' and synthesizing
(or not) a '-SNAPSHOT' version.  Since we're doing this already
inside ASU, we might as well make it available to clients.

This will allow us to rewrite Firmware Selector, which has a
hard-coded regex to filter unsupported versions (which is currently
wrong).  With this change OFS will rely completely on the ASU server
to tell it what is available.

Likewise, this allows a cleanup of owut to remove its similar
parsing of the branches and .versions files.

It has no impact on LuCI ASU app, as it only uses the 'latest'
list from this API call.

Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.97%. Comparing base (5e65dec) to head (ee8288b).
⚠️ Report is 347 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1577       +/-   ##
===========================================
+ Coverage   80.75%   91.97%   +11.21%     
===========================================
  Files          15       16        +1     
  Lines         977     1745      +768     
===========================================
+ Hits          789     1605      +816     
+ Misses        188      140       -48     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@efahl
Copy link
Contributor Author

efahl commented Feb 11, 2026

And some more comments:

We're already using settings.enabled appropriately, but I think some branches are out of date.

I'd like for the reload_versions code to only supply a xxx-SNAPSHOT for those branches that actually have them, so...

The settings.snapshot attribute is currently unused in the code, it's simply reported to clients in the overview. Can we make it mean "this branch has a -SNAPSHOT available", so as of this week's archive cleanups it would be false for 23.05, but true for 24.10 and 25.12? Or should we have another attribute snapshots_available to do that?

I'm looking at line 24 in the asu_schema.json of your refactoring PR.

"description": "Whether this is a snapshot (rolling) branch. Defaults to false."

could be "Whether this branch has a rolling (snapshot) version..."

EDIT:
I just dug through all of OFS, owut and LuCI app, none of them use the overview.branch[*].snapshot setting anywhere...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant