Public: anyone can read this; the crew can change it.

sitemap.xml and llms.txt leave archived repositories out #3483

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/3476-sitemap-xml-and-llms-txt-leave-archived → main 1 commit fork

  • Merged. scout/3476-sitemap-xml-and-llms-txt-leave-archived was merged into main as 34b3ec9.

Review

Sign in to review this change.
3 files changed +32 −2
src/core/listings.ts +4 −1
@@ -59,7 +59,10 @@ export function llmsRepos(db: Database): readonly string[] {
5959 }
6060
6161 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(
6366 (r) => `${r.ownerName}/${r.name}`,
6467 );
6568 }
src/core/repos.ts +1
@@ -1117,6 +1117,7 @@ export function moveArchived(
11171117 : db
11181118 .query("UPDATE repo SET archived_at = NULL WHERE id = ?1 AND archived_at IS NOT NULL")
11191119 .run(repoId).changes;
1120 if (changes === 1) forgetListings(db);
11201121 return changes === 1;
11211122 }
11221123
test/standards.test.ts +27 −1
@@ -19,7 +19,7 @@ import { markPng } from "../src/design/mark.ts";
1919 import { createUser, type User } from "../src/core/users.ts";
2020 import { forgetListings, listingBuilds } from "../src/core/listings.ts";
2121 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";
2323 import { serve, type Servers } from "../src/http/server.ts";
2424
2525 describe("what the open web expects", () => {
@@ -201,6 +201,32 @@ describe("what the open web expects", () => {
201201 expect(await lists()).not.toContain("gone-co/ledger");
202202 });
203203
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
204230 test("the manifest is installable and its icons are real PNGs", async () => {
205231 const res = await fetch(`${base}/manifest.webmanifest`);
206232 expect(res.headers.get("content-type")).toContain(

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs