Skip to content

feat(hcs-25): add ans-trust-discovery adapter and collector - #184

Merged
kantorcodes merged 5 commits into
hashgraph-online:mainfrom
chou-godaddy:feat/hcs-25-ans-trust-discovery-adapter
Oct 8, 2026
Merged

kantorcodes merged 5 commits into
hashgraph-online:mainfrom
chou-godaddy:feat/hcs-25-ans-trust-discovery-adapter

Conversation

@chou-godaddy

@chou-godaddy chou-godaddy commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds the ans-trust-discovery scoring adapter and registers it in createHcs25AdapterCatalog().
  • Passes through the eight ANS Trust Index signals stored under metadata.ansTrustDiscovery (certtype, dnssecurity, agentage, versionstability, dnsconsistency, httpsrecord, agentcard, certificatehygiene). Scores are clamped to [0,100]. Null, absent, or non-numeric signals stay out of the adapter mean.
  • A stored ansTrustDiscoveryStatus of stale keeps the score so the stale multiplier applies. timeout or error with no score is returned as that status, matching the other HCS-25 adapters.
  • Adds the ans-trust-discovery signal collector used by createHcs25SignalAdapters({ ansTrustDiscovery: true }). It requests GET {baseUrl}/v1/ans/registered-agents/{agentId} and stores the eight scores. The default base URL is https://api.godaddy.com.
  • Contribution is scoped, weight 1, includeRegistries: ['ans'], default component key ans-trust-discovery.certtype.

Testing

  • pnpm exec jest --config jest.config.json --testPathPattern __tests__/hcs-25 --coverage=false (189 passed)
  • pnpm exec tsc -p tsconfig.json --noEmit
  • pnpm exec prettier --check on the changed HCS-25 files

Notes

  • Signal shape follows the HCS-25 ANS Trust Discovery adapter and signal specs.
  • An applicable ans subject with no stored signals stays in the denominator at 0 under ans-trust-discovery.certtype with status missing.

Implements the ans-trust-discovery adapter and signal family documented
in the HCS-25 specification (adapters/ans-trust-discovery.md and
signals/ans-trust-discovery.md).

- Passes through the eight ANS Trust Index signals stored under
  metadata.ansTrustDiscovery (certtype, dnssecurity, agentage,
  versionstability, dnsconsistency, httpsrecord, agentcard,
  certificatehygiene) as one component each. Null or absent signals are
  excluded from the adapter mean.
- Scoped to registry=ans with weight 1 and default component key
  ans-trust-discovery.certtype, per the specification.
- A stored ansTrustDiscoveryStatus of stale applies the stale multiplier.
- Adds the stored-field schema and HCS25_SIGNAL_CATALOG entry, registers
  the adapter in createHcs25AdapterCatalog, and adds tests.

Refs: hiero-ledger/hiero-consensus-specifications#38
Signed-off-by: chou-godaddy <chou@godaddy.com>
@kilo-code-bot

kilo-code-bot Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/hcs-25/adapters/ans-trust-discovery.ts 36 ansTrustStatus accepts any string for status without validation
Files Reviewed (2 files)
  • src/hcs-25/collectors/ans-trust-discovery.ts — statusResult fixed to return all 8 signals; no new issues
  • src/hcs-25/adapters/ans-trust-discovery.ts — 1 WARNING carried forward (file not in incremental diff)
  • __tests__/hcs-25/hcs-25-collectors.test.ts — tests updated to verify all signals

Fix these issues in Kilo Cloud

Previous Review Summaries (2 snapshots, latest commit 70b9ded)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 70b9ded)

Status: 4 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
src/hcs-25/collectors/ans-trust-discovery.ts 97 statusResult only includes the first signal (certtype) in the snapshot for error/timeout/missing cases
src/hcs-25/adapters/ans-trust-discovery.ts 36 ansTrustStatus accepts any string for status without validation

SUGGESTION

File Line Issue
src/hcs-25/collectors/ans-trust-discovery.ts 94 Redundant clamping — collector clamps in readSignalScore, adapter clamps again in ansTrustStatus
src/hcs-25/collectors/ans-trust-discovery.ts 180 Redundant typeof signals === 'object' check
Files Reviewed (10 files)
  • src/hcs-25/adapters/ans-trust-discovery.ts — new adapter: 8 pass-through components, clamping, stale multiplier, nonScorableWhenUnavailable exclusion, registry scoping, default component key fallback
  • src/hcs-25/collectors/ans-trust-discovery.ts — new signal collector: fetches from ANS Trust Index provider, stores 8 scores under metadata.ansTrustDiscovery, handles timeout/error/404/missing agent id
  • src/hcs-25/signals/ans-trust-discovery.ts — new zod schema (hcs25AnsTrustDiscoveryFieldsSchema) with [0,100] range, nullish scores, and enum status validation; .passthrough() matches catalog convention
  • src/hcs-25/adapters/index.ts — imports + registers createAnsTrustDiscoveryAdapter() in createHcs25AdapterCatalog()
  • src/hcs-25/signals/index.ts — re-export + HCS25_SIGNAL_CATALOG entry (storage metadata.ansTrustDiscovery, 10 fields)
  • src/hcs-25/collectors/catalog.ts — adds ansTrustDiscovery option to createHcs25SignalAdapters
  • src/hcs-25/collectors/index.ts — re-exports collector
  • __tests__/hcs-25/hcs-25-adapters-ans-trust-discovery.test.ts — 17 tests covering pass-through, clamping, missing exclusion, measured-zero vs. missing, non-numeric, unlisted signals, no-signal denominator, registry scoping, stale multiplier, error/timeout with/without scores, composite integration
  • __tests__/hcs-25/hcs-25-adapter-catalog.test.ts — adds adapter id and ['scoped', 1] contribution entry
  • __tests__/hcs-25/hcs-25-signal-schemas.test.ts — adds schema import, catalog key, and validation test (range/enum rejection)

Fix these issues in Kilo Cloud

Previous review

Status: No Issues Found | Recommendation: Merge

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0
Files Reviewed (7 files)
  • src/hcs-25/adapters/ans-trust-discovery.ts — new adapter: 8 pass-through components, clamping, stale multiplier, nonScorableWhenUnavailable exclusion, registry scoping, default component key fallback. Verified normalize logic, clamping, status propagation, and integration with scoreAdapter/unavailableSignalStatus/adapterTotal in scoring.ts.
  • src/hcs-25/signals/ans-trust-discovery.ts — new zod schema (hcs25AnsTrustDiscoveryFieldsSchema) with [0,100] range, nullish scores, and enum status validation; .passthrough() matches catalog convention.
  • src/hcs-25/adapters/index.ts — imports + registers createAnsTrustDiscoveryAdapter() in createHcs25AdapterCatalog().
  • src/hcs-25/signals/index.ts — re-export + HCS25_SIGNAL_CATALOG entry (storage metadata.ansTrustDiscovery, 10 fields).
  • __tests__/hcs-25/hcs-25-adapters-ans-trust-discovery.test.ts — 14 tests covering pass-through, clamping, missing exclusion, measured-zero vs. missing, non-numeric, unlisted signals, no-signal denominator, registry scoping, stale multiplier, error/timeout, and composite integration. All expected numeric values verified.
  • __tests__/hcs-25/hcs-25-adapter-catalog.test.ts — adds adapter id and ['scoped', 1] contribution entry.
  • __tests__/hcs-25/hcs-25-signal-schemas.test.ts — adds schema import, catalog key, and validation test (range/enum rejection).
Verification Notes
  • No any, no as casts, no @ts-ignore — TypeScript-strict compliant.
  • Shared module-level MISSING constant matches the established pattern in connectivity.ts, acp.ts, ethos.ts, erc8004-feedback.ts, x402.ts, output-verification.ts, model-evals.ts, oss-popularity.ts, and agentverse.ts.
  • Lint is prettier --check only (no import-sort plugin, Prettier 3.x) — formatting compliant; no trailing whitespace or syntax errors.
  • All files well under the 500 LOC guideline.
  • No documentation gaps (no markdown catalog/docs reference this feature set).

Reviewed by free · Input: 378.8K · Output: 12.6K · Cached: 185.8K

A stored ansTrustDiscoveryStatus of timeout or error with no score now
surfaces that status, matching the other HCS-25 adapters. Present scores
still pass through, and stale still keeps the score for the multiplier.

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
…-discovery-adapter

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
Adds the ans-trust-discovery signal collector next to the other HCS-25
collectors. It reads the provider registered-agent response, stores the
eight scores under metadata.ansTrustDiscovery, and records timeout or
error when the request fails.

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
@kantorcodes kantorcodes changed the title feat(hcs-25): add ans-trust-discovery adapter feat(hcs-25): add ans-trust-discovery adapter and collector Oct 8, 2026
Comment thread src/hcs-25/collectors/ans-trust-discovery.ts
Comment thread src/hcs-25/adapters/ans-trust-discovery.ts
Comment thread src/hcs-25/collectors/ans-trust-discovery.ts
Comment thread src/hcs-25/collectors/ans-trust-discovery.ts
A missing, timeout, or error response now writes the same status for all
eight ans-trust-discovery signals. The stored status field still rides on
the first signal.

Signed-off-by: Michael Kantor <6068672+kantorcodes@users.noreply.github.com>
@kantorcodes
kantorcodes merged commit 4f44358 into hashgraph-online:main Oct 8, 2026
3 checks passed
@chou-godaddy
chou-godaddy deleted the feat/hcs-25-ans-trust-discovery-adapter branch October 8, 2026 18:08
kantorcodes pushed a commit that referenced this pull request Oct 19, 2026
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: #184

Signed-off-by: chou-godaddy <chou@godaddy.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.

3 participants