fix: show local-repo files in the cached-objects UI #99

Merged
benvin merged 1 commits from benvin/local-repo-objects-ui into master 2026-07-03 14:46:41 +10:00
Owner

Why

Local repos store uploaded files in the `local_files` table, whereas remote/proxy repos cache into the `artifacts` table. The shared Cached Objects page always queried the artifacts table via `/api/v2/remotes/{name}/objects`, so files uploaded to a local repo (e.g. an internal RPM) were fully stored and servable but showed as 0 objects in the UI.

Changes

  • Add `ListLocalArtifacts`, joining `local_files` with `blobs` and returning `models.Artifact`-shaped rows (size from the blob; access/fetch counters zero and timestamps derived from `created_at`, since local files track no access).
  • Add `LocalRoutes` to the objects handler: `listLocal` reads `local_files`, `evictLocal` deletes via `DeleteLocalFile`. Extract shared page/per_page parsing into `pageBounds`.
  • Mount `/api/v2/locals/{name}/objects` (GET + DELETE) in the server.
  • Add `listLocalObjects`/`evictLocalObject` to the UI client and route the Objects page to them when viewing a local repo.
  • Cover the listing and eviction paths with a dockerised test.

Notes

Generated `repodata/*` files are not listed — they are produced on the fly from `rpm_metadata` and never stored in `local_files`, which matches how the repo serves them.

## Why Local repos store uploaded files in the \`local_files\` table, whereas remote/proxy repos cache into the \`artifacts\` table. The shared **Cached Objects** page always queried the artifacts table via \`/api/v2/remotes/{name}/objects\`, so files uploaded to a local repo (e.g. an internal RPM) were fully stored and servable but showed as **0 objects** in the UI. ## Changes - Add \`ListLocalArtifacts\`, joining \`local_files\` with \`blobs\` and returning \`models.Artifact\`-shaped rows (size from the blob; access/fetch counters zero and timestamps derived from \`created_at\`, since local files track no access). - Add \`LocalRoutes\` to the objects handler: \`listLocal\` reads \`local_files\`, \`evictLocal\` deletes via \`DeleteLocalFile\`. Extract shared page/per_page parsing into \`pageBounds\`. - Mount \`/api/v2/locals/{name}/objects\` (GET + DELETE) in the server. - Add \`listLocalObjects\`/\`evictLocalObject\` to the UI client and route the Objects page to them when viewing a local repo. - Cover the listing and eviction paths with a dockerised test. ## Notes Generated \`repodata/*\` files are not listed — they are produced on the fly from \`rpm_metadata\` and never stored in \`local_files\`, which matches how the repo serves them.
unkinben added 1 commit 2026-07-03 14:44:29 +10:00
fix: show local-repo files in the cached-objects UI
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
47bc8cb517
Local repos store uploaded files in the local_files table, while
remote/proxy repos cache into the artifacts table. The shared "Cached
Objects" page always queried the artifacts table via
/api/v2/remotes/{name}/objects, so local packages (e.g. an uploaded RPM)
were servable but listed as "0 objects" in the UI.

- add ListLocalArtifacts, joining local_files with blobs and returning
  models.Artifact-shaped rows (size from the blob; counters zero and
  timestamps derived from created_at, since local files track no access)
- add LocalRoutes to the objects handler: listLocal reads local_files,
  evictLocal deletes via DeleteLocalFile; extract shared page parsing
  into pageBounds
- mount /api/v2/locals/{name}/objects (GET + DELETE) in the server
- add listLocalObjects/evictLocalObject to the UI client and route the
  Objects page to them when viewing a local repo
- cover the listing and eviction paths with a dockerised test
benvin merged commit 787de74b3d into master 2026-07-03 14:46:41 +10:00
benvin deleted branch benvin/local-repo-objects-ui 2026-07-03 14:46:42 +10:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/artifactapi#99