Skip to content

Commit 8917b18

Browse files
authored
update(link): Relax link schemas to support domain-level identifiers (#292)
* update(links): Relax link schemas to support domain-level identifier This change updates all link schemas (START, END, RELATION, and embedded variants) to allow references to either a CDEvent contextId, a domainId, or both. Previously, links could only reference event context IDs. This limited cross-system connectivity and encouraged embedding execution identifiers in customData purely for graph reconstruction. By allowing domainId alongside contextId: - Links can represent relationships between domain executions (e.g., pipelinerun) as well as individual events. - Connectivity metadata no longer needs to be embedded in event payloads. - Chain-first modeling constraints are relaxed, enabling relation-first graph modeling. - The change remains backward compatible. At least one of contextId or domainId is now required for link endpoints. AdditionalProperties are restricted to prevent schema drift. This preserves existing semantics while improving flexibility and reducing customData pollution. Signed-off-by: xibz <bjp@apple.com> * fixup! update(links): Relax link schemas to support domain-level identifier Signed-off-by: xibz <bjp@apple.com> * fixup! fixup! update(links): Relax link schemas to support domain-level identifier Signed-off-by: xibz <bjp@apple.com> * feat(spec): add providers This adds a more opinionated structure for providers Signed-off-by: xibz <bjp@apple.com> Signed-off-by: xibz <impactbchang@gmail.com> Signed-off-by: xibz <bjp@apple.com> * lint fixes and adding registry Signed-off-by: xibz <bjp@apple.com> --------- Signed-off-by: xibz <bjp@apple.com> Signed-off-by: xibz <impactbchang@gmail.com>
1 parent 82ef876 commit 8917b18

14 files changed

Lines changed: 512 additions & 26 deletions

.spellcheck-en-custom.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ rolledback
5656
runtime
5757
sbom
5858
schemaUri
59+
schemas
5960
schemauri
6061
specversion
6162
src

PROVIDERS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# CDEvents Provider Registry
2+
3+
The canonical registry of known `provider` values is [`schemas/registry/providers.json`](schemas/registry/providers.json). SDKs MUST use this list as the default for provider validation. See the [Provider Validation](links.md#provider-validation) section in `links.md` for the full SDK validation requirements.
4+
5+
To register a provider, open a pull request adding an entry to the `enum` in [`schemas/registry/providers.json`](schemas/registry/providers.json). Provider identifiers MUST be lowercase, start with a letter, and contain only alphanumeric characters and hyphens. Once merged, the value is considered stable and MUST NOT be renamed.

conformance/formats/domainid.json

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{
2+
"description": "Test vectors for domainId URN serialization. Each valid case specifies the logical segments and the expected serialized string. SDKs MUST produce the expected string from the given segments and MUST parse the expected string back to the same segments (round-trip).",
3+
"valid": [
4+
{
5+
"description": "GitHub PR, no provider-id",
6+
"segments": {
7+
"provider": "github",
8+
"providerId": "",
9+
"namespace": "xibz",
10+
"groups": "cdevents-spec",
11+
"type": "pr",
12+
"resourceId": "42"
13+
},
14+
"expected": "cdevents:v0:github::xibz:cdevents-spec:pr:42"
15+
},
16+
{
17+
"description": "GitHub PR with provider-id distinguishing two internal GitHub Enterprise deployments",
18+
"segments": {
19+
"provider": "github",
20+
"providerId": "org-a-github",
21+
"namespace": "xibz",
22+
"groups": "cdevents-spec",
23+
"type": "pr",
24+
"resourceId": "42"
25+
},
26+
"expected": "cdevents:v0:github:org-a-github:xibz:cdevents-spec:pr:42"
27+
},
28+
{
29+
"description": "Jira ticket, no provider-id",
30+
"segments": {
31+
"provider": "jira",
32+
"providerId": "",
33+
"namespace": "xibz",
34+
"groups": "cdevents-project",
35+
"type": "issue",
36+
"resourceId": "PROJ-123"
37+
},
38+
"expected": "cdevents:v0:jira::xibz:cdevents-project:issue:PROJ-123"
39+
},
40+
{
41+
"description": "GitLab MR with nested groups",
42+
"segments": {
43+
"provider": "gitlab",
44+
"providerId": "",
45+
"namespace": "my-company",
46+
"groups": "platform/backend",
47+
"type": "mr",
48+
"resourceId": "99"
49+
},
50+
"expected": "cdevents:v0:gitlab::my-company:platform/backend:mr:99"
51+
},
52+
{
53+
"description": "Datadog alert, no provider-id",
54+
"segments": {
55+
"provider": "datadog",
56+
"providerId": "",
57+
"namespace": "prod",
58+
"groups": "api-monitors",
59+
"type": "alert",
60+
"resourceId": "98765"
61+
},
62+
"expected": "cdevents:v0:datadog::prod:api-monitors:alert:98765"
63+
},
64+
{
65+
"description": "Docker artifact using PURL as resource id — provider, provider-id, namespace and groups all empty because registry is unknown",
66+
"segments": {
67+
"provider": "",
68+
"providerId": "",
69+
"namespace": "",
70+
"groups": "",
71+
"type": "artifact",
72+
"resourceId": "pkg%3Adocker%2Fmyapp%401.0.0"
73+
},
74+
"expected": "cdevents:v0:::::artifact:pkg%3Adocker%2Fmyapp%401.0.0"
75+
},
76+
{
77+
"description": "All optional segments empty — only type and resource id present; structurally valid",
78+
"segments": {
79+
"provider": "",
80+
"providerId": "",
81+
"namespace": "",
82+
"groups": "",
83+
"type": "pr",
84+
"resourceId": "42"
85+
},
86+
"expected": "cdevents:v0:::::pr:42"
87+
}
88+
],
89+
"invalid": [
90+
{
91+
"description": "Missing provider-id segment (only 6 colons)",
92+
"input": "cdevents:v0:github:xibz:cdevents-spec:pr:42",
93+
"reason": "Segment count mismatch — provider-id segment omitted rather than left empty"
94+
},
95+
{
96+
"description": "Empty type",
97+
"input": "cdevents:v0:github::xibz:cdevents-spec::42",
98+
"reason": "type is required and must not be empty"
99+
},
100+
{
101+
"description": "Empty resource id",
102+
"input": "cdevents:v0:github::xibz:cdevents-spec:pr:",
103+
"reason": "resource id is required and must not be empty"
104+
},
105+
{
106+
"description": "Leading slash in groups",
107+
"input": "cdevents:v0:github::xibz:/cdevents-spec:pr:42",
108+
"reason": "Leading '/' in groups is invalid"
109+
},
110+
{
111+
"description": "Trailing slash in groups",
112+
"input": "cdevents:v0:github::xibz:cdevents-spec/:pr:42",
113+
"reason": "Trailing '/' in groups is invalid"
114+
},
115+
{
116+
"description": "Wrong version",
117+
"input": "cdevents:v1:github::xibz:cdevents-spec:pr:42",
118+
"reason": "Only v0 is currently defined"
119+
},
120+
{
121+
"description": "Wrong scheme prefix",
122+
"input": "CDEvents:v0:github::xibz:cdevents-spec:pr:42",
123+
"reason": "Scheme must be lowercase 'cdevents'"
124+
}
125+
]
126+
}

0 commit comments

Comments
 (0)