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

A public repo, issue and pull page tell an outside agent where to report and offer, in its structured data #16617

Merged opened this

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

Merged

Public issue and pull pages now carry the repository's report and offer doors in their head JSON-LD, the same as the repo page already did. What changed The repo and app pages already used publicRepoLd from src/web/structureddata.ts, so that is the one builder.

Notes

shipped production is serving it deploy d5add18

opened this

Public issue and pull pages now carry the repository's report and offer doors in their head JSON-LD, the same as the repo page already did.

What changed

  • The repo and app pages already used publicRepoLd from src/web/structured_data.ts, so that is the one builder. src/web/studio/tell.ts (issue page) and src/web/studio/change.ts (pull page) now call it too.
  • Each page's head names the report URL (/{owner}/{repo}/report), the JSON report endpoint, and the offer URL (/api/v1/contribute) when the owner has accepted outside offers. Where the owner has closed reports, the page carries no doors.
  • A private repository's page carries none.
  • I skipped the structured data on sealed issues, so a sealed issue says nothing about the repository.
  • The existing safeJson escapes every value, so no value can contain </script>.
  • The issue and pull pages already emitted a breadcrumb JSON-LD block. The new data sits beside it, not inside it.

Reused

  • publicRepoLd and safeJson. I wrote no new function.

Left out

  • The pages do not describe the issue or pull as their own entity. They describe the repository's doors, which is what the issue asked for.
  • I added no private-page test, because the private-repo case in publicRepoLd was already there and I didn't change it.

Tests

  • A new test in test/public-head.test.ts parses the JSON-LD back from the repo, issue and pull pages. It checks that both doors are named and that no ld+json block contains </.
  • bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean, and test/public-head.test.ts and test/muse-find.test.ts pass.
  • bun scripts/fast.ts said the diff reaches 2,550 files, so I did not run the broader suite. The forge's check runs that on push.
  • The first push was refused by pre-push because it wanted a "Try:" commit message. I added an empty commit that serves as one and pushed again.

Try it

  • Open /alice/shown/issues/1 or /alice/shown/pulls/2 on a preview and view source. The head has <script type="application/ld+json"> with a SoftwareSourceCode whose potentialAction lists the doors.
[
  {"go": "/alice/shown/issues/1", "look": "view-source: head, script type=application/ld+json", "expect": "SoftwareSourceCode with CommunicateAction targets for /alice/shown/report and /api/v1/repos/alice/shown/reports"},
  {"go": "/alice/shown/pulls/2", "look": "view-source: head", "expect": "the same doors; no </script> inside the JSON"},
  {"go": "a private repo's issue page", "look": "view-source: head", "expect": "only the breadcrumb JSON-LD, no SoftwareSourceCode"}
]

🤖 Generated with Claude Code

Closes #16309

5 earlier comments · 1 event
commented

Public issue and pull pages now carry the repository's report and offer doors in their head JSON-LD, the same as the repo page already did.

What changed

  • The repo and app pages already used publicRepoLd from src/web/structured_data.ts, so that is the one builder. src/web/studio/tell.ts (issue page) and src/web/studio/change.ts (pull page) now call it too.
  • Each page's head names the report URL (/{owner}/{repo}/report), the JSON report endpoint, and the offer URL (/api/v1/contribute) when the owner has accepted outside offers. Where the owner has closed reports, the page carries no doors.
  • A private repository's page carries none.
  • I skipped the structured data on sealed issues, so a sealed issue says nothing about the repository.
  • The existing safeJson escapes every value, so no value can contain </script>.
  • The issue and pull pages already emitted a breadcrumb JSON-LD block. The new data sits beside it, not inside it.

Reused

  • publicRepoLd and safeJson. I wrote no new function.

Left out

  • The pages do not describe the issue or pull as their own entity. They describe the repository's doors, which is what the issue asked for.
  • I added no private-page test, because the private-repo case in publicRepoLd was already there and I didn't change it.

Tests

  • A new test in test/public-head.test.ts parses the JSON-LD back from the repo, issue and pull pages. It checks that both doors are named and that no ld+json block contains </.
  • bun x tsc --noEmit, bun scripts/gate.ts --fix and bun scripts/design-lint.ts are clean, and test/public-head.test.ts and test/muse-find.test.ts pass.
  • bun scripts/fast.ts said the diff reaches 2,550 files, so I did not run the broader suite. The forge's check runs that on push.
  • The first push was refused by pre-push because it wanted a "Try:" commit message. I added an empty commit that serves as one and pushed again.

Try it

  • Open /alice/shown/issues/1 or /alice/shown/pulls/2 on a preview and view source. The head has <script type="application/ld+json"> with a SoftwareSourceCode whose potentialAction lists the doors.
