Files
0pt/src/lineage/openlineage.ts
T
Simon AxelssonandClaude Fable 5 b7038d7675 feat(platform): canonical SIAX context/errors + real-contract clients, no prod mock fallback
- src/platform/: SiaxRequestContext + propagation headers + 12 canonical
  error codes (documented mirror of cl0ud packages/contract), SiaxError,
  resource refs (st0re:artifact:...), and the §3/§10 dependency-mode guard:
  production runtime + unconfigured dependency/store => hard
  DEPENDENCY_UNAVAILABLE at construction, never silent mock/in-memory.
- src/clients/: all four platform clients rewritten against the REAL wire
  contracts verified on sibling main branches this session:
  * cl0ud: POST /api/policy/evaluate ({data} envelope, allow+requiresApproval)
    - the old /v1/cl0ud/policies/evaluate path never existed on CL0UD
  * st0re: camelCase ArtifactInput on /v1/st0re/artifacts/register incl.
    X-Tenant-Id/X-Actor-Id + X-Idempotency-Key - the old snake_case body
    would have been a 400 against the live registry
  * n0d: required_role + resource_requirements + body idempotency_key +
    CloudEvents callback_url per n0d createJobSchema; adds getJob/getJobResult
  * aud0: /v1/aud0/openlineage is AUD0's only lineage ingest -
    /v1/aud0/lineage/events never existed; legacy shape converts to a
    spec-shaped OpenLineage RunEvent (deterministic runId dedup)
- src/lineage/: OpenLineage subset types + LineageEmitter (never-throw,
  §16 evidence semantics)
- shared SiaxHttp transport: timeouts, typed SiaxError mapping, context
  propagation, no raw upstream bodies in errors

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 16:35:01 +02:00

51 lines
1.9 KiB
TypeScript

/**
* src/lineage/openlineage.ts
* ===========================
* Minimal, spec-shaped OpenLineage types for 0pt's lineage emission
* (Master-DoD §10 "Lineage: emit OpenLineage-events till AUD0:s
* ingest-kontrakt", §16 "OpenLineage: Run/Job/Dataset ingest").
*
* This is a deliberate SUBSET of the OpenLineage 1.x spec
* (https://openlineage.io/spec/2-0-2/OpenLineage.json): the fields AUD0's
* `/v1/aud0/openlineage` ingest reads (eventType, eventTime, run.runId,
* job.namespace/name, inputs[], outputs[], facets passed through opaquely).
* Facets are open `Record<string, unknown>` — AUD0 stores them verbatim as
* evidence; custom SIAX facets are namespaced `siax*`.
*/
export type OpenLineageEventType = "START" | "RUNNING" | "COMPLETE" | "ABORT" | "FAIL" | "OTHER";
export interface OpenLineageDatasetRef {
/** Dataset namespace, e.g. "0pt" or a source system identifier. */
namespace: string;
/** Dataset name, e.g. "dataset/ds_x" or "opensearch/opt-search-companies". */
name: string;
facets?: Record<string, unknown>;
}
export interface OpenLineageRunEvent {
eventType: OpenLineageEventType;
/** ISO-8601 timestamp of the state transition. */
eventTime: string;
/** Producer URI identifying the emitting code base. */
producer: string;
/** Spec schema URL — optional; AUD0 does not require it. */
schemaURL?: string;
run: {
/** Stable run id — 0pt uses deterministic ids so re-emission dedups. */
runId: string;
facets?: Record<string, unknown>;
};
job: {
/** Job namespace — 0pt emits its app id ("0pt"). */
namespace: string;
/** Job name — the 0pt capability id, e.g. "0pt.dataset.version.v1". */
name: string;
facets?: Record<string, unknown>;
};
inputs?: OpenLineageDatasetRef[];
outputs?: OpenLineageDatasetRef[];
}
export const OPT_OPENLINEAGE_PRODUCER = "https://git.siax.io/sax3l/0pt";