feat(runtime): add runtime 1.0 model - #198
Conversation
Signed-off-by: Niall Roche <niall.roche@gmail.com>
| */ | ||
| asset State identified by stateId { | ||
| o String stateId | ||
| --> Contract contract |
There was a problem hiding this comment.
I noticed recently that Devanshi was forced to convert all of our sample templates to Contract templates (from Clause templates) because of a similar change in Obligations.
This change mirrors the Obligation design, although collectively it effectively makes Clauses unable to have state and emit Obligations. That could be a sensible design (and today there isn't a technical difference between the two), however we should make this decision consciously.
There was a problem hiding this comment.
Agreed — this should be a conscious decision.
One historical detail: runtime@0.2.0.Obligation already required --> Contract contract, so the Contract-only obligation constraint predates these PRs. What is new here is that State changes from an empty, unbound asset into one requiring the same Contract relationship.
My initial idea was to add clauseId to State, but that would not actually solve the problem you identified: a Clause template would still need a Contract instance to satisfy the required relationship.
I think the cleaner solution is to replace:
--> Contract contract
with:
o AgreementReference agreement
from contract@1.0.0. AgreementReference already carries the agreement id/hash, template provenance, and optional clauseId/clauseHash. That allows both Contract and Clause templates to create state without making Clause extend Contract, while retaining stronger provenance than an unqualified identifier.
The deliberate trade-off is replacing a resolved Concerto relationship with a portable value reference and repeating agreement/template provenance on each state snapshot. I think that is appropriate for state which must work without a Contract asset or registry, but would welcome your view
There was a problem hiding this comment.
this would be what I would propose
import org.accordproject.contract@1.0.0.AgreementReference from https://models.accordproject.org/accordproject/contract@1.0.0.cto
import org.accordproject.crypto@1.0.0.ContentHash from https://models.accordproject.org/crypto/crypto@1.0.0.cto
asset State identified by stateId {
o String stateId
o AgreementReference agreement
o Long revision default=0 range=[0,]
o DateTime effectiveAt
o ContentHash stateHash optional
o ContentHash previousStateHash optional
}
Note: the contract@1.0.0.Contract import is no longer needed and should be dropped.
| --> Contract contract | ||
| o Long revision default=0 range=[0,] | ||
| o DateTime effectiveAt | ||
| o ContentHash stateHash |
There was a problem hiding this comment.
Noting that this makes the Crypto namespace a runtime dependency for all templates.
No immediate concern, but it could force us to rev versions here if we bump minor versions of the crypto model.
There was a problem hiding this comment.
Agreed. contract@1.0.0 already makes crypto a transitive dependency because its agreement and template provenance use ContentHash, so the direct runtime import makes that dependency visible rather than introducing it for the first time.
Because the crypto version is part of the namespace, publishing crypto@1.1.0 would not break an existing runtime@1.0.0; runtime would continue resolving crypto@1.0.0. However, adopting the newer crypto types would require a corresponding runtime revision, and consumers could otherwise encounter both crypto namespaces in the same model graph. So there is genuine adoption coupling even if there is no immediate breakage.
Your comment also exposes a more immediate issue: stateHash is mandatory while canonical state serialization is undefined. I propose making stateHash optional in the core runtime model. A deterministic-state profile can require it and define the representation, exclusions and canonicalization, potentially using JCS over Concerto JSON while excluding stateHash itself.
I would not promise to make it mandatory in a later minor revision, because changing an optional field to required would be breaking.
| * predecessor when one exists. A concrete base state is retained so templates | ||
| * which need no additional properties can use it directly. | ||
| * | ||
| * Obligations are intentionally not defined in this namespace. New |
There was a problem hiding this comment.
Did you consider adding the base Obligation type here (perhaps as abstract), but putting the concrete subclasses in a separate space? I'm trying to judge how much of the obligations namespace is needed for everyday use cases.
There was a problem hiding this comment.
I did consider it, but my preference is still to keep the base Obligation outside runtime.
The 1.0 obligation is durable identified state rather than a runtime event. It carries legal lifecycle status, agreement provenance, revision, evidence/basis hashes and supersession information. Placing that base in runtime would mean future changes to the obligation lifecycle force runtime revisions, even for templates that never use obligations.
However, your everyday-use concern is valid. Concerto resolves the model file and namespace, so importing PaymentObligation effectively loads the complete obligation@1.0.0 model; describing the minimum as only the five directly used types understates that dependency surface.
I suggest keeping the independent obligation namespace, but revisiting the split in #196:
- a minimal obligation core containing the abstract base, status and shared references;
- concrete payment/performance/notification types in a separate types or profile namespace; and
- transitions and fulfilment attempts in a lifecycle profile if we want the smallest possible everyday dependency.
That addresses the dependency concern without coupling obligation evolution to runtime.
|
Thanks for the review @mttrbrts — the three comments surfaced two proposed runtime changes and one obligation-scope question.
Details are in the inline replies. |
Builds on the contract, runtime and obligation 1.0 models from #197, #198 and #196, which are included here unchanged as the commits beneath this one. This commit is the delta: it keeps their type inventory and reworks the structure underneath it. This is a design target, not a migration-ready change. It settles the structural questions that a stable 1.0 release needs answered, so that the answers can be reviewed together rather than one PR at a time. - Rename contract@1.0.0 to agreement@1.0.0, and model an agreement as a set of documents rather than a single instrument, so that a master agreement with schedules and confirmations is expressible. - Add party@1.0.0 defining Party and its portable PartyRef projection, so the 1.0 family has one party representation instead of three. - Address clause instances by TemplateMark instance path in a map, rather than by a static tree, since clause instances are data-driven: a list block yields one instance per element and a conditional may yield none. - Carry template data by composition in TemplateData rather than by subclassing the agreement envelope, so the envelope's type and its relationship URIs stay stable across template versions. - Hold runtime state as one revisioned document per agreement, with per-clause state keyed by the same instance paths. - Point obligation@1.0.0 at the shared PartyRef and AgreementReference in place of its local equivalents. contract@1.0.0 is deleted rather than kept alongside agreement@1.0.0. Model URLs are permanent, so it must never be published if this direction is taken: a dead namespace is worse than the rename. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Matt Roberts <code@rbrts.uk>
Closes #N/A
Introduces
org.accordproject.runtime@1.0.0after publication ofcontract@1.0.0. The model keeps generic request and response semantics, gives runtime state stable identity and revision history, and moves reusable obligation vocabulary out of the runtime namespace.Changes
RequestandResponsebase transactions.Stateasset.contract@1.0.0.Contract.Obligationfrom the new runtime namespace; new implementations useorg.accordproject.obligation@1.0.0.runtime@0.2.0models unchanged for compatibility.Flags
contract@1.0.0is merged and published because the models build resolves imports throughmodels.accordproject.org.stateHashis calculated over the canonical state representation excluding thestateHashproperty itself.Screenshots or Video
Not applicable. This PR contains a Concerto model change only.
Related Issues
Author Checklist
--signoffoption of git commit.mainfromniallroche:codex/runtime-1.0-model