Skip to content

fix(hcs-25): resolve ans trust discovery agents by uid - #2

Closed
chou-godaddy wants to merge 1 commit into
mainfrom
fix/hcs-25-ans-trust-discovery-collector
Closed

chou-godaddy wants to merge 1 commit into
mainfrom
fix/hcs-25-ans-trust-discovery-collector

Conversation

@chou-godaddy

Copy link
Copy Markdown
Owner

Draft for internal review before opening against hashgraph-online/standards-sdk. Not for merge into this fork's main.

Summary

Follow-up to hashgraph-online#184. The ans-trust-discovery collector looked agents up by the UAID nativeId, but ANS Trust Index providers key GET /v1/ans/registered-agents/{id} by the ANS agent id, which HCS-14 (ans-dns-web profile) carries as the UAID uid parameter. Every lookup returned 404, so no ANS agent received signals.

  • Agent id: resolved from metadata.uid, then the uid parameter of metadata.uaidFull, then of subject.id. nativeId is no longer used, and UAID parameters are parsed without a regular expression.
  • Registries: the collector and the scoring adapter apply to ans and godaddy-ans by default. ans is the HCS-14 registry value; godaddy-ans is the Registry Broker namespace for the same agents.
  • 404: clears the stored scores, so an agent the provider no longer knows stops being scored.
  • Refresh interval: collection is skipped while stored signals are fresh (ttlMs, 24 hours after a success; failureTtlMs, 1 hour after a failure), and force overrides this. This keeps batch refreshes within provider rate limits.
  • Retries: network errors and HTTP 5xx are retried twice (maxRetries). HTTP 429 is not retried.

Testing

  • pnpm exec jest --config jest.config.json --testPathPattern __tests__/hcs-25 --coverage=false (203 passed on Node 22 and 24, including 14 new tests)
  • pnpm run typecheck
  • pnpm run lint
  • pnpm run build
  • Ran the collector and scoring adapter through collectAndScoreTrustScore against a live ANS Trust Index provider, using subjects shaped like Registry Broker records: a UAID without parameters, metadata.uid, and registry godaddy-ans. Each component and adapter total matched values computed independently from the provider responses. An unknown id returned 404 and cleared the stored scores, and a second run within the refresh interval made no request.

Notes

  • Transient failures keep the earlier scores with a timeout or error status, as the ethos collector does; the 1-hour failure interval then triggers a retry.
  • readUaidParam mirrors the parameter handling of parseHcs14Did so that hcs-25 keeps no imports from hcs-14. Happy to switch to parseHcs14Did if preferred.
  • typecheck, lint and full-suite results are unchanged from main.

The ans-trust-discovery collector looked agents up by the UAID nativeId,
but ANS Trust Index providers key the registered-agent endpoint by the
ANS agent id, which HCS-14 carries as the UAID uid parameter. Every
lookup returned 404, so no ANS agent received signals.

- Resolve the agent id from metadata.uid, then the uid parameter of
  metadata.uaidFull or the subject id. nativeId is no longer used, and
  parameters are parsed without a regular expression.
- Apply the collector and the scoring adapter to the ans and godaddy-ans
  registries by default: ans is the HCS-14 registry value and godaddy-ans
  is the Registry Broker namespace for the same agents.
- Clear stored scores when the provider returns 404 for the agent.
- Skip collection while stored signals are fresh (24 hours after a
  success, 1 hour after a failure) unless forced, so batch refreshes stay
  within provider rate limits.
- Retry network errors and HTTP 5xx twice. HTTP 429 is not retried.
- Correct the collector test that asserted the nativeId URL, and cover id
  resolution, 404 clearing, retries, rate limiting, caching and registry
  applicability.

Refs: hashgraph-online#184
Signed-off-by: chou-godaddy <chou@godaddy.com>
@cyen-godaddy

cyen-godaddy commented Oct 8, 2026 •

Copy link
Copy Markdown

From claude, is this a real?


The PR swaps nativeId → uid on the premise that HCS-14 carries the ANS agent id in uid. This repo's own HCS-14 contract says otherwise: src/hcs-14/resolvers/ans-dns-web-profile.ts:274 rejects a profile unless agentCard.ansName === parsed.params['uid'], and every registry=ans fixture in tests/hcs-14/profile-resolvers.test.ts uses uid=ans://v1.0.0.support-agent.example.com. So for ans subjects the collector builds:

GET /v1/ans/registered-agents/ans%3A%2F%2Fv1.0.0.support-agent.example.com → 404

@chou-godaddy

Copy link
Copy Markdown
Owner Author

Approved internally. Opened upstream as hashgraph-online#185; closing this draft without merging.

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