mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-16 03:40:37 +08:00
Move repo facts outside the project payload
Repos need not carry a `xyz.radicle.project` payload; the default branch can come from `xyz.radicle.crefs` alone. Such repos got no counts and no default branch, and failed schema validation in explorer, which broke the parse of a whole listing. httpd: - Add top-level `cobs` with issue, patch and bucketed release counts - Add top-level `defaultBranch`, qualified like the crefs payload - Omit a count the node cannot determine instead of reporting zero - Drop `head`: the tip is `refs[defaultBranch]` - Keep counts in the project payload for older clients until a major release - Keep the project payload when a COB read fails - Keep `meta.releases` a single count: delegate + other - Log and skip canonical ref rules and refs that fail to read, so one bad ref doesn't drop the default branch tip explorer: - Model `cobs` and `defaultBranch`, adapting older nodes to one shape - Resolve the default branch from the crefs HEAD on older nodes - Collect the shims for older httpd in http-client/lib/compat.ts, each naming the httpd release that the client can drop it with - Add `defaultBranchTip`, replacing `head`, with a fallback to the legacy `meta.head` - Make the project payload and its legacy meta optional - Fall back to the RID for the repo name, and show a placeholder for a missing name in repo cards and the header - Hide a counter instead of reading a missing count as zero - Fall back to a full-page check for "More" without counts - Add a `repo.sourceUnavailable` route for repos without a default branch or tip - Browse explicit revisions and offer the branch selector without a default branch - List these repos in repo grids and on the landing page - Say the node is older or built without releases - Scope release pages in the client, so views never call the shims - Read OG worker repos through the same compat shims - Share the repo name and default branch helpers with the OG worker CI: - Add check:open-graph, a wrangler deploy dry run - Run it in GitHub CI, Buildkite and check:ci - Install explorer's dependencies first: the worker resolves compat.ts imports, such as zod, from there Tests: - Test that a build without releases omits the count - Test that one failing rule keeps the others - Test the repo shape across httpd versions and the release shims - Test `hasMorePages` and `repoName` - Test repos without a project payload end to end
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import {
|
||||
absoluteTimestamp,
|
||||
defaultBranchTip,
|
||||
formatTimestamp,
|
||||
formatRepositoryId,
|
||||
repoSegment,
|
||||
@@ -28,6 +29,7 @@
|
||||
$: project = repoInfo.repo.payloads["xyz.radicle.project"];
|
||||
$: baseUrl = repoInfo.baseUrl;
|
||||
$: isPrivate = repo.visibility.type === "private";
|
||||
$: tip = defaultBranchTip(repo);
|
||||
</script>
|
||||
|
||||
<style>
|
||||
@@ -126,6 +128,14 @@
|
||||
padding: 0.25rem;
|
||||
}
|
||||
|
||||
.name-placeholder {
|
||||
align-self: center;
|
||||
height: 1rem;
|
||||
width: 40%;
|
||||
border-radius: var(--border-radius-sm);
|
||||
background-color: var(--color-surface-mid);
|
||||
}
|
||||
|
||||
.stats-row {
|
||||
position: relative;
|
||||
display: flex;
|
||||
@@ -162,11 +172,15 @@
|
||||
<div class="headline-and-badges txt-overflow">
|
||||
<div class="icon">
|
||||
<RepoAvatar
|
||||
rid={repoInfo.repo.rid}
|
||||
name={project.data.name}
|
||||
rid={repo.rid}
|
||||
name={project?.data.name ?? ""}
|
||||
styleWidth="1.5rem" />
|
||||
</div>
|
||||
<div class="txt-body-l-semibold" use:twemoji>{project.data.name}</div>
|
||||
{#if project}
|
||||
<div class="txt-body-l-semibold" use:twemoji>{project.data.name}</div>
|
||||
{:else}
|
||||
<div class="name-placeholder" title="This repository has no name"></div>
|
||||
{/if}
|
||||
<div class="badges" style:margin-left="auto">
|
||||
{#if isPrivate}
|
||||
<div
|
||||
@@ -182,7 +196,7 @@
|
||||
<div class="content-and-activity">
|
||||
<div class="content">
|
||||
<div class="txt-body-m-regular txt-overflow" use:twemoji>
|
||||
{project.data.description}
|
||||
{project?.data.description ?? ""}
|
||||
</div>
|
||||
<span style:text-overflow="ellipsis">
|
||||
<Id id={repo.rid} title={repo.rid}>
|
||||
@@ -207,20 +221,26 @@
|
||||
class="stats-row txt-code-regular"
|
||||
style:color="var(--color-text-tertiary)">
|
||||
<Icon name="seed" />
|
||||
{repoInfo.repo.seeding} ·
|
||||
<Icon name="issue" />
|
||||
{project.meta.issues.open} ·
|
||||
<Icon name="patch" />
|
||||
{project.meta.patches.open}
|
||||
{#await api.repo.getCommitBySha(repo.rid, project.meta.head) then { commit }}
|
||||
<span
|
||||
class="txt-body-m-regular"
|
||||
style:margin-left="auto"
|
||||
style:overflow="hidden"
|
||||
style:text-overflow="ellipsis"
|
||||
title={absoluteTimestamp(commit.committer.time)}>
|
||||
Updated {formatTimestamp(commit.committer.time)}
|
||||
</span>
|
||||
{repo.seeding}
|
||||
{#if repo.cobs?.issues && repo.cobs.patches}
|
||||
·
|
||||
<Icon name="issue" />
|
||||
{repo.cobs.issues.open} ·
|
||||
<Icon name="patch" />
|
||||
{repo.cobs.patches.open}
|
||||
{/if}
|
||||
{#await tip && api.repo.getCommitBySha(repo.rid, tip) then result}
|
||||
{#if result}
|
||||
{@const commit = result.commit}
|
||||
<span
|
||||
class="txt-body-m-regular"
|
||||
style:margin-left="auto"
|
||||
style:overflow="hidden"
|
||||
style:text-overflow="ellipsis"
|
||||
title={absoluteTimestamp(commit.committer.time)}>
|
||||
Updated {formatTimestamp(commit.committer.time)}
|
||||
</span>
|
||||
{/if}
|
||||
{/await}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,18 +24,16 @@ export async function fetchRepoInfos(
|
||||
repos = await api.repo.getAll(query);
|
||||
}
|
||||
|
||||
return repos
|
||||
.filter(r => Boolean(r.payloads["xyz.radicle.project"]))
|
||||
.map(repo => ({
|
||||
repo,
|
||||
baseUrl,
|
||||
activity: loadRepoActivity(repo.rid, baseUrl, activitySignal).catch(e => {
|
||||
if (import.meta.env.DEV && (e as Error)?.name !== "AbortError") {
|
||||
console.warn("loadRepoActivity failed for", repo.rid, e);
|
||||
}
|
||||
return [];
|
||||
}),
|
||||
}));
|
||||
return repos.map(repo => ({
|
||||
repo,
|
||||
baseUrl,
|
||||
activity: loadRepoActivity(repo.rid, baseUrl, activitySignal).catch(e => {
|
||||
if (import.meta.env.DEV && (e as Error)?.name !== "AbortError") {
|
||||
console.warn("loadRepoActivity failed for", repo.rid, e);
|
||||
}
|
||||
return [];
|
||||
}),
|
||||
}));
|
||||
}
|
||||
|
||||
export async function sortRepoInfosByActivity(
|
||||
|
||||
Reference in New Issue
Block a user