@opensoftware/contracts 1.0.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,6 +25,9 @@ import { type FactoryDefinition, validate } from "@opensoftware/contracts";
25
25
  const problems = validate("factory-definition", document); // [] when valid, else { path, message } per problem
26
26
  ```
27
27
 
28
+ `runSpans(record)` reads a run record as runlog writes it: each span with its decoded resource and attributes, or
29
+ `undefined` when the value is no OTLP/JSON trace export request ([ADR 0041](../docs/decisions/0041-run-record-reader.md)).
30
+
28
31
  The schema files are exported at the paths in the table below, for example
29
32
  `@opensoftware/contracts/work-item/work-item.schema.json`, along with `events/asyncapi.yaml`, `openapi/*` and `typespec/*`.
30
33
 
@@ -39,7 +42,7 @@ Each format has one schema, generated from `typespec/`, and fixtures that CONTRA
39
42
  | run record | `run-record/run-record.schema.json` | `RunRecord` | OTel resource and root-span attributes; pins in `typespec/run-record.tsp`. |
40
43
  | evidence bundle | `evidence-bundle/evidence-bundle.schema.json` | `EvidenceManifest` | `evidence.json` at the bundle root. |
41
44
  | score | `score/score.schema.json` | `Score` | Subset of Langfuse's create-score request; factory fields in `metadata`. |
42
- | events | `events/<event>/<event>.schema.json`, `events/asyncapi.yaml` | `WorkReceived` … `PrOpened` | CloudEvents 1.0, structured JSON. |
45
+ | events | `events/<event>/<event>.schema.json`, `events/asyncapi.yaml` | `WorkReceived` … `PrClosed` | CloudEvents 1.0, structured JSON. |
43
46
 
44
47
  Wire formats (everything but the factory definition) are open: readers ignore fields they do not know, so a minor
45
48
  version may add optional fields. Read `factory.yaml` with a YAML 1.2 parser: YAML 1.1 parsers turn the key `on`
@@ -65,9 +68,11 @@ into `true`.
65
68
  ## Releases
66
69
 
67
70
  release-please opens a release pull request from the Conventional Commits under `contracts/`. Merging it creates
68
- the tag `contracts-v<version>`. The workflow `.github/workflows/publish-contracts.yml` then builds the package and
69
- publishes it to npm as `@opensoftware/contracts`, with provenance. To publish a tag again, run the workflow by
70
- hand with the tag. The CONTRACT check and `osf-contracts breaking` compare with the newest `contracts-v*` tag.
71
+ the tag `contracts-v<version>`. The release pull request also sets the version in `openapi/openapi.json`, which
72
+ `pnpm build` copies from `package.json`, so the generated file stays current. The workflow `.github/workflows/publish-contracts.yml` then builds the package and
73
+ publishes it to npm as `@opensoftware/contracts`. npm accepts a provenance statement only from a public
74
+ repository, so the workflow adds one only when this repository is public. To publish a tag again, run the
75
+ workflow by hand with the tag. The CONTRACT check and `osf-contracts breaking` compare with the newest `contracts-v*` tag.
71
76
 
72
77
  Only the TypeScript package exists (ADR 0012). A client for another language can be generated from
73
78
  `openapi/openapi.json` with any OpenAPI generator when someone needs one.
@@ -104,3 +109,5 @@ None. The CLI reads no environment variables.
104
109
  | SCN-CTR-007 | deprecated | The generated Python client round-trips every valid fixture |
105
110
  | SCN-CTR-008 | deprecated | The generated Java client round-trips every valid fixture |
106
111
  | SCN-CTR-009 | implemented | A tighter form of a "exactly one of" rule fails the compatibility check |
112
+ | SCN-CTR-010 | implemented | runSpans gives each span of a run record with its resource and decoded attributes |
113
+ | SCN-CTR-011 | implemented | runSpans gives no spans for a value that is not a trace export request |
package/dist/breaking.js CHANGED
@@ -154,3 +154,4 @@ function fail(message) {
154
154
  process.stderr.write(`${message}\n`);
155
155
  return 2;
156
156
  }
157
+ //# sourceMappingURL=breaking.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breaking.js","sourceRoot":"","sources":["../src/breaking.ts"],"names":[],"mappings":"AAAA,+GAA+G;AAC/G,uFAAuF;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AA2B3C,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC,MAAM,UAAU,QA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,UAAU,CAAC,GAAG,CAAC;YAAE,OAAO,EAAE,CAAC;QACzF,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC9B,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;YAAE,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;QAC3D,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,IAAI,CAAC,IAAY;IACxB,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACnE,CAAC;AAED,SAAS,GAAG,CAAC,IAAc,EAAE,GAAW;IACtC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACjE,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC;AAED,SAAS,IAAI,CAAC,OAAe;IAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,CAAC;AACX,CAAC"}
package/dist/cli.js CHANGED
@@ -66,3 +66,4 @@ function usage(message) {
66
66
  return 2;
67
67
  }
68
68
  process.exitCode = main(process.argv.slice(2));
69
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,kHAAkH;AAClH,6DAA6D;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;A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,CAAC,CAAC;IACX,CAAC;IACD,MAAM,QAAQ,GAAG,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5C,KAAK,MAAM,OAAO,IAAI,QAAQ;QAAE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,OAAO,CAAC,IAAI,KAAK,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC;IACtG,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,CAAC,CAAC;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,WAAW,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC;IACxD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,OAAO,KAAK,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
package/dist/formats.js CHANGED
@@ -12,7 +12,10 @@ export const FORMATS = [
12
12
  format("events/gate-decided", "GateDecided"),
13
13
  format("events/score-recorded", "ScoreRecorded"),
14
14
  format("events/pr-opened", "PrOpened"),
15
+ format("events/pr-reviewed", "PrReviewed"),
16
+ format("events/pr-closed", "PrClosed"),
15
17
  ];
16
18
  export function formatNamed(name) {
17
19
  return FORMATS.find((candidate) => candidate.name === name);
18
20
  }
21
+ //# sourceMappingURL=formats.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formats.js","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAW3G,MAAM,MAAM,GAAG,CAAC,IAAY,EAAE,KAAa,EAAU,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAY,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAEjH,MAAM,CAAC,MAAM,OAAO,GAAsB;IACxC,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,CAAC;IACjD,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC;IAC/B,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC;IACjC,MAAM,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAC7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC;IAC9C,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC;IAC9C,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC;IAChD,MAAM,CAAC,qBAAqB,EAAE,aAAa,CAAC;IAC5C,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC;IAChD,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC;IACtC,MAAM,CAAC,oBAAoB,EAAE,YAAY,CAAC;IAC1C,MAAM,CAAC,kBAAkB,EAAE,UAAU,CAAC;CACvC,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC9D,CAAC"}
@@ -111,15 +111,21 @@ export type components = {
111
111
  /** @description Adapters per port with a version range, pinned in `factory.lock` by `factory plan`. */
112
112
  providers?: components["schemas"]["Providers"];
113
113
  /** @description Agents by name. */
114
- agents: Record<string, never>;
114
+ agents: {
115
+ [key: string]: components["schemas"]["Agent"];
116
+ };
115
117
  /** @description Stages in order. Each stage runs one agent; the agent defaults to the stage name. */
116
118
  workflow?: components["schemas"]["Stage"][];
117
119
  /** @description What starts work without a person asking. */
118
120
  automations?: components["schemas"]["Automation"][];
119
121
  /** @description Scorers by name. */
120
- scorers?: Record<string, never>;
122
+ scorers?: {
123
+ [key: string]: components["schemas"]["Scorer"];
124
+ };
121
125
  /** @description Benchmark suites by name. */
122
- benchmarks?: Record<string, never>;
126
+ benchmarks?: {
127
+ [key: string]: components["schemas"]["Benchmark"];
128
+ };
123
129
  };
124
130
  /**
125
131
  * @description The version of a format inside its documents. Only 1 exists; a new major version of a format adds the next.
@@ -224,6 +230,38 @@ export type components = {
224
230
  /** @description ID in the source system. */
225
231
  externalId?: string;
226
232
  };
233
+ /** @description forge adapters: a pull request was merged or closed without a merge. */
234
+ PrClosed: {
235
+ /** @constant */
236
+ specversion: "1.0";
237
+ /** @description Unique per source. A consumer that sees the same source and id twice handles the event once. */
238
+ id: components["schemas"]["Identifier"];
239
+ /** @description The producing module, for example "/osf/intake". */
240
+ source: string;
241
+ /** @constant */
242
+ type: "pr.closed@v1";
243
+ /** Format: date-time */
244
+ time: string;
245
+ /** @description The ID of the thing the event is about: work item, gate, run, score or pull request. */
246
+ subject?: string;
247
+ /** @constant */
248
+ datacontenttype?: "application/json";
249
+ /** Format: uri */
250
+ dataschema?: string;
251
+ /** @description W3C trace context (CloudEvents distributed tracing extension). */
252
+ traceparent?: string;
253
+ data: components["schemas"]["PrClosedData"];
254
+ };
255
+ PrClosedData: {
256
+ /**
257
+ * Format: uri
258
+ * @description The pull request.
259
+ */
260
+ url: string;
261
+ /** @description True when the pull request was merged, false when it was closed without a merge. */
262
+ merged: boolean;
263
+ mergeCommit?: components["schemas"]["CommitHash"];
264
+ };
227
265
  /** @description forge adapters: the factory opened a pull request. */
228
266
  PrOpened: {
229
267
  /** @constant */
@@ -260,6 +298,39 @@ export type components = {
260
298
  workItemId?: components["schemas"]["Identifier"];
261
299
  runId?: components["schemas"]["Identifier"];
262
300
  };
301
+ /** @description forge adapters: a person, an agent or a bot reviewed or commented on a pull request. */
302
+ PrReviewed: {
303
+ /** @constant */
304
+ specversion: "1.0";
305
+ /** @description Unique per source. A consumer that sees the same source and id twice handles the event once. */
306
+ id: components["schemas"]["Identifier"];
307
+ /** @description The producing module, for example "/osf/intake". */
308
+ source: string;
309
+ /** @constant */
310
+ type: "pr.reviewed@v1";
311
+ /** Format: date-time */
312
+ time: string;
313
+ /** @description The ID of the thing the event is about: work item, gate, run, score or pull request. */
314
+ subject?: string;
315
+ /** @constant */
316
+ datacontenttype?: "application/json";
317
+ /** Format: uri */
318
+ dataschema?: string;
319
+ /** @description W3C trace context (CloudEvents distributed tracing extension). */
320
+ traceparent?: string;
321
+ data: components["schemas"]["PrReviewedData"];
322
+ };
323
+ PrReviewedData: {
324
+ /**
325
+ * Format: uri
326
+ * @description The pull request.
327
+ */
328
+ url: string;
329
+ reviewer: components["schemas"]["Actor"];
330
+ /** @description True when an agent or a bot wrote the review, not a person. */
331
+ automated?: boolean;
332
+ state: components["schemas"]["ReviewState"];
333
+ };
263
334
  /** @enum {string} */
264
335
  Priority: "urgent" | "high" | "normal" | "low";
265
336
  Producer: {
@@ -268,16 +339,36 @@ export type components = {
268
339
  };
269
340
  /** @description The adapters a factory uses, per port (docs/architecture/internals.md). Keys are adapter names. */
270
341
  Providers: {
271
- harness?: Record<string, never>;
272
- sandbox?: Record<string, never>;
273
- channel?: Record<string, never>;
274
- tracker?: Record<string, never>;
275
- forge?: Record<string, never>;
276
- inference?: Record<string, never>;
277
- secrets?: Record<string, never>;
278
- telemetry?: Record<string, never>;
279
- policy?: Record<string, never>;
342
+ harness?: {
343
+ [key: string]: components["schemas"]["VersionRange"];
344
+ };
345
+ sandbox?: {
346
+ [key: string]: components["schemas"]["VersionRange"];
347
+ };
348
+ channel?: {
349
+ [key: string]: components["schemas"]["VersionRange"];
350
+ };
351
+ tracker?: {
352
+ [key: string]: components["schemas"]["VersionRange"];
353
+ };
354
+ forge?: {
355
+ [key: string]: components["schemas"]["VersionRange"];
356
+ };
357
+ inference?: {
358
+ [key: string]: components["schemas"]["VersionRange"];
359
+ };
360
+ secrets?: {
361
+ [key: string]: components["schemas"]["VersionRange"];
362
+ };
363
+ telemetry?: {
364
+ [key: string]: components["schemas"]["VersionRange"];
365
+ };
366
+ policy?: {
367
+ [key: string]: components["schemas"]["VersionRange"];
368
+ };
280
369
  };
370
+ /** @enum {string} */
371
+ ReviewState: "approved" | "changes_requested" | "commented";
281
372
  /** @description foreman: a run ended. */
282
373
  RunCompleted: {
283
374
  /** @constant */
@@ -440,6 +531,8 @@ export type components = {
440
531
  "osf.judge.model"?: string;
441
532
  /** @description Cost of the judge call. */
442
533
  "osf.judge.cost.usd"?: number;
534
+ } & {
535
+ [key: string]: unknown;
443
536
  };
444
537
  /** @description scorekit: a scorer scored a run. */
445
538
  ScoreRecorded: {
@@ -1 +1,2 @@
1
1
  export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/generated/types.ts"],"names":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { components } from "./generated/types.ts";
3
3
  export { diff as breakingChanges, type Schema } from "./breaking.ts";
4
4
  export { FORMATS, type Format, formatNamed } from "./formats.ts";
5
5
  export type { components } from "./generated/types.ts";
6
+ export { type AttributeValue, type RunSpan, runSpans, type SpanAttributes } from "./run-record.ts";
6
7
  type Schemas = components["schemas"];
7
8
  export type FactoryDefinition = Schemas["FactoryDefinition"];
8
9
  export type WorkItem = Schemas["WorkItem"];
@@ -15,6 +16,8 @@ export type GateRequested = Schemas["GateRequested"];
15
16
  export type GateDecided = Schemas["GateDecided"];
16
17
  export type ScoreRecorded = Schemas["ScoreRecorded"];
17
18
  export type PrOpened = Schemas["PrOpened"];
19
+ export type PrReviewed = Schemas["PrReviewed"];
20
+ export type PrClosed = Schemas["PrClosed"];
18
21
  /** One reason a document does not match its format. `path` is a JSON Pointer into the document. */
19
22
  export interface Problem {
20
23
  path: string;
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import addFormats from "ajv-formats";
7
7
  import { formatNamed } from "./formats.js";
8
8
  export { diff as breakingChanges } from "./breaking.js";
9
9
  export { FORMATS, formatNamed } from "./formats.js";
10
+ export { runSpans } from "./run-record.js";
10
11
  /** The package root: dist/ and src/ both sit one level below it, next to the schema folders. */
11
12
  const ROOT = join(dirname(fileURLToPath(import.meta.url)), "..");
12
13
  const validators = new Map();
@@ -71,3 +72,4 @@ function describe(error) {
71
72
  return { path: error.instancePath || "/", message: error.message ?? error.keyword };
72
73
  }
73
74
  }
75
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,OAAO,EAAE,EAA2C,MAAM,kBAAkB,CAAC;AACpF,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,EAAe,WAAW,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,EAAE,IAAI,IAAI,eAAe,EAAe,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,OAAO,EAAe,WAAW,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAqC,QAAQ,EAAuB,MAAM,iBAAiB,CAAC;AAuBnG,gGAAgG;AAChG,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AACjE,MAAM,UAAU,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEvD,gFAAgF;AAChF,MAAM,UAAU,QAAQ,CAAC,MAAuB;IAC9C,MAAM,KAAK,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACxE,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK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AAE,CAAC,GAAG,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,CAAC;IACpH,QAAQ,KAAK,CAAC,OAAO,EAAE,CAAC;QACtB,KAAK,sBAAsB;YACzB,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;QAC5F,KAAK,uBAAuB;YAC1B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC;QAC7F,KAAK,UAAU;YACb,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,OAAO,EAAE,wBAAwB,EAAE,CAAC;QAClG,KAAK,OAAO,CAAC;QACb,KAAK,OAAO;YACV,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,YAAY,IAAI,GAAG,EAAE,OAAO,EAAE,6CAA6C,EAAE,CAAC;QACrG;YACE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,YAAY,IAAI,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;IACxF,CAAC;AACH,CAAC"}
package/dist/roundtrip.js CHANGED
@@ -87,3 +87,4 @@ function firstDifference(a, b, path) {
87
87
  ? undefined
88
88
  : `${path || "/"}: ${JSON.stringify(a)} → ${JSON.stringify(b)}`;
89
89
  }
90
+ //# sourceMappingURL=roundtrip.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roundtrip.js","sourceRoot":"","sources":["../src/roundtrip.ts"],"names":[],"mappings":"AAAA,mHAAmH;AACnH,iHAAi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AAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC;YACtE,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QAC1B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QACvG,MAAM,IAAI,GAAG,CAA4B,CAAC;QAC1C,MAAM,KAAK,GAAG,CAA4B,CAAC;QAC3C,KAAK,MAAM,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;YACzE,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;YACvE,IAAI,KAAK;gBAAE,OAAO,KAAK,CAAC;QAC1B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QAC5C,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,KAAK,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,18 @@
1
+ /** An OTLP/JSON attribute value as runlog writes it: a string, an integer, a double or an array of them. */
2
+ export type AttributeValue = string | number | AttributeValue[] | undefined;
3
+ export type SpanAttributes = Record<string, AttributeValue>;
4
+ /** One span of a run record, with its resource. */
5
+ export interface RunSpan {
6
+ traceId: string;
7
+ spanId: string;
8
+ parentSpanId: string | undefined;
9
+ name: string;
10
+ /** Unix time in nanoseconds; 0 when the span has none. */
11
+ start: bigint;
12
+ end: bigint;
13
+ /** The attributes of the span's resource, like `osf.run.id`. */
14
+ resource: SpanAttributes;
15
+ attributes: SpanAttributes;
16
+ }
17
+ /** The spans of a run record in the order they appear; undefined when the value is no OTLP/JSON trace export request. */
18
+ export declare function runSpans(record: unknown): RunSpan[] | undefined;
@@ -0,0 +1,27 @@
1
+ // Reading run records: OTLP/JSON trace export requests with the run-record attributes, as runlog writes them.
2
+ /** The spans of a run record in the order they appear; undefined when the value is no OTLP/JSON trace export request. */
3
+ export function runSpans(record) {
4
+ const { resourceSpans } = (record ?? {});
5
+ if (!Array.isArray(resourceSpans))
6
+ return undefined;
7
+ return resourceSpans.flatMap((entry) => {
8
+ const resource = decode(entry.resource?.attributes);
9
+ return (entry.scopeSpans ?? []).flatMap((scope) => (scope.spans ?? []).map((span) => ({
10
+ traceId: span.traceId,
11
+ spanId: span.spanId,
12
+ parentSpanId: span.parentSpanId || undefined,
13
+ name: span.name ?? "",
14
+ start: BigInt(span.startTimeUnixNano ?? 0),
15
+ end: BigInt(span.endTimeUnixNano ?? 0),
16
+ resource,
17
+ attributes: decode(span.attributes),
18
+ })));
19
+ });
20
+ }
21
+ const value = (otlp) => {
22
+ if (otlp.arrayValue)
23
+ return (otlp.arrayValue.values ?? []).map(value);
24
+ return otlp.intValue === undefined ? (otlp.stringValue ?? otlp.doubleValue) : Number(otlp.intValue);
25
+ };
26
+ const decode = (list) => Object.fromEntries((list ?? []).map(({ key, value: entry }) => [key, value(entry)]));
27
+ //# sourceMappingURL=run-record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-record.js","sourceRoot":"","sources":["../src/run-record.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAyC9G,yHA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,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACtG,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,CAAC,IAAoB,EAAkB,EAAE,CACtD,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -49,6 +49,18 @@ channels:
49
49
  messages:
50
50
  PrOpened:
51
51
  $ref: '#/components/messages/PrOpened'
52
+ pr-reviewed:
53
+ address: osf.pr.reviewed.v1
54
+ description: A person, an agent or a bot reviewed or commented on a pull request.
55
+ messages:
56
+ PrReviewed:
57
+ $ref: '#/components/messages/PrReviewed'
58
+ pr-closed:
59
+ address: osf.pr.closed.v1
60
+ description: A pull request was merged or closed without a merge.
61
+ messages:
62
+ PrClosed:
63
+ $ref: '#/components/messages/PrClosed'
52
64
  operations:
53
65
  publishWorkReceived:
54
66
  action: send
@@ -92,6 +104,20 @@ operations:
92
104
  $ref: '#/channels/pr-opened'
93
105
  messages:
94
106
  - $ref: '#/channels/pr-opened/messages/PrOpened'
107
+ publishPrReviewed:
108
+ action: send
109
+ summary: Published by forge adapters.
110
+ channel:
111
+ $ref: '#/channels/pr-reviewed'
112
+ messages:
113
+ - $ref: '#/channels/pr-reviewed/messages/PrReviewed'
114
+ publishPrClosed:
115
+ action: send
116
+ summary: Published by forge adapters.
117
+ channel:
118
+ $ref: '#/channels/pr-closed'
119
+ messages:
120
+ - $ref: '#/channels/pr-closed/messages/PrClosed'
95
121
  components:
96
122
  messages:
97
123
  WorkReceived:
@@ -142,3 +168,19 @@ components:
142
168
  schemaFormat: application/schema+json;version=draft-2020-12
143
169
  schema:
144
170
  $ref: './pr-opened/pr-opened.schema.json'
171
+ PrReviewed:
172
+ name: pr.reviewed@v1
173
+ title: pr.reviewed@v1
174
+ contentType: application/cloudevents+json
175
+ payload:
176
+ schemaFormat: application/schema+json;version=draft-2020-12
177
+ schema:
178
+ $ref: './pr-reviewed/pr-reviewed.schema.json'
179
+ PrClosed:
180
+ name: pr.closed@v1
181
+ title: pr.closed@v1
182
+ contentType: application/cloudevents+json
183
+ payload:
184
+ schemaFormat: application/schema+json;version=draft-2020-12
185
+ schema:
186
+ $ref: './pr-closed/pr-closed.schema.json'
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/sesigl/open-software-factory/main/contracts/events/pr-closed/pr-closed.schema.json",
4
+ "title": "PrClosed",
5
+ "$comment": "Generated by `pnpm build` in contracts/ from typespec/. Do not edit.",
6
+ "type": "object",
7
+ "properties": {
8
+ "specversion": {
9
+ "type": "string",
10
+ "const": "1.0"
11
+ },
12
+ "id": {
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "maxLength": 128,
16
+ "description": "Unique per source. A consumer that sees the same source and id twice handles the event once."
17
+ },
18
+ "source": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "description": "The producing module, for example \"/osf/intake\"."
22
+ },
23
+ "type": {
24
+ "type": "string",
25
+ "const": "pr.closed@v1"
26
+ },
27
+ "time": {
28
+ "type": "string",
29
+ "format": "date-time"
30
+ },
31
+ "subject": {
32
+ "type": "string",
33
+ "description": "The ID of the thing the event is about: work item, gate, run, score or pull request."
34
+ },
35
+ "datacontenttype": {
36
+ "type": "string",
37
+ "const": "application/json"
38
+ },
39
+ "dataschema": {
40
+ "type": "string",
41
+ "format": "uri"
42
+ },
43
+ "traceparent": {
44
+ "type": "string",
45
+ "description": "W3C trace context (CloudEvents distributed tracing extension)."
46
+ },
47
+ "data": {
48
+ "type": "object",
49
+ "properties": {
50
+ "url": {
51
+ "type": "string",
52
+ "format": "uri",
53
+ "description": "The pull request."
54
+ },
55
+ "merged": {
56
+ "type": "boolean",
57
+ "description": "True when the pull request was merged, false when it was closed without a merge."
58
+ },
59
+ "mergeCommit": {
60
+ "type": "string",
61
+ "pattern": "^[0-9a-f]{7,40}$",
62
+ "description": "A Git commit hash, abbreviated (7+) or full. The factory version is the commit of the factory definition."
63
+ }
64
+ },
65
+ "required": [
66
+ "url",
67
+ "merged"
68
+ ]
69
+ }
70
+ },
71
+ "required": [
72
+ "specversion",
73
+ "id",
74
+ "source",
75
+ "type",
76
+ "time",
77
+ "data"
78
+ ],
79
+ "description": "forge adapters: a pull request was merged or closed without a merge."
80
+ }
@@ -0,0 +1,111 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://raw.githubusercontent.com/sesigl/open-software-factory/main/contracts/events/pr-reviewed/pr-reviewed.schema.json",
4
+ "title": "PrReviewed",
5
+ "$comment": "Generated by `pnpm build` in contracts/ from typespec/. Do not edit.",
6
+ "type": "object",
7
+ "properties": {
8
+ "specversion": {
9
+ "type": "string",
10
+ "const": "1.0"
11
+ },
12
+ "id": {
13
+ "type": "string",
14
+ "minLength": 1,
15
+ "maxLength": 128,
16
+ "description": "Unique per source. A consumer that sees the same source and id twice handles the event once."
17
+ },
18
+ "source": {
19
+ "type": "string",
20
+ "minLength": 1,
21
+ "description": "The producing module, for example \"/osf/intake\"."
22
+ },
23
+ "type": {
24
+ "type": "string",
25
+ "const": "pr.reviewed@v1"
26
+ },
27
+ "time": {
28
+ "type": "string",
29
+ "format": "date-time"
30
+ },
31
+ "subject": {
32
+ "type": "string",
33
+ "description": "The ID of the thing the event is about: work item, gate, run, score or pull request."
34
+ },
35
+ "datacontenttype": {
36
+ "type": "string",
37
+ "const": "application/json"
38
+ },
39
+ "dataschema": {
40
+ "type": "string",
41
+ "format": "uri"
42
+ },
43
+ "traceparent": {
44
+ "type": "string",
45
+ "description": "W3C trace context (CloudEvents distributed tracing extension)."
46
+ },
47
+ "data": {
48
+ "type": "object",
49
+ "properties": {
50
+ "url": {
51
+ "type": "string",
52
+ "format": "uri",
53
+ "description": "The pull request."
54
+ },
55
+ "reviewer": {
56
+ "type": "object",
57
+ "properties": {
58
+ "kind": {
59
+ "type": "string",
60
+ "enum": [
61
+ "person",
62
+ "trigger"
63
+ ],
64
+ "description": "Who caused something: a person, or an automated trigger such as a cron rule or an alert."
65
+ },
66
+ "id": {
67
+ "type": "string",
68
+ "minLength": 1,
69
+ "description": "Stable ID in the source system, prefixed with the source, for example \"slack:U024BE7LH\"."
70
+ },
71
+ "displayName": {
72
+ "type": "string",
73
+ "description": "Shown to people, for example \"Varun\"."
74
+ }
75
+ },
76
+ "required": [
77
+ "kind",
78
+ "id"
79
+ ],
80
+ "description": "A person or trigger. RUNTIME-008: every run is attributed to one."
81
+ },
82
+ "automated": {
83
+ "type": "boolean",
84
+ "description": "True when an agent or a bot wrote the review, not a person."
85
+ },
86
+ "state": {
87
+ "type": "string",
88
+ "enum": [
89
+ "approved",
90
+ "changes_requested",
91
+ "commented"
92
+ ]
93
+ }
94
+ },
95
+ "required": [
96
+ "url",
97
+ "reviewer",
98
+ "state"
99
+ ]
100
+ }
101
+ },
102
+ "required": [
103
+ "specversion",
104
+ "id",
105
+ "source",
106
+ "type",
107
+ "time",
108
+ "data"
109
+ ],
110
+ "description": "forge adapters: a person, an agent or a bot reviewed or commented on a pull request."
111
+ }
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "Open Software Factory contracts",
5
- "version": "1.0.0",
5
+ "version": "1.4.0",
6
6
  "description": "The shared formats as named models. No operations: module APIs are added per module. Generated by `pnpm build` in contracts/ from typespec/. Do not edit.",
7
7
  "license": {
8
8
  "name": "Apache-2.0",
@@ -644,6 +644,81 @@
644
644
  "source"
645
645
  ]
646
646
  },
647
+ "PrClosed": {
648
+ "type": "object",
649
+ "properties": {
650
+ "specversion": {
651
+ "type": "string",
652
+ "const": "1.0"
653
+ },
654
+ "id": {
655
+ "$ref": "#/components/schemas/Identifier",
656
+ "description": "Unique per source. A consumer that sees the same source and id twice handles the event once."
657
+ },
658
+ "source": {
659
+ "type": "string",
660
+ "minLength": 1,
661
+ "description": "The producing module, for example \"/osf/intake\"."
662
+ },
663
+ "type": {
664
+ "type": "string",
665
+ "const": "pr.closed@v1"
666
+ },
667
+ "time": {
668
+ "type": "string",
669
+ "format": "date-time"
670
+ },
671
+ "subject": {
672
+ "type": "string",
673
+ "description": "The ID of the thing the event is about: work item, gate, run, score or pull request."
674
+ },
675
+ "datacontenttype": {
676
+ "type": "string",
677
+ "const": "application/json"
678
+ },
679
+ "dataschema": {
680
+ "type": "string",
681
+ "format": "uri"
682
+ },
683
+ "traceparent": {
684
+ "type": "string",
685
+ "description": "W3C trace context (CloudEvents distributed tracing extension)."
686
+ },
687
+ "data": {
688
+ "$ref": "#/components/schemas/PrClosedData"
689
+ }
690
+ },
691
+ "required": [
692
+ "specversion",
693
+ "id",
694
+ "source",
695
+ "type",
696
+ "time",
697
+ "data"
698
+ ],
699
+ "description": "forge adapters: a pull request was merged or closed without a merge."
700
+ },
701
+ "PrClosedData": {
702
+ "type": "object",
703
+ "properties": {
704
+ "url": {
705
+ "type": "string",
706
+ "format": "uri",
707
+ "description": "The pull request."
708
+ },
709
+ "merged": {
710
+ "type": "boolean",
711
+ "description": "True when the pull request was merged, false when it was closed without a merge."
712
+ },
713
+ "mergeCommit": {
714
+ "$ref": "#/components/schemas/CommitHash"
715
+ }
716
+ },
717
+ "required": [
718
+ "url",
719
+ "merged"
720
+ ]
721
+ },
647
722
  "PrOpened": {
648
723
  "type": "object",
649
724
  "properties": {
@@ -747,6 +822,85 @@
747
822
  "author"
748
823
  ]
749
824
  },
