Skip to content

feat(api.ht): shapes tool — link-shape comparison for dot-do/data#36 - #31

Open
nathanclevenger wants to merge 1 commit into
draft/api-ht-v1from
feat/link-shapes
Open

feat(api.ht): shapes tool — link-shape comparison for dot-do/data#36#31
nathanclevenger wants to merge 1 commit into
draft/api-ht-v1from
feat/link-shapes

Conversation

@nathanclevenger

Copy link
Copy Markdown
Contributor

Integrates the dot-do/data#36 link-shape examples INTO the live api.ht v0.1.0 worker as one new registry tool — per the founder ruling (2026-08-24): integrate and coordinate, no parallel implementations.

What it adds

One HypertextTool, shapes, in the worker's own conventions (same respond envelope, same LinkContext grammar, same registry expansion path — no second envelope):

  • The SAME entity in three candidate link shapes, switched by ?shape=:
    • a — typed camelCase edges: the envelope links block keyed by verb-register edge names (postedBy, locatedIn, memberOf, sameAs, potentialAction)
    • b — label-keyed maps: links keyed by arbitrary human labels, as the original recovered workers did
    • c — typed + variations: shape (a) plus a data.variations block of REAL representation alternates (classes: Wikidata JSON / TTL / HTML; jobs: Greenhouse HTML + board-API JSON) — relation edges and representation alternates never share a namespace
  • Every JSON response carries a data.shapes hop map to the same page in the other two shapes, so the founder can compare in place.
  • A miss is a page: 404 + suggestions rendered as the current shape's link map.
  • The tool root is a clickable HTML index explaining the three shapes (new optional HypertextTool.landingHtml, reusing the property's shared page shell).
  • Data embedded at build time, zero request-time fetches: the 53 canonical Job records (dot-do/data#34 adapter PoC, 3 Greenhouse boards) + top-20 head Wikidata classes (committed wiki-sources catalog, snapshot 2026-08-23, CC0-1.0), plus companies/locations Views over jobs.
  • Framework deltas kept minimal: optional landingHtml on HypertextTool; encodeValue now keeps / readable so multi-segment values are first-class; page/esc exported from landing.ts.

Routes once deployed

Verification

  • tests/api-ht.test.ts: 34/34 green (12 new shapes tests, fully offline)
  • Framework typecheck (tsc -p tsconfig.json) and example typecheck: clean
  • build.ts bundle: OK (221KB _worker.js)
  • wrangler dev --local smoke-tested: all three shapes, hop maps, miss pages, HTML landing, apex tool index — all verified
  • Pre-existing e2e/spike suite failures (live api.example.com.ai URLs / workerd) are unrelated to this change
  • NOT deployed — deploy authority stays with the founder/owning session

Supersedes

Closes the loop on dot-do/data#36 and feeds the dot-do/data#13 per-brand link-contract ruling. The standalone api-ht-live-demo.dotdo.workers.dev worker and the data-repo branch poc/api-ht-live-demo are SUPERSEDED by this PR and should be torn down after merge + deploy.

🤖 Generated with Claude Code

One new HypertextTool, `shapes` (shapes.api.ht), serving the founder's
deferred link-map comparison IN the live api.ht worker's own conventions
(no parallel implementation — supersedes the standalone workers.dev demo
and the data-repo poc/api-ht-live-demo branch):

- shapes.api.ht/{dataset}/{id}?shape=a|b|c — the SAME entity in three
  candidate link shapes: (a) typed camelCase edges (postedBy, locatedIn,
  sameAs, potentialAction) as the envelope links block; (b) label-keyed
  maps as the recovered workers did; (c) = (a) + a `variations` block of
  real representation alternates (classes: Wikidata JSON/TTL/HTML).
- Datasets embedded at build time, zero request-time fetches: 53 canonical
  Job records (dot-do/data#34 adapter PoC, Greenhouse) + top-20 head
  Wikidata classes (wiki-sources catalog snapshot 2026-08-23, CC0-1.0),
  plus companies/locations Views over jobs.
- A miss is a page: 404 + suggestions as the current shape's link map
  (jobs/staff-engineer, classes/Q42). Every response carries a `shapes`
  hop map to the same page in the other shapes.
- shapes.api.ht/ root is a clickable HTML index explaining the three
  shapes (new optional HypertextTool.landingHtml, shared page shell).
- encodeValue now keeps '/' readable so multi-segment values are
  first-class in the link grammar.
- 12 new offline tests (34 total in api-ht.test.ts, all green).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

1 participant