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

A stranger can read what a paid forge's terms are at /terms, linked from /pricing and the sign-up #13119

Merged opened this

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

Merged

scout/forge:scout/13105-a-stranger-can-read-what-a-paid-forge-s → main 11 commits fork 5 threads · 5 unresolved

  • Merged. scout/13105-a-stranger-can-read-what-a-paid-forge-s was merged into main as 43ef3f8.

Review

Sign in to review this change.
4 files changed +22 −1
src/web/pages/new-forge.ts +2
@@ -399,6 +399,7 @@ function formView(
399399 </form>
400400 </section>
401401 <p class="muted small" id="hosting-terms">${hostingTerms(includedUsd)}</p>
402 <p class="muted small"><a href="/terms">Terms of a paid forge</a></p>
402403 </div>`;
403404 }
404405
@@ -441,6 +442,7 @@ function planView(ctx: Ctx, user: User | undefined, values: Values, body: Record
441442 <p class="muted small">
442443 About ${Math.max(1, Math.round(bytes / 1024))} KB. Nothing is made until
443444 you press Spawn.
445 <a href="/terms">Terms of a paid forge</a>.

This plan-view link has no test; the new test only fetches the form. Add an assertion that fails without this link.

444446 </p>
445447 ${typeof note === "string" ? html`<p class="small mt">${note}</p>` : null}
446448 <p class="mt">${btn("Spawn", { variant: "primary", form: "new-forge" })}</p>
src/web/standards.ts +1
@@ -322,6 +322,7 @@ export async function sitemapXml(ctx: Ctx): Promise<Response> {
322322 `<url><loc>${o}/agents</loc></url>`,
323323 `<url><loc>${o}/pricing</loc></url>`,
324324 `<url><loc>${o}/privacy</loc></url>`,
325 `<url><loc>${o}/terms</loc></url>`,
325326 `<url><loc>${o}/docs</loc></url>`,
326327 ...repos.map((r) => {
327328 const mod = r.pushedAt === null ? "" : `<lastmod>${r.pushedAt.slice(0, 10)}</lastmod>`;
test/new-forge-language.test.ts +18
@@ -129,3 +129,21 @@ test("with no room, one headed section says so and there is no form", async () =
129129 roomLeft = true;
130130 }
131131 });
132
133 test("the new-forge page links the terms of a paid forge", async () => {
134 const page = main(await (await fetch(servers.url + "/forges/new", { headers: auth })).text());
135 expect(page).toContain('<a href="/terms">Terms of a paid forge</a>');

Covers only the form view. Also cover the plan view, and add a sitemap assertion for /terms (it is missing from /sitemap.xml on the head).

136 });
137
138 test("the plan links the terms of a paid forge beside the Spawn button", async () => {
139 const res = await fetch(servers.url + "/forges/new", {
140 method: "POST",
141 headers: { ...auth, "content-type": "application/x-www-form-urlencoded", origin: servers.url },
142 body: new URLSearchParams({ name: "plan-terms", do: "plan" }),
143 });
144 const page = main(await res.text());
145 const start = page.indexOf('id="plan"');
146 expect(start).toBeGreaterThan(-1);
147 const plan = page.slice(start, page.indexOf("</section>", start));
148 expect(plan).toContain('<a href="/terms">Terms of a paid forge</a>');
149 });
test/standards-sitemap.test.ts +1 −1
@@ -115,7 +115,7 @@ test("the sitemap lists /changelog after /explore, with the newest landing's day
115115 test("every <loc> in the sitemap answers an anonymous caller 200, and the public pages are listed", async () => {
116116 const body = await (await get("/sitemap.xml")).text();
117117 const locs = [...body.matchAll(/<loc>([^<]+)<\/loc>/g)].map((m) => m[1]!);
118 for (const p of ["/pricing", "/privacy", "/docs"]) expect(locs).toContain(`${servers.url}${p}`);
118 for (const p of ["/pricing", "/privacy", "/terms", "/docs"]) expect(locs).toContain(`${servers.url}${p}`);
119119 for (const loc of locs) {
120120 const res = await fetch(loc, { redirect: "manual", headers: { cookie: "" } });
121121 await res.text();

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs