Skip to content

Preload the SWICG miscellany JSON-LD context#966

Open
mike182uk wants to merge 1 commit into
fedify-dev:2.0-maintenancefrom
mike182uk:preload-miscellany-context
Open

Preload the SWICG miscellany JSON-LD context#966
mike182uk wants to merge 1 commit into
fedify-dev:2.0-maintenancefrom
mike182uk:preload-miscellany-context

Conversation

@mike182uk

Copy link
Copy Markdown
Contributor

Fixes #965

Adds https://purl.archive.org/miscellany (the SWICG "ActivityPub Miscellaneous Terms" context) to the preloaded JSON-LD contexts in @fedify/vocab-runtime, following the same shape as the Lemmy context change (#714): bundled JSON asset + preloadedContexts entry

The bundled document is a byte-for-byte copy of the canonical context (the current version, immutable at https://purl.archive.org/miscellany/1.0.0)

See #965 for the full rationale: Bridgy Fed references this context in every activity it delivers, and purl.archive.org outages currently fail JSON-LD expansion of all those activities before application handlers run

Testing: mise run check-each vocab-runtime passes, and the vocab-runtime test suites pass on Deno and Node (the existing "preloaded contexts" test in docloader.test.ts covers the new entry automatically)

AI disclosure

AI-assisted (OpenCode with claude-fable-5; Assisted-by trailer on the commit). The agent did the investigation, authored the change following the #714 precedent, and ran the checks; I reviewed and verified the work. The bundled JSON was fetched from the canonical URL, not generated

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for fedify-json-schema canceled.

Name Link
🔨 Latest commit f292c0f
🔍 Latest deploy log https://app.netlify.com/projects/fedify-json-schema/deploys/6a606e6fe8a4390008eadd56

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: b23e3205-e9b2-49ab-90a3-d19d9d43aee7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The vocab runtime adds a bundled SWICG ActivityPub Miscellaneous Terms JSON-LD context and preloads it for https://purl.archive.org/miscellany. The changelog documents the change and references issue 965.

Changes

SWICG miscellany context preload

Layer / File(s) Summary
Context definition
packages/vocab-runtime/src/contexts/miscellany.json
Adds JSON-LD mappings for Hashtag, manuallyApprovesFollowers, movedTo, and sensitive.
Runtime registration and changelog
packages/vocab-runtime/src/contexts.ts, CHANGES.md
Imports the bundled context, registers it under the archive URL, and documents the preload.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

  • Issue 932 — Similar static JSON-LD context addition registered in contexts.ts.

Possibly related PRs

Suggested labels: component/vocab, activitypub/compliance

Suggested reviewers: dahlia

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds the misc context asset and registers it in preloadedContexts as requested for #965.
Out of Scope Changes check ✅ Passed The only extra change is the changelog update, which is directly related and not out of scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title clearly matches the main change by describing the new preloaded SWICG miscellany context.
Description check ✅ Passed The description is directly related to the changes and accurately summarizes the bundled context and preloaded entry.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@packages/vocab-runtime/src/contexts.ts`:
- Around line 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 927814e3-a7fd-4f26-9327-be7f49070ff6

📥 Commits

Reviewing files that changed from the base of the PR and between c2352c0 and f292c0f.

📒 Files selected for processing (3)
  • CHANGES.md
  • packages/vocab-runtime/src/contexts.ts
  • packages/vocab-runtime/src/contexts/miscellany.json

Comment on lines +63 to +74

// 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,

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.

@dahlia dahlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything looks good, but could you change the target of this pull request to branch 2.0-maintenance? Thanks!

Bundle the SWICG "ActivityPub Miscellaneous Terms" context in
vocab-runtime and register it as a preloaded context for the default
document loader. Bridgy Fed references this context in every activity
it delivers, and its host, purl.archive.org, suffers recurring outages
during which JSON-LD expansion of those activities fails with
jsonld.InvalidUrl before application handlers run

Update the changelog for the next vocab-runtime release

Fixes fedify-dev#965

Assisted-by: OpenCode:claude-fable-5
@mike182uk
mike182uk changed the base branch from main to 2.0-maintenance July 22, 2026 09:03
@mike182uk
mike182uk force-pushed the preload-miscellany-context branch from f292c0f to d8e114e Compare July 22, 2026 09:03
@mike182uk

Copy link
Copy Markdown
Contributor Author

@dahlia I've rebased this against 2.0-maintenance 👍

@mike182uk
mike182uk requested a review from dahlia July 22, 2026 09:08
@dahlia dahlia self-assigned this Jul 22, 2026
@dahlia dahlia added the component/vocab Activity Vocabulary related label Jul 22, 2026

@dahlia dahlia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! We will include this change in patch releases, i.e., 2.0.24, 2.1.20, 2.2.9, 2.3.4.

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
packages/vocab-runtime/src/contexts.ts 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/vocab Activity Vocabulary related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add https://purl.archive.org/miscellany to preloaded JSON-LD contexts

3 participants