Skip to content

feat(hcs-25): add ans-trust-discovery adapter - #1

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

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

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

  • Adds createAnsTrustDiscoveryAdapter(), implementing the ans-trust-discovery adapter documented in the HCS-25 specification (docs/standards/hcs-25/adapters/ans-trust-discovery.md, merged in docs(hcs-25): add ANS trust discovery adapter and signal hiero-ledger/hiero-consensus-specifications#38).
  • Passes the eight ANS Trust Index signals through as one component each: certtype, dnssecurity, agentage, versionstability, dnsconsistency, httpsrecord, agentcard, certificatehygiene. The signals are read from metadata.ansTrustDiscovery, and each score is clamped to [0,100].
  • Signals that are null, absent or non-numeric are non-scorable and are excluded from the adapter mean. A measured 0 is kept.
  • Matches the specification: scoped, weight 1, includeRegistries: ['ans'], default component key ans-trust-discovery.certtype.
  • A record-level ansTrustDiscoveryStatus of stale applies the configured stale multiplier.
  • Adds hcs25AnsTrustDiscoveryFieldsSchema, HCS25_ANS_TRUST_DISCOVERY_SIGNALS and the HCS25_SIGNAL_CATALOG entry, and registers the adapter in createHcs25AdapterCatalog().
  • No HTTP and no new dependencies. Signal collection is out of scope here and will follow the collector API proposed in feat(hcs-25): add signal collectors for end-to-end trust-score collection hashgraph-online/standards-sdk#181.

Testing

pnpm install --frozen-lockfile
pnpm exec jest --config jest.config.json --testPathPattern __tests__/hcs-25 --coverage=false
pnpm run lint
pnpm run typecheck
pnpm run build
  • hcs-25 suite: 136/136 pass, on Node 22 and Node 24. That's 13 new adapter tests and 1 new schema test.
  • Coverage of the new adapter and schema files: 100% of statements, branches, functions and lines.
  • lint, typecheck and the full pnpm run test produce the same results as on the base commit. The pre-existing lint warnings, type errors and environment-dependent test failures are unchanged, and none come from this change.
  • The new test file also type-checks under strict.
  • ESLint (eslint.config.js) reports no findings on the new source files.
  • An end-to-end check was run against live data from 4 production ANS agents, through the full createHcs25AdapterCatalog(). Per-signal components, unavailable components, adapter totals and composite totals all matched an independent computation from the provider responses. The run included a provider-reported missing signal, an extra unlisted signal key, and simulated absent-key and no-signals cases.

Notes

  • Scoped behavior. An applicable ans subject with no ANS signals stays in the denominator at 0, under the default key ans-trust-discovery.certtype with status missing, as the specification defines for scoped adapters.
  • Composite in the full catalog. In createHcs25AdapterCatalog(), other universal and scoped adapters also participate for ans subjects. A subject that carries only ANS signals therefore has a low composite until those signals are populated. This is expected catalog behavior.
  • Status handling. The status handling follows the stored-status convention used in feat(hcs-25): add signal collectors for end-to-end trust-score collection hashgraph-online/standards-sdk#181: a present score with status stale becomes stale, and otherwise it is ok.

Review checklist (team)

  • Behavior matches the merged adapter and signal docs
  • Test cases are sufficient
  • Wording is appropriate for the public upstream repository
  • Commit is signed, verified and DCO signed off

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>
@chou-godaddy

Copy link
Copy Markdown
Owner Author

Approved internally. Opened upstream as hashgraph-online#184 from the same branch and commit. Closing without merging so this fork's main stays in sync with upstream.

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