Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ Version 2.0.24

To be released.

### @fedify/vocab-runtime

- Added <https://purl.archive.org/miscellany> (the
[SWICG ActivityPub Miscellaneous Terms] context, referenced by every Bridgy
Fed activity) to preloaded JSON-LD contexts. The context is served through
purl.archive.org, which suffers recurring outages; during one, JSON-LD
expansion of any activity referencing this URL fails before application
handlers can run. [[#965] by Michael Barrett]

[SWICG ActivityPub Miscellaneous Terms]: https://swicg.github.io/miscellany/
[#965]: https://github.com/fedify-dev/fedify/issues/965


Version 2.0.23
--------------
Expand Down
13 changes: 13 additions & 0 deletions packages/vocab-runtime/src/contexts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// cSpell: disable

import joinLemmyContext from "./contexts/join-lemmy.json" with { type: "json" };
import miscellany from "./contexts/miscellany.json" with { type: "json" };

const preloadedContexts: Record<string, unknown> = {
"https://www.w3.org/ns/activitystreams": {
Expand Down Expand Up @@ -4363,6 +4364,18 @@ const preloadedContexts: Record<string, unknown> = {
},
},
},

// The SWICG "ActivityPub Miscellaneous Terms" context. Bridgy Fed (via
// granary) references this URL in the @context of every activity it sends,
// and other implementations use it as the recommended home for widely
// deployed extension terms like as:Hashtag and as:sensitive. It is served
// through purl.archive.org (Internet Archive's PURL service), which suffers
// recurring outages; while it is unreachable, every activity referencing
// this URL fails JSON-LD expansion before application handlers run. The
// document is a deliberately stable, versioned SWICG deliverable, so we
// ship a built-in copy.
// See: https://swicg.github.io/miscellany/
"https://purl.archive.org/miscellany": miscellany,
Comment on lines +4367 to +4378

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Preload the immutable versioned URL too.

getDocumentLoader() matches preloadedContexts by exact URL, so registering only the unversioned key leaves https://purl.archive.org/miscellany/1.0.0 unresolved locally. The SWICG specification identifies 1.0.0 as the immutable, byte-wise replicable URL. (swicg.github.io)

   "https://purl.archive.org/miscellany": miscellany,
+  "https://purl.archive.org/miscellany/1.0.0": miscellany,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// The SWICG "ActivityPub Miscellaneous Terms" context. Bridgy Fed (via
// granary) references this URL in the @context of every activity it sends,
// and other implementations use it as the recommended home for widely
// deployed extension terms like as:Hashtag and as:sensitive. It is served
// through purl.archive.org (Internet Archive's PURL service), which suffers
// recurring outages; while it is unreachable, every activity referencing
// this URL fails JSON-LD expansion before application handlers run. The
// document is a deliberately stable, versioned SWICG deliverable, so we
// ship a built-in copy.
// See: https://swicg.github.io/miscellany/
"https://purl.archive.org/miscellany": miscellany,
// The SWICG "ActivityPub Miscellaneous Terms" context. Bridgy Fed (via
// granary) references this URL in the `@context` of every activity it sends,
// and other implementations use it as the recommended home for widely
// deployed extension terms like as:Hashtag and as:sensitive. It is served
// through purl.archive.org (Internet Archive's PURL service), which suffers
// recurring outages; while it is unreachable, every activity referencing
// this URL fails JSON-LD expansion before application handlers run. The
// document is a deliberately stable, versioned SWICG deliverable, so we
// ship a built-in copy.
// See: https://swicg.github.io/miscellany/
"https://purl.archive.org/miscellany": miscellany,
"https://purl.archive.org/miscellany/1.0.0": miscellany,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/vocab-runtime/src/contexts.ts` around lines 63 - 74, Update the
preloaded context registration in getDocumentLoader and the surrounding
preloadedContexts definition to include the immutable URL
https://purl.archive.org/miscellany/1.0.0, mapping it to the existing miscellany
document while retaining the unversioned key.

};

export default preloadedContexts;
19 changes: 19 additions & 0 deletions packages/vocab-runtime/src/contexts/miscellany.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"@context": {
"as": "https://www.w3.org/ns/activitystreams#",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"Hashtag": "as:Hashtag",
"manuallyApprovesFollowers": {
"@id": "as:manuallyApprovesFollowers",
"@type": "xsd:boolean"
},
"movedTo": {
"@id": "as:movedTo",
"@type": "@id"
},
"sensitive": {
"@id": "as:sensitive",
"@type": "xsd:boolean"
}
}
}
Loading