Skip to content

fix(blueprint-metadata): resolve bare github.com URIs to raw metadata JSON#3219

Merged
drewstone merged 1 commit into
developfrom
fix/resolve-github-blueprint-metadata-url
May 21, 2026
Merged

fix(blueprint-metadata): resolve bare github.com URIs to raw metadata JSON#3219
drewstone merged 1 commit into
developfrom
fix/resolve-github-blueprint-metadata-url

Conversation

@tangletools
Copy link
Copy Markdown
Contributor

Summary

  • Several blueprints just registered on Base Sepolia (e.g. ai-agent-sandbox, llm-inference, modal-inference, image-gen-inference) carry an on-chain metadataUri that points at the repo's GitHub HTML page (https://github.com/<owner>/<repo>). The dapp fetch()-es that URL expecting JSON, receives HTML, parseBlueprintMetadataJsonText bails out, and every affected blueprint renders as unavailable.
  • Teach resolveBlueprintMetadataFetchUrl to translate a bare github.com/<owner>/<repo> URL (optionally with a trailing slash or .git suffix) into raw.githubusercontent.com/<owner>/<repo>/main/metadata/blueprint-metadata.json. ipfs:// handling is untouched, URLs with sub-paths (/tree/main/...) are passed through unchanged, and any other HTTPS URL still flows through rewriteLocalhostUrlForBrowser.
  • Repos that default to master instead of main will 404 for now — that's accepted as a follow-up (fixable on-chain via updateBlueprint, or we can add a mainmaster fallback later). The four repos with on-chain registrations today all default to main.
  • The resolver moves into its own metadataFetchUrl.ts so unit tests don't transitively pull in the authoring module's import.meta.env reference; authoring.ts re-exports the function so the public API is identical.

Test plan

  • yarn nx test tangle-shared-ui --testPathPattern=authoring — 6 new cases (ipfs, bare GitHub, trailing slash, .git, sub-path passthrough, unrelated HTTPS passthrough), all pass.
  • yarn nx test tangle-shared-ui — full suite green (32 tests).
  • yarn nx test tangle-cloud — full suite green (109 tests).
  • yarn nx lint tangle-shared-ui — clean.
  • yarn nx build tangle-cloud — clean.
  • Manual smoke on Base Sepolia: hit the four affected blueprint detail pages and confirm metadata loads.

… JSON

Blueprints can register an on-chain metadataUri that points at the repo's
GitHub HTML page (e.g. https://github.com/<owner>/<repo>). The dapp then
fetches that URL expecting JSON, receives HTML, and the blueprint renders
as unavailable. Teach resolveBlueprintMetadataFetchUrl to translate a
bare github.com/<owner>/<repo> URL (optionally with a trailing slash or
.git suffix) into the canonical
raw.githubusercontent.com/<owner>/<repo>/main/metadata/blueprint-metadata.json
path. ipfs:// handling is unchanged; any URL with a sub-path (e.g.
/tree/main/...) is still passed through as-is, and arbitrary HTTPS URLs
still flow through rewriteLocalhostUrlForBrowser.

To unblock unit testing, the resolver moves into its own
metadataFetchUrl.ts so the test file does not transitively pull in the
authoring module's import.meta.env reference. authoring.ts re-exports
the function so the public API is unchanged.
@tangletools tangletools requested a review from AtelyPham as a code owner May 21, 2026 17:30
Copy link
Copy Markdown
Contributor

@drewstone drewstone left a comment

Choose a reason for hiding this comment

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

Approved.

@drewstone drewstone merged commit 45d7053 into develop May 21, 2026
9 checks passed
@drewstone drewstone deleted the fix/resolve-github-blueprint-metadata-url branch May 21, 2026 17:54
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