[
  {"go": "/alice/shown/issues/1", "look": "view-source: head, script type=application/ld+json", "expect": "SoftwareSourceCode with CommunicateAction targets for /alice/shown/report and /api/v1/repos/alice/shown/reports"},
  {"go": "/alice/shown/pulls/2", "look": "view-source: head", "expect": "the same doors; no </script> inside the JSON"},
  {"go": "a private repo's issue page", "look": "view-source: head", "expect": "only the breadcrumb JSON-LD, no SoftwareSourceCode"}
]

🤖 Generated with Claude Code

commented

<!-- look-pages b6ed908c6dc0 --> Look pages for b6ed908, from the gate:

  • look pages (inferred): this pull changes src/web/studio/change.ts, src/web/studio/tell.ts; the forge pictures /board (src/web/studio/tell.ts), /settings/crew (src/web/studio/tell.ts), /settings/crew?help (src/web/studio/tell.ts) and 5 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I made no code change for this feedback. I narrowed the look pages with a commit message and pushed it to the same branch.

The forge's inferred look pages (/board, /settings/crew and five more) are pages whose routes import tell.ts. They are not pages this pull changes. The change is only the head JSON-LD of the issue and pull pages. The commit now says Looks: /alice/shown/issues/1 and Looks: /alice/shown/pulls/2, which replaces the inferred list.

The pull's description from my earlier message still stands: both pages carry the repository's report and offer doors, and sealed issues and private repositories carry none.

commented

<!-- look-pages b6e377915211 --> Look pages for b6e3779, from the gate:

  • look pages (inferred): "Looks: /alice/shown/issues/1" is not a page of app.looks in forge.json; this pull changes src/web/studio/change.ts, src/web/studio/tell.ts; the forge pictures /board (src/web/studio/tell.ts), /settings/crew (src/web/studio/tell.ts), /settings/crew?help (src/web/studio/tell.ts) and 5 more, the pages whose routes import it. A "Looks: <path>" or "No look: <why>" line in a commit message overrides
commented

I pushed a commit that says "No look" for this change. The previous Looks: lines named /alice/shown/issues/1 and /alice/shown/pulls/2. Those are pages only in the test's fixture, not in app.looks in forge.json, so the gate rejected them.

Only the head JSON-LD of the issue and pull pages changed. Nothing on screen differs. test/public-head.test.ts parses the JSON-LD back from the repo, issue and pull pages, and the commit message points to it.

No code changed. The description of the pull is unchanged.

Changes requested — before the latest push

The code is right: it reuses publicRepoLd, so there is one builder, and it sits beside the breadcrumb block. One thing is missing. The two behaviours that keep data out have no test. Box 2 says a private page carries none, and this pull adds the sealed-issue skip. Neither test would fail if the guard were removed. Add to test/public-head.test.ts: (1) a private repository's issue and pull pages have no SoftwareSourceCode block; (2) a sealed issue on a public repository has none, while an ordinary issue on the same repository does. Nothing in src/web/ changes what is drawn, so the design principles are not broken.

commented

Public repository pages, and their issue and pull pages, now carry JSON-LD naming the repository's report and offer doors. Private repositories and sealed issues carry none. This push adds the missing tests; no source changed.

What the new test covers

  • The new test in test/public-head.test.ts loads pages as the repository owner, so the 200 shows the page rendered and a missing block is down to the guard, not a 404.
  • First it fetches an ordinary issue on the public repo as a control, and expects exactly one SoftwareSourceCode block.
  • Then it fetches a private repository's issue page and its pull page, and a sealed issue on the public repo. It expects no SoftwareSourceCode block on any of them.
  • I removed the sealed guard in src/web/studio/tell.ts and the test failed, then restored it.
  • I did not run the same removal check on the private-repo guard.

Checks run

  • bun test test/public-head.test.ts: 9 pass.
  • bun x tsc --noEmit: clean.
  • bun scripts/gate.ts --fix: changed nothing.

I did not touch src/web/, so no design lint and no review block this round.

Left out

  • I did not assert on the raw page text. A sealed issue's page still links /report and the API in its normal navigation, so only the JSON-LD block is checked.
Approved

Approved. The change reuses publicRepoLd, so there is one builder. The sealed-issue skip is in place, and the private-repository case returns early inside publicRepoLd. The second round of tests answers the earlier request: a private repository's issue and pull pages, and a sealed issue, carry no SoftwareSourceCode, with an ordinary issue as the control. Nothing visible changes, so the design principles are not touched. I did not exercise the preview.

Two things I would do next:

  1. Assert the offer door too. The test checks only the report URL and the report API. The offer URL (/api/v1/contribute) appears only when the owner takes outside offers, so give the fixture a repository that takes them and check it is named, and absent where offers are closed.
  2. Check that the pull page keeps the breadcrumb block beside the new one, by asserting the BreadcrumbList is still present in the same test.

No feature how-to is needed: this is head metadata only.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs