Skip to content

Fix @tomic/cli ontology codegen for did:ad subjects - #1309

Open
joepio wants to merge 1 commit into
developfrom
cursor/cli-did-ontologies-91eb
Open

Fix @tomic/cli ontology codegen for did:ad subjects#1309
joepio wants to merge 1 commit into
developfrom
cursor/cli-did-ontologies-91eb

Conversation

@joepio

@joepio joepio commented Aug 27, 2026

Copy link
Copy Markdown
Member

Related Issues

Fixes ad-generate ontologies failing on DID ontologies.

What was going on

A did:ad:… identifier is not an HTTP URL. Two config shapes both failed:

  1. "ontologies": ["did:ad:…"] — the CLI fetched through GET {serverUrl}/did?subject=…. With no (or localhost) serverUrl, Node has no window.location to fall back to, so the request never reached the Atomic Server that actually hosts the ontology (connection refused).
  2. "ontologies": ["https://host/did:ad:…"] — that URL is only a server-specific alias. The server still returns @id: did:ad:…. The JSON-AD parser required an exact subject match and threw Resource has wrong subject in @id.

What changed

  • Treat https://host/did:ad:… (and /did?subject=) as aliases of the DID. Parse, fetch, and store lookup all follow the canonical @id.
  • Resolve raw DIDs through /did?subject= using serverUrl. In Node, missing serverUrl is a clear error instead of touching window.
  • @tomic/cli writes serverUrl from ad-generate init, points the store at an HTTP ontology URL's origin so nested DID classes/properties resolve, and prints the real fetch error plus a serverUrl hint on connection refused.
  • Docs: put did:ad:… in ontologies and set serverUrl to the Atomic Server origin.

Checklist

  • Add changelog entry linking to issue, describe API changes
  • Add or update tests if needed
  • Update docs if needed
Open in Web Open in Cursor 

DID resources keep did:ad:… as @id even when fetched via
https://host/did:ad:…. The JSON-AD parser treated that as a
mismatch, and the CLI had no server origin for a raw DID
(connection refused / window is not defined in Node).

Treat the HTTP path as an alias of the DID, resolve DIDs through
GET /did?subject= with serverUrl, and derive that origin from HTTP
ontology URLs when the config still has the init localhost default.

Co-authored-by: joepmeindertsma <joepmeindertsma@gmail.com>
@joepio
joepio marked this pull request as ready for review August 27, 2026 05:27
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