Skip to content

Publish the ARD base context at /context/v1 - #17

Merged
rvguha merged 1 commit into
mainfrom
publish-ard-base-context
Aug 22, 2026
Merged

Publish the ARD base context at /context/v1#17
rvguha merged 1 commit into
mainfrom
publish-ard-base-context

Conversation

@rvguha

@rvguha rvguha commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

§4.1 of the spec says term IRIs come from a base context served at https://agenticresourcediscovery.org/context/v1, which a conformant consumer applies as the JSON-LD expandContext.

That URL currently returns 404 (the docs-site HTML shell). It's the one normative reference an ARD entry makes back to this site, so anyone reviewing a published entry and clicking through hits a dead link.

The context file itself landed in the canonical repo with ards-project/ard-spec#70 — it just isn't served anywhere.

Approach

Follows the pattern hooks/spec_from_canonical.py already establishes: the context lives only in ards-project/ard-spec (spec/schemas/ard.context.jsonld) and is fetched at build time, so this repo never holds a second copy that can drift from canonical.

Verified locally — the published file is byte-identical to canonical, parses, and works as an expandContext:

byte-identical to canonical: True
terms: 17 | @vocab: https://agenticresourcediscovery.org/ns#

expanded:
  https://agenticresourcediscovery.org/ns#identifier
  https://agenticresourcediscovery.org/ns#displayName
  https://example.org/okf#taxonomy        ← a second namespace still resolves

Two decisions worth reviewing

1. Content-Type — the bare path may not satisfy strict processors.

Static hosting assigns Content-Type from the file extension, and GitHub Pages offers no way to set headers. An extensionless file is served as application/octet-stream, while the JSON-LD 1.1 API requires a remote context to arrive as application/ld+json, application/json, or a +json type — a strict processor rejects anything else.

So /context/v1 resolves and reads correctly, but a strict consumer that dereferences it may still refuse it. This PR also publishes /context/v1.jsonld with identical bytes, which gives those consumers a URL that works today.

Making the bare path fully correct needs either a host that can set headers, or a spec that names the suffixed URL. Both are spec/infra decisions rather than build ones, so I've left them alone — happy to follow up whichever way you prefer.

2. A fetch failure publishes nothing.

spec_from_canonical.py falls back to a placeholder page, which is right for prose a human reads. It would be wrong here: a partial or unparseable document served at a context URL is worse than a 404, because a consumer would apply it and expand every term incorrectly. On failure this logs a warning and leaves the URL 404ing.

The fetched document is also parsed and checked for @context before publishing, so an HTML error body arriving with a 200 can't be served as the context.

🤖 Generated with Claude Code

§4.1 says term IRIs come from a base context served at
https://agenticresourcediscovery.org/context/v1, applied by a conformant
consumer as the JSON-LD expandContext. That URL currently 404s, so the one
normative reference an ARD entry makes to this site does not resolve.

Follows the pattern spec_from_canonical.py already establishes: the context
lives only in ards-project/ard-spec (spec/schemas/ard.context.jsonld) and is
fetched at build time, so the site never holds a second copy that can drift.

Publishes the same bytes at two paths. /context/v1 is the URL the spec names.
/context/v1.jsonld is an alias, because static hosting assigns Content-Type
from the file extension: GitHub Pages serves the extensionless path as
application/octet-stream, and the JSON-LD 1.1 API requires a remote context to
arrive as application/ld+json, application/json, or a +json type. The bare path
resolves and reads correctly; a strict processor dereferencing it may still
refuse it, and the alias gives those consumers something that works today.

A fetch failure publishes nothing rather than a placeholder. A stand-in page is
fine for prose a human reads; a partial or unparseable document at a context URL
is worse than a 404, because a consumer would apply it and expand every term
wrongly. The fetched document is parsed and checked for @context before it is
published, so an HTML error body arriving with a 200 cannot be served as the
context.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@mindpower mindpower left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.

@rvguha
rvguha merged commit 721edc7 into main Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants