Skip to content

feat(repo-browser): show artifact cache cached_at + expires_at on details dialog (Remote repos) #449

@knowinglyAnonymous

Description

@knowinglyAnonymous

Problem Statement

The artifact-details dialog (opened from the Artifacts tab on a repo detail page) shows static fields like Name, Path, Size, Content Type, and Created. For a Remote (proxy) repository it does NOT show when the cached copy of the artifact will expire, which is exactly the field operators need before deciding whether to wait for the natural refresh or hit the "Invalidate cache" button shipped via #446 / #447.

Proposed Solution

Once the backend exposes the per-artifact cache metadata (companion issue: artifact-keeper#... — backend issue link will be added in the PR description once filed), surface those fields in the existing artifact-details dialog details tab in repo-detail-content.tsx:

  • New DetailRow for "Cached" (relative time + absolute timestamp tooltip), populated from cache_cached_at. Hidden when the value is absent.
  • New DetailRow for "Cache expires" with relative-time formatting (e.g. "in 4 hours" or "expired 12 minutes ago, will re-fetch on next download"). Hidden when the value is absent.
  • Both rows only render when repository.repo_type === "remote" AND the backend response actually included the fields. Local / Virtual / Staging repos do not have a proxy cache, so the rows never appear there.
  • Sits next to the new "Invalidate cache" button so the operator can read the expiry state and act on it in the same panel.

The existing Artifact local type (src/types/index.ts or wherever it lives) gets two new optional fields mirroring the backend's optional response fields. The adaptArtifact helper in src/lib/api/artifacts.ts plumbs them through.

Alternatives Considered

  • Inline badge on the artifact row in the table. Cluttered for long lists; the dialog is the right place for this level of detail.
  • Polling the cache state every N seconds while the dialog is open. Premature optimisation — operators reading this panel are deciding whether to invalidate, so a stale-by-a-minute display is fine. Can be revisited if real usage shows otherwise.
  • Show only expires_at and not cached_at. Tempting, but having both makes "this entry is fresh" vs. "this entry is about to flip stale" much clearer, especially for short-TTL repos.

Use Case

As a repo admin, when I open the details for a cached artifact in a remote (proxy) repository, I want to immediately see "Cache expires in 4 hours" so I can choose between waiting for the natural refresh and clicking "Invalidate cache" right now. Today the dialog gives me no signal at all about cache freshness.

Component

Repository Browser

Additional Context

Pre-submission Checklist

  • Searched existing issues to make sure this is not a duplicate.
  • Reviewed the docs / UI to confirm these rows do not already exist.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions