fix(version): compare published registry versions, not Last-Modified #93

Merged
Claude-Run merged 1 commit from fix/YT-37-version-check-compare-published-versions into main 2026-07-03 17:22:38 +02:00
Member

yt version check HEADed the latest/yt-linux-x86_64 artifact and compared its
Last-Modified header against the baked build date. The Forgejo Generic Package
registry serves no parseable Last-Modified, so the check always fell into the
"Could not determine remote build date" arm and was non-functional against the
real registry.

Replace that mechanism with a version-list comparison matching fj: GET the
Generic Package version list (/api/v1/packages/<owner>?type=generic&q=<name>,
derived from the baked download base), parse each entry, discard non-semver
entries such as the moving latest pointer, and take the highest v<semver>.
yt version check compares that maximum against CARGO_PKG_VERSION and prints
New version available (pointing at yt version update) or an up-to-date line.

yt version update's pre-download short-circuit uses the same comparison so it
stops always-downloading; --force still bypasses it. The Last-Modified
helper (fetch_remote_freshness / compare_build_dates / RemoteFreshness)
and the now-dead BAKED_BUILD_DATE const are removed, and the freshness tests
are rewritten to mock the version-list endpoint. Adds the semver crate for
correct precedence (0.10.0 > 0.9.0).

#YT-37

`yt version check` HEADed the `latest/yt-linux-x86_64` artifact and compared its `Last-Modified` header against the baked build date. The Forgejo Generic Package registry serves no parseable `Last-Modified`, so the check always fell into the "Could not determine remote build date" arm and was non-functional against the real registry. Replace that mechanism with a version-list comparison matching `fj`: GET the Generic Package version list (`/api/v1/packages/<owner>?type=generic&q=<name>`, derived from the baked download base), parse each entry, discard non-semver entries such as the moving `latest` pointer, and take the highest `v<semver>`. `yt version check` compares that maximum against `CARGO_PKG_VERSION` and prints `New version available` (pointing at `yt version update`) or an up-to-date line. `yt version update`'s pre-download short-circuit uses the same comparison so it stops always-downloading; `--force` still bypasses it. The `Last-Modified` helper (`fetch_remote_freshness` / `compare_build_dates` / `RemoteFreshness`) and the now-dead `BAKED_BUILD_DATE` const are removed, and the freshness tests are rewritten to mock the version-list endpoint. Adds the `semver` crate for correct precedence (0.10.0 > 0.9.0). #YT-37
fix(version): compare published registry versions, not Last-Modified
All checks were successful
Check / fmt + clippy + build + tests (pull_request) Successful in 24s
Create release / Create release from merged PR (pull_request) Has been skipped
123b8b8432
`yt version check` HEADed the `latest/yt-linux-x86_64` artifact and compared its
`Last-Modified` header against the baked build date. The Forgejo Generic Package
registry serves no parseable `Last-Modified`, so the check always fell into the
"Could not determine remote build date" arm and was non-functional against the
real registry.

Replace that mechanism with a version-list comparison matching `fj`: GET the
Generic Package version list (`/api/v1/packages/<owner>?type=generic&q=<name>`,
derived from the baked download base), parse each entry, discard non-semver
entries such as the moving `latest` pointer, and take the highest `v<semver>`.
`yt version check` compares that maximum against `CARGO_PKG_VERSION` and prints
`New version available` (pointing at `yt version update`) or an up-to-date line.

`yt version update`'s pre-download short-circuit uses the same comparison so it
stops always-downloading; `--force` still bypasses it. The `Last-Modified`
helper (`fetch_remote_freshness` / `compare_build_dates` / `RemoteFreshness`)
and the now-dead `BAKED_BUILD_DATE` const are removed, and the freshness tests
are rewritten to mock the version-list endpoint. Adds the `semver` crate for
correct precedence (0.10.0 > 0.9.0).

#YT-37
Claude-Run deleted branch fix/YT-37-version-check-compare-published-versions 2026-07-03 17:22:38 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
pandoras-box/youtrack-cli!93
No description provided.