825
+ "PrReviewed": {
826
+ "type": "object",
827
+ "properties": {
828
+ "specversion": {
829
+ "type": "string",
830
+ "const": "1.0"
831
+ },
832
+ "id": {
833
+ "$ref": "#/components/schemas/Identifier",
834
+ "description": "Unique per source. A consumer that sees the same source and id twice handles the event once."
835
+ },
836
+ "source": {
837
+ "type": "string",
838
+ "minLength": 1,
839
+ "description": "The producing module, for example \"/osf/intake\"."
840
+ },
841
+ "type": {
842
+ "type": "string",
843
+ "const": "pr.reviewed@v1"
844
+ },
845
+ "time": {
846
+ "type": "string",
847
+ "format": "date-time"
848
+ },
849
+ "subject": {
850
+ "type": "string",
851
+ "description": "The ID of the thing the event is about: work item, gate, run, score or pull request."
852
+ },
853
+ "datacontenttype": {
854
+ "type": "string",
855
+ "const": "application/json"
856
+ },
857
+ "dataschema": {
858
+ "type": "string",
859
+ "format": "uri"
860
+ },
861
+ "traceparent": {
862
+ "type": "string",
863
+ "description": "W3C trace context (CloudEvents distributed tracing extension)."
864
+ },
865
+ "data": {
866
+ "$ref": "#/components/schemas/PrReviewedData"
867
+ }
868
+ },
869
+ "required": [
870
+ "specversion",
871
+ "id",
872
+ "source",
873
+ "type",
874
+ "time",
875
+ "data"
876
+ ],
877
+ "description": "forge adapters: a person, an agent or a bot reviewed or commented on a pull request."
878
+ },
879
+ "PrReviewedData": {
880
+ "type": "object",
881
+ "properties": {
882
+ "url": {
883
+ "type": "string",
884
+ "format": "uri",
885
+ "description": "The pull request."
886
+ },
887
+ "reviewer": {
888
+ "$ref": "#/components/schemas/Actor"
889
+ },
890
+ "automated": {
891
+ "type": "boolean",
892
+ "description": "True when an agent or a bot wrote the review, not a person."
893
+ },
894
+ "state": {
895
+ "$ref": "#/components/schemas/ReviewState"
896
+ }
897
+ },
898
+ "required": [
899
+ "url",
900
+ "reviewer",
901
+ "state"
902
+ ]
903
+ },
750
904
  "Priority": {
751
905
  "type": "string",
752
906
  "enum": [
@@ -843,6 +997,14 @@
843
997
  "description": "The adapters a factory uses, per port (docs/architecture/internals.md). Keys are adapter names.",
844
998
  "additionalProperties": false
845
999
  },
1000
+ "ReviewState": {
1001
+ "type": "string",
1002
+ "enum": [
1003
+ "approved",
1004
+ "changes_requested",
1005
+ "commented"
1006
+ ]
1007
+ },
846
1008
  "RunCompleted": {
847
1009
  "type": "object",
848
1010
  "properties": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensoftware/contracts",
3
- "version": "1.0.0",
3
+ "version": "1.4.0",
4
4
  "description": "The shared formats of the open software factory: JSON Schemas, TypeScript types and the osf-contracts CLI.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -41,7 +41,7 @@
41
41
  "@typespec/compiler": "1.17.0",
42
42
  "@typespec/json-schema": "1.17.0",
43
43
  "openapi-typescript": "7.13.0",
44
- "@opensoftware/testkit": "0.0.0"
44
+ "@opensoftware/testkit": "0.8.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "node scripts/build.ts",
@@ -54,6 +54,12 @@ model ScoreRecorded is CloudEvent<"score.recorded@v1", Score>;
54
54
  /** forge adapters: the factory opened a pull request. */
55
55
  model PrOpened is CloudEvent<"pr.opened@v1", PrOpenedData>;
56
56
 
57
+ /** forge adapters: a person, an agent or a bot reviewed or commented on a pull request. */
58
+ model PrReviewed is CloudEvent<"pr.reviewed@v1", PrReviewedData>;
59
+
60
+ /** forge adapters: a pull request was merged or closed without a merge. */
61
+ model PrClosed is CloudEvent<"pr.closed@v1", PrClosedData>;
62
+
57
63
  model RunCompletedData {
58
64
  runId: Identifier;
59
65
  workItemId: Identifier;
@@ -132,3 +138,31 @@ model PrOpenedData {
132
138
  workItemId?: Identifier;
133
139
  runId?: Identifier;
134
140
  }
141
+
142
+ enum ReviewState {
143
+ approved,
144
+ changes_requested,
145
+ commented,
146
+ }
147
+
148
+ model PrReviewedData {
149
+ /** The pull request. */
150
+ url: url;
151
+
152
+ reviewer: Actor;
153
+
154
+ /** True when an agent or a bot wrote the review, not a person. */
155
+ automated?: boolean;
156
+
157
+ state: ReviewState;
158
+ }
159
+
160
+ model PrClosedData {
161
+ /** The pull request. */
162
+ url: url;
163
+
164
+ /** True when the pull request was merged, false when it was closed without a merge. */
165
+ merged: boolean;
166
+
167
+ mergeCommit?: CommitHash;
168
+ }