Public: anyone can read this; the crew can change it.
sitemap.xml and llms.txt leave archived repositories out #3483
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/3476-sitemap-xml-and-llms-txt-leave-archived → main 1 commit fork
3 files
changed +32
−2
src/core/listings.ts +4 −1
| @@ -59,7 +59,10 @@ export function llmsRepos(db: Database): readonly string[] { | ||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | function names(db: Database, limit: number): string[] { |
| 62 | return listReposVisibleTo(db, undefined, { limit }).map( | |
| 62 | return listReposVisibleTo(db, undefined, { | |
| 63 | limit, | |
| 64 | withoutArchived: true, | |
| 65 | }).map( | |
| 63 | 66 | (r) => `${r.ownerName}/${r.name}`, |
| 64 | 67 | ); |
| 65 | 68 | } |
src/core/repos.ts +1
| @@ -1117,6 +1117,7 @@ export function moveArchived( | ||
| 1117 | 1117 | : db |
| 1118 | 1118 | .query("UPDATE repo SET archived_at = NULL WHERE id = ?1 AND archived_at IS NOT NULL") |
| 1119 | 1119 | .run(repoId).changes; |
| 1120 | if (changes === 1) forgetListings(db); | |
| 1120 | 1121 | return changes === 1; |
| 1121 | 1122 | } |
| 1122 | 1123 |
test/standards.test.ts +27 −1
| @@ -19,7 +19,7 @@ import { markPng } from "../src/design/mark.ts"; | ||
| 19 | 19 | import { createUser, type User } from "../src/core/users.ts"; |
| 20 | 20 | import { forgetListings, listingBuilds } from "../src/core/listings.ts"; |
| 21 | 21 | import { createOrg, retireOrg } from "../src/core/orgs.ts"; |
| 22 | import { getRepo } from "../src/core/repos.ts"; | |
| 22 | import { getRepo, moveArchived } from "../src/core/repos.ts"; | |
| 23 | 23 | import { serve, type Servers } from "../src/http/server.ts"; |
| 24 | 24 | |
| 25 | 25 | describe("what the open web expects", () => { |
| @@ -201,6 +201,32 @@ describe("what the open web expects", () => { | ||
| 201 | 201 | expect(await lists()).not.toContain("gone-co/ledger"); |
| 202 | 202 | }); |
| 203 | 203 | |
| 204 | test("an archived repository leaves the listings, and waking it brings it back", async () => { | |
| 205 | const made = await createRepo(app, alice, { | |
| 206 | name: "shelved", | |
| 207 | visibility: "public", | |
| 208 | }); | |
| 209 | if (!made.ok) throw new Error(String(made.error)); | |
| 210 | const repo = getRepo(app.db, "alice", "shelved")!; | |
| 211 | const lists = async () => | |
| 212 | ( | |
| 213 | await Promise.all( | |
| 214 | ["/sitemap.xml", "/llms.txt"].map((p) => | |
| 215 | fetch(`${base}${p}`).then((x) => x.text()), | |
| 216 | ), | |
| 217 | ) | |
| 218 | ).join("\n"); | |
| 219 | forgetListings(app.db); | |
| 220 | expect(await lists()).toContain("alice/shelved"); | |
| 221 | moveArchived(app.db, repo.id, true); | |
| 222 | const hidden = await lists(); | |
| 223 | expect(hidden).not.toContain("alice/shelved"); | |
| 224 | expect(hidden).toContain("alice/open"); | |
| 225 | expect((await fetch(`${base}/alice/shelved`)).status).toBe(200); | |
| 226 | moveArchived(app.db, repo.id, false); | |
| 227 | expect(await lists()).toContain("alice/shelved"); | |
| 228 | }); | |
| 229 | ||
| 204 | 230 | test("the manifest is installable and its icons are real PNGs", async () => { |
| 205 | 231 | const res = await fetch(`${base}/manifest.webmanifest`); |
| 206 | 232 | expect(res.headers.get("content-type")).toContain( |
new above
offline