feat(core): the webvh DID lifecycle, and the rest of contexts - #123
Merged
Conversation
Takes coverage of the agent's task surface from 110 of 161 families to 130.
These 20 were not missing by choice — they had no published schema to implement
against, which is the usual reason a family is absent here. Specifying them
upstream (trust-tasks #240) and publishing the bindings (0.10.0) is what
unblocked them, so this is the other half of that work rather than new ground.
**`webvh/` is a new module, deliberately separate from `did-hosting/`.** The
distinction is the counterparty, and it is not cosmetic: `did-hosting/` talks to
a hosting *service* that publishes a document at a URL and serves its log, and
the agent is merely one of its clients. Everything here is addressed to the
agent, which holds the keys and signs the log entries. Only the agent can mint
or update a DID it controls; the host can only serve what it is handed. Putting
them in one module would invite sending a signing request to something that
cannot sign.
- `dids/*` — create, get, list, update, delete, rotate-keys,
register-with-server
- `servers/*` — list, register, remove, domains, reconcile
- `agent-name/*` — set, remove, list, check, enable, disable
`contexts/{get,update,update-did}` go into `vta/contexts.ts` beside list and
create, and use that file's `normalizeContext` fold so a pre-camelCase agent
still decodes.
Three things the tests pin, because each is silently wrong rather than loudly
wrong:
- **An omitted `serverId` must be absent, not null.** Absence means serverless —
the caller serves the log itself — so a stray `null` asks for a different DID.
- **`portable: false` is sent**, because false is a decision and absent is not:
portability cannot be added to a DID afterwards.
- **`servers/{domains,reconcile}` are 0.1, not 1.0.** The version is part of the
task URI, so guessing 1.0 to match its neighbours would address a task that
does not exist.
`contexts/update` sends the policy whole, and its doc says so: the agent stores
what it is given rather than merging, so a partial policy quietly widens what a
context may do.
The coverage snapshot moves 110 → 130 in this commit, as its test requires. Of
the 31 still outstanding, `vault/*`'s archive/restore/purge and credentials
sub-family, backup, attestation, seeds and audit retention are unspecced, and
the wider `vtc/*` surface belongs to a community rather than an agent.
Lint clean; 527 tests passing.
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Takes
@openvtc/pnm-core's coverage of the agent's task surface from110 of 161 families to 130.
webvh/dids/*webvh/servers/*webvh/agent-name/*vta/contexts/*Why they were missing
Not by choice — they had no published schema to implement against, which is
the usual reason a family is absent here. Specifying them upstream
(trustoverip/dtgwg-trust-tasks-tf#240) and publishing the bindings
(
@openvtc/trust-tasks0.10.0, #242) is what unblocked them. This is the otherhalf of that work rather than new ground.
webvh/is a new module, deliberately not part ofdid-hosting/The distinction is the counterparty, and it isn't cosmetic:
did-hosting/talks to a hosting service — it publishes a document at aURL and serves its log, and the agent is one of its clients.
webvh/talks to the agent — it holds the keys and signs the log entries.Only the agent can mint or update a DID it controls; the host can only serve
what it's handed. Folding these into one module would invite sending a signing
request to something that cannot sign.
New entry point
@openvtc/pnm-core/webvh, registered at layer 4 in themodule-boundary test.
Three things the tests pin
Each is silently wrong rather than loudly wrong, which is why they're worth a
test each:
serverIdis absent, notnull. Absence means serverless —the caller serves the log itself — so a stray
nullasks for a different DID.portable: falseis sent. False is a decision and absent is not, andportability cannot be added to a DID after it's minted.
servers/{domains,reconcile}are0.1, not1.0. The version is part ofthe task URI, so assuming
1.0to match their neighbours would address a taskthat doesn't exist. This one actually bit during implementation.
contexts/updatereplaces, it doesn't mergeDocumented on the parameter, because the failure mode is quiet: the agent stores
the policy it's given, so a partial object drops the constraints it omits —
which for a policy means silently widening what a context may do. Read the
current policy, apply your edit, send it whole.
contexts/{get,update,update-did}live invta/contexts.tsbeside list andcreate, and reuse that file's
normalizeContextfold so a pre-camelCase agentstill decodes.
Coverage snapshot
Moved 110 → 130 in this commit, as its test requires — the number is a snapshot
to be reviewed in a diff, not a threshold.
Of the 31 still outstanding:
vault/*'s archive/restore/purge and credentialssub-family, backup, attestation, seeds and audit retention are unspecced, and
the wider
vtc/*surface belongs to a community rather than an agent.Test
Lint (
tsc -b) clean. 527 tests passing, 0 failing (was 504) — 17 newacross
webvh.dids-servers-names.mjsandvta.contexts-get-update.mjs.Checklist (stack guide §9)
fetch(); these ride the injectedTrustTaskSender(R1.2)(R3.*) — payloads come from the generated bindings, so the wire is the
schema by construction