From db114d4b7973a521dcf078195a8a05f1511064e9 Mon Sep 17 00:00:00 2001 From: aaltshuler Date: Wed, 18 Nov 2026 17:40:11 +0200 Subject: [PATCH 1/2] Align Orbit with OmniGraph server 0.15 --- .changeset/omnigraph-server-015.md | 5 ++++ .github/workflows/ci.yml | 16 +++++++----- apps/demo/e2e/omnigraph.spec.ts | 14 +++++----- apps/demo/src/omnigraphPanel.tsx | 8 +++--- fixtures/omnigraph/README.md | 25 +++++++++--------- fixtures/omnigraph/recorded/commits.json | 2 +- fixtures/omnigraph/recorded/health.json | 2 +- fixtures/omnigraph/recorded/manifest.json | 10 +++---- fixtures/omnigraph/recorded/search.json | 2 +- packages/omnigraph/README.md | 18 ++++++------- packages/omnigraph/src/loader.ts | 15 +++++------ packages/omnigraph/src/types.ts | 2 +- packages/omnigraph/test/codegen.test.ts | 2 +- packages/omnigraph/test/loader.test.ts | 26 ++++++++++++------- .../omnigraph/test/recorded-fixtures.test.ts | 4 +-- .../omnigraph/test/search-service.test.ts | 2 +- packages/omnigraph/test/server-entry.test.ts | 4 +-- pnpm-workspace.yaml | 2 +- scripts/omnigraph-fixture.mjs | 14 +++++----- 19 files changed, 93 insertions(+), 80 deletions(-) create mode 100644 .changeset/omnigraph-server-015.md diff --git a/.changeset/omnigraph-server-015.md b/.changeset/omnigraph-server-015.md new file mode 100644 index 0000000..1b797a3 --- /dev/null +++ b/.changeset/omnigraph-server-015.md @@ -0,0 +1,5 @@ +--- +'@modernrelay/orbit-omnigraph': patch +--- + +Support OmniGraph server 0.15.x alongside 0.14.x. The adapter uses TypeScript SDK 0.14.0 and verifies HTTP contract 0.14 for both server series. Live integration tests cover graph export and stored-query search against server 0.15.0. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c72661..3c3f849 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,20 +100,22 @@ jobs: node-version: 24 cache: pnpm - run: pnpm install --frozen-lockfile - - name: Install OmniGraph 0.14.0 + - name: Install recorded OmniGraph release shell: bash run: | - mkdir -p "$RUNNER_TEMP/omnigraph-0.14.0" - cd "$RUNNER_TEMP/omnigraph-0.14.0" - release_url=https://github.com/ModernRelay/omnigraph/releases/download/v0.14.0 + version=$(node -p "require('./fixtures/omnigraph/recorded/manifest.json').serverVersion") + bin_dir="$RUNNER_TEMP/omnigraph-$version" + mkdir -p "$bin_dir" + cd "$bin_dir" + release_url="https://github.com/ModernRelay/omnigraph/releases/download/v$version" curl --fail --location --retry 3 "$release_url/omnigraph-linux-x86_64.tar.gz" -o omnigraph-linux-x86_64.tar.gz curl --fail --location --retry 3 "$release_url/omnigraph-linux-x86_64.sha256" -o omnigraph-linux-x86_64.sha256 sha256sum --check omnigraph-linux-x86_64.sha256 tar -xzf omnigraph-linux-x86_64.tar.gz - "$RUNNER_TEMP/omnigraph-0.14.0/omnigraph" version + "$bin_dir/omnigraph" version { - echo "OMNIGRAPH_BIN=$RUNNER_TEMP/omnigraph-0.14.0/omnigraph" - echo "OMNIGRAPH_SERVER_BIN=$RUNNER_TEMP/omnigraph-0.14.0/omnigraph-server" + echo "OMNIGRAPH_BIN=$bin_dir/omnigraph" + echo "OMNIGRAPH_SERVER_BIN=$bin_dir/omnigraph-server" } >> "$GITHUB_ENV" - name: Install Playwright Chromium timeout-minutes: 15 diff --git a/apps/demo/e2e/omnigraph.spec.ts b/apps/demo/e2e/omnigraph.spec.ts index bffedee..edb5325 100644 --- a/apps/demo/e2e/omnigraph.spec.ts +++ b/apps/demo/e2e/omnigraph.spec.ts @@ -1,5 +1,5 @@ /** - * Live OmniGraph 0.14 integration. The fixture script creates a fresh local + * Live OmniGraph integration. The fixture script creates a fresh local * cluster, seeds it through HTTP, and owns its server until teardown. * Optional locally; OMNIGRAPH_LIVE_REQUIRED=1 makes missing binaries fail CI. */ @@ -22,10 +22,6 @@ const CLI = process.env.OMNIGRAPH_BIN || 'omnigraph'; const SERVER = process.env.OMNIGRAPH_SERVER_BIN || 'omnigraph-server'; const BASE = 'http://127.0.0.1:8199'; const REQUIRED = process.env.OMNIGRAPH_LIVE_REQUIRED === '1'; -const cliVersion = spawnSync(CLI, ['version'], { encoding: 'utf8' }); -const AVAILABLE = cliVersion.status === 0 && cliVersion.stdout.split('\n').includes('omnigraph 0.14.0') && - spawnSync(SERVER, ['--help'], { stdio: 'ignore' }).status === 0; -const SKIP_REASON = 'Set OMNIGRAPH_BIN and OMNIGRAPH_SERVER_BIN to the pinned 0.14.0 binaries; OMNIGRAPH_LIVE_REQUIRED=1 requires the live test.'; const READY_DOT = '[data-testid="status-dot"][title="ready"]'; const NODE_COUNT = '[data-testid="node-count"]'; const EDGE_COUNT = '[data-testid="edge-count"]'; @@ -33,11 +29,17 @@ const TYPE_LABEL = /^(Actor|Decision|Trace|Signal|Artifact) · .+/; const fmt = (n: number): string => n.toLocaleString('en-US'); interface RecordedManifest { + serverVersion: string; graphId: string; branch: string; rowCounts: Record; } const manifest = JSON.parse(readFileSync(path.join(ROOT, 'fixtures/omnigraph/recorded/manifest.json'), 'utf8')) as RecordedManifest; +const cliVersion = spawnSync(CLI, ['version'], { encoding: 'utf8' }); +const AVAILABLE = cliVersion.status === 0 && cliVersion.stdout.split(/\r?\n/).includes(`omnigraph ${manifest.serverVersion}`) && + spawnSync(SERVER, ['--help'], { stdio: 'ignore' }).status === 0; +const SKIP_REASON = `Set OMNIGRAPH_BIN and OMNIGRAPH_SERVER_BIN to the pinned ${manifest.serverVersion} binaries. OMNIGRAPH_LIVE_REQUIRED=1 requires the live test.`; + function tableTotal(m: RecordedManifest, prefix: 'node:' | 'edge:'): number { return Object.entries(m.rowCounts).filter(([key]) => key.startsWith(prefix)).reduce((sum, [, count]) => sum + count, 0); } @@ -82,7 +84,7 @@ test('live export and stored search share system identity while retaining user i const instance = createGraphInstance({ engine: () => new FakeEngine(), services: { search } }); try { const loaded = await createOmnigraphSource({ client, graphId: 'demo' }).load(instance); - expect(loaded.serverVersion).toBe('0.14.0'); + expect(loaded.serverVersion).toBe(manifest.serverVersion); expect(loaded.counts).toMatchObject({ nodes: 300, edges: 500 }); expect(loaded.warnings).toEqual([]); const id = encodeSourceId('Signal', 'signal-001'); diff --git a/apps/demo/src/omnigraphPanel.tsx b/apps/demo/src/omnigraphPanel.tsx index aa8026d..20599c4 100644 --- a/apps/demo/src/omnigraphPanel.tsx +++ b/apps/demo/src/omnigraphPanel.tsx @@ -338,12 +338,12 @@ export function OmnigraphPanel({ form, onFormChange, meter, result, error, onLoa {error} {CONNECTION_ERROR.test(error) && (
- graph server unreachable — start a fresh local 0.14 fixture:{' '} + Start the local OmniGraph fixture with{' '} node scripts/omnigraph-fixture.mjs --serve - {' '} - (set OMNIGRAPH_BIN and{' '} - OMNIGRAPH_SERVER_BIN to the 0.14.0 binaries) + . If the fixture binaries are outside PATH, set{' '} + OMNIGRAPH_BIN and{' '} + OMNIGRAPH_SERVER_BIN to their paths.
)} diff --git a/fixtures/omnigraph/README.md b/fixtures/omnigraph/README.md index ed36fa1..79c2b68 100644 --- a/fixtures/omnigraph/README.md +++ b/fixtures/omnigraph/README.md @@ -1,9 +1,9 @@ -# OmniGraph 0.14 integration fixtures +# OmniGraph 0.15 integration fixtures -These are verbatim HTTP bodies recorded from the official **OmniGraph 0.14.0** -server. Adapter tests replay them through the real TypeScript SDK. The live -integration tests also start a fresh local server and exercise both the adapter -and the demo's same-origin `/og` proxy. +These are verbatim HTTP bodies recorded from the official **OmniGraph 0.15.0** +server using HTTP contract **0.14**. Adapter tests replay them through TypeScript +SDK **0.14.0**. Live integration tests start a fresh local server and exercise +both the adapter and the demo's same-origin `/og` proxy. ## Contents @@ -49,15 +49,14 @@ and the demo's same-origin `/og` proxy. ## Regenerate or serve locally -Install the official 0.14.0 CLI and server in a separate directory. Release -archives and their SHA256 files are available in the -[0.14.0 release](https://github.com/ModernRelay/omnigraph/releases/tag/v0.14.0). -The script checks the exact CLI and running server versions and fails if they -are missing or incompatible. +Use the official 0.15.0 CLI and server. The fixture script checks both versions. +Download the archive and SHA256 checksum for your platform from the +[OmniGraph 0.15.0 release](https://github.com/ModernRelay/omnigraph/releases/tag/v0.15.0). ```sh -export OMNIGRAPH_BIN=/path/to/omnigraph-0.14.0/omnigraph -export OMNIGRAPH_SERVER_BIN=/path/to/omnigraph-0.14.0/omnigraph-server +# Optional if both binaries are already on PATH. +export OMNIGRAPH_BIN=/path/to/omnigraph-0.15.0/omnigraph +export OMNIGRAPH_SERVER_BIN=/path/to/omnigraph-0.15.0/omnigraph-server # Regenerate seed + recordings, then stop and remove the temporary cluster. node scripts/omnigraph-fixture.mjs @@ -97,6 +96,6 @@ OMNIGRAPH_LIVE_REQUIRED=1 pnpm --filter orbit-demo exec playwright test e2e/omni The spec owns fixture startup and teardown. It checks real export/search identity, ordinary `id` data, nullable/date normalization, and browser loading through the -demo proxy. The dedicated CI job downloads the checksum-verified 0.14.0 Linux +demo proxy. The dedicated CI job downloads the checksum-verified 0.15.0 Linux release and requires both live tests; missing binaries fail that job. Other local/demo runs may skip this spec when the pinned binaries are unavailable. diff --git a/fixtures/omnigraph/recorded/commits.json b/fixtures/omnigraph/recorded/commits.json index 7360ee0..0436304 100644 --- a/fixtures/omnigraph/recorded/commits.json +++ b/fixtures/omnigraph/recorded/commits.json @@ -1 +1 @@ -{"commits":[{"graph_commit_id":"hb1.01M5MP45JC4C435R73CJ95BR6H.1.01M5MP45JC4C435R73CJ95BR6H","graph_branch":null,"graph_manifest_version":2,"parent_commit_id":"01M5MP450DGNQ3MJB1CKF0R5P9","merged_parent_commit_id":null,"actor_id":null,"created_at":1792769398348219,"published":true,"kind":"published","root_commit_id":null}],"head_commit_id":"hb1.01M5MP45JC4C435R73CJ95BR6H.1.01M5MP45JC4C435R73CJ95BR6H","next_page_token":"eyJ2ZXJzaW9uIjoxLCJraW5kIjoiY29tbWl0LWxpc3QtcGFnZSIsImdyYXBoX2lkZW50aXR5IjoiTXktYXY3bkR5R1QteUJZZkdjODM0UFJCQ3hoYUN4OVZacUpvMjM0SkRRZyIsImJyYW5jaCI6IkVwRTZqTFRUYzE0QURucFFhNWF5VW5DUHFjQkhmUTJRaXA0MEo4YzkxRGMiLCJoZWFkX2NvbW1pdF9pZCI6ImhiMS4wMU01TVA0NUpDNEM0MzVSNzNDSjk1QlI2SC4xLjAxTTVNUDQ1SkM0QzQzNVI3M0NKOTVCUjZIIiwibmV4dF9jb21taXRfaWQiOiIwMU01TVA0NTBER05RM01KQjFDS0YwUjVQOSIsImJlbG93X2dlbmVyYXRpb24iOjF9uBwd4HcVMUrEfXHXHtosNyZ4Er09hVCp9W-0WliBxjA"} \ No newline at end of file +{"commits":[{"graph_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91","graph_branch":null,"graph_manifest_version":2,"parent_commit_id":"01M7QMWQ3Y5ZB754D85KSM4ZFB","merged_parent_commit_id":null,"actor_id":null,"created_at":1795016253886076,"published":true,"kind":"published","root_commit_id":null}],"head_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91","next_page_token":"eyJ2ZXJzaW9uIjoxLCJraW5kIjoiY29tbWl0LWxpc3QtcGFnZSIsImdyYXBoX2lkZW50aXR5IjoiTS1lQngyWHRtNFdwdVFZQXE4M3oxMnFKNU1KamlRQ01LNzVGQzVwRGRtWSIsImJyYW5jaCI6IkVwRTZqTFRUYzE0QURucFFhNWF5VW5DUHFjQkhmUTJRaXA0MEo4YzkxRGMiLCJoZWFkX2NvbW1pdF9pZCI6ImhiMS4wMU03UU1XUkRZQzNaN0hLUUVWR001WUc5MS4xLjAxTTdRTVdSRFlDM1o3SEtRRVZHTTVZRzkxIiwibmV4dF9jb21taXRfaWQiOiIwMU03UU1XUTNZNVpCNzU0RDg1S1NNNFpGQiIsImJlbG93X2dlbmVyYXRpb24iOjF9DzQe5ifShEvAQkWBs7Eqms0Bdy2i1Jf9JphM0FMgHuw"} \ No newline at end of file diff --git a/fixtures/omnigraph/recorded/health.json b/fixtures/omnigraph/recorded/health.json index 196c1d8..b13b4c8 100644 --- a/fixtures/omnigraph/recorded/health.json +++ b/fixtures/omnigraph/recorded/health.json @@ -1 +1 @@ -{"status":"ok","version":"0.14.0","internal_schema_version":16,"source_version":"60bfd19db780fdff3a5178f959c1204143420114"} \ No newline at end of file +{"status":"ok","version":"0.15.0","internal_schema_version":16,"source_version":"373834b4c1c4b29cf0ddd64bee9565f98c60cc26"} \ No newline at end of file diff --git a/fixtures/omnigraph/recorded/manifest.json b/fixtures/omnigraph/recorded/manifest.json index 20318f2..f6186f7 100644 --- a/fixtures/omnigraph/recorded/manifest.json +++ b/fixtures/omnigraph/recorded/manifest.json @@ -1,11 +1,11 @@ { - "recordedAt": "2026-10-23T15:29:58.465Z", - "serverVersion": "0.14.0", + "recordedAt": "2026-11-18T15:37:34.105Z", + "serverVersion": "0.15.0", "httpApiContract": "0.14", "graphId": "demo", "branch": "main", - "headBefore": "hb1.01M5MP45JC4C435R73CJ95BR6H.1.01M5MP45JC4C435R73CJ95BR6H", - "headAfter": "hb1.01M5MP45JC4C435R73CJ95BR6H.1.01M5MP45JC4C435R73CJ95BR6H", + "headBefore": "hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91", + "headAfter": "hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91", "rowCounts": { "edge:Correlates": 50, "edge:OwnedBy": 60, @@ -21,5 +21,5 @@ }, "exportLineCount": 800, "edgeLinesBeforeNodeLines": true, - "notes": "Verbatim OmniGraph 0.14.0 HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording." + "notes": "Verbatim OmniGraph 0.15.0 HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording." } diff --git a/fixtures/omnigraph/recorded/search.json b/fixtures/omnigraph/recorded/search.json index 63bb59c..ba2e246 100644 --- a/fixtures/omnigraph/recorded/search.json +++ b/fixtures/omnigraph/recorded/search.json @@ -1 +1 @@ -{"query_name":"search_signals","target":{"branch":"main","snapshot":null},"row_count":1,"columns":["s","s.title"],"rows":[{"s":{"@id":"signal-001","body":"Market movement around wire encodings.","category":"customer","id":1,"observed_at":"2017-06-09","slug":"signal-001","strength":0.0,"title":"Signal 1: search admission"},"s.title":"Signal 1: search admission"}],"graph_commit_id":"hb1.01M5MP45JC4C435R73CJ95BR6H.1.01M5MP45JC4C435R73CJ95BR6H"} \ No newline at end of file +{"query_name":"search_signals","target":{"branch":"main","snapshot":null},"row_count":1,"columns":["s","s.title"],"rows":[{"s":{"@id":"signal-001","body":"Market movement around wire encodings.","category":"customer","id":1,"observed_at":"2017-06-09","slug":"signal-001","strength":0.0,"title":"Signal 1: search admission"},"s.title":"Signal 1: search admission"}],"graph_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91"} \ No newline at end of file diff --git a/packages/omnigraph/README.md b/packages/omnigraph/README.md index 185c27d..4e2954f 100644 --- a/packages/omnigraph/README.md +++ b/packages/omnigraph/README.md @@ -1,12 +1,11 @@ # @modernrelay/orbit-omnigraph -Optional Omnigraph data-source adapter for Orbit. Framework-agnostic: -depends only on the framework-free ingestion/error surface of `@modernrelay/orbit-core` -and the official TypeScript SDK `@modernrelay/omnigraph` (0.14.0) — never on React, and -core never depends on it. +This optional adapter connects Orbit's framework-independent ingestion API to +OmniGraph through the official TypeScript SDK, `@modernrelay/omnigraph`. -Requires Node.js 22+ for server/CLI use and the OmniGraph HTTP API contract `0.14`. -Upgrade the server and SDK together: 0.13 servers are rejected before graph reads. +Server and CLI use requires Node.js 22+. Orbit tests the TypeScript SDK 0.14.0 +against OmniGraph server 0.15.0. Both the 0.14 and 0.15 server series use HTTP +contract `0.14`. The SDK checks that contract before reading graph data. ## The v1 rule @@ -59,7 +58,7 @@ graph. Ids are namespaced through the codec, and export values are normalized as described below. Byte progress and budgets use re-serialized UTF-8 NDJSON size, including one line break per export row. -OmniGraph 0.14 exports physical identity at the top level: +The export carries physical identity in the top-level `id` field. ```json {"type":"Signal","id":"signal-001","data":{"id":42,"title":"Latency spike"}} @@ -195,8 +194,9 @@ surface — failures rethrow as plain `Error`s with a stable `omnigraph:` messag Cancellation (`AbortSignal`) surfaces as an `AbortError`; the session is aborted and the graph left untouched. This includes cancellation during contract discovery and stored read-query invocation. Missing or mismatched HTTP contract headers fail closed -before ingestion can commit. A build-version `major.minor` mismatch (`og.health()` -vs the SDK's pinned `SERVER_VERSION`) warns only when the HTTP contract checks pass. +before ingestion can commit. If a server passes the HTTP contract check but reports +a build outside the supported 0.14 and 0.15 series, the adapter includes a version +warning in the load result. ## Also in the box diff --git a/packages/omnigraph/src/loader.ts b/packages/omnigraph/src/loader.ts index 176dccf..142f1c0 100644 --- a/packages/omnigraph/src/loader.ts +++ b/packages/omnigraph/src/loader.ts @@ -37,7 +37,7 @@ * message prefix. */ -import { OmnigraphError, SERVER_VERSION } from '@modernrelay/omnigraph'; +import { OmnigraphError } from '@modernrelay/omnigraph'; import type { CallOptions, ExportInput, Omnigraph } from '@modernrelay/omnigraph'; import { OrbitOperationError } from '@modernrelay/orbit-core'; import type { GraphEdge, GraphNode, IngestBatch, IngestSession } from '@modernrelay/orbit-core'; @@ -53,6 +53,8 @@ import type { } from './types'; const DEFAULT_BATCH_SIZE = 2000; +/** Server release series verified with this adapter. Both speak HTTP 0.14. */ +const SUPPORTED_SERVER_SERIES = ['0.14', '0.15']; /** * Finite whole-export cap for the necessarily atomic replace session. A @@ -509,8 +511,7 @@ export function createOmnigraphSource(options: OmnigraphSourceOptions): Omnigrap async function load(target: IngestTarget, signal?: AbortSignal): Promise { const warnings: string[] = []; - // Surface build-version skew as a warning after the SDK verifies the - // HTTP API contract. Contract mismatches are hard failures. + // The SDK enforces the HTTP contract independently of the server build. let serverVersion: string; try { serverVersion = (await client.health(callOpts(signal))).version; @@ -518,12 +519,10 @@ export function createOmnigraphSource(options: OmnigraphSourceOptions): Omnigrap throw mapError(err, signal); } const server = majorMinor(serverVersion); - const sdk = majorMinor(SERVER_VERSION); - if (server === null || server !== sdk) { + if (server === null || !SUPPORTED_SERVER_SERIES.includes(server)) { warnings.push( - `omnigraph: server version ${serverVersion} does not match the SDK-pinned server ` + - `version ${SERVER_VERSION} (major.minor differ) — SDK behavior is undefined ` + - `against this server`, + `omnigraph: server version ${serverVersion} is outside the adapter's tested release series ` + + `(${SUPPORTED_SERVER_SERIES.join(', ')})`, ); } diff --git a/packages/omnigraph/src/types.ts b/packages/omnigraph/src/types.ts index 46c5b45..0863653 100644 --- a/packages/omnigraph/src/types.ts +++ b/packages/omnigraph/src/types.ts @@ -117,7 +117,7 @@ export interface OmnigraphLoadResult { /** `og.health().version` — the server build the load ran against. */ serverVersion: string; /** - * Non-fatal observations: SDK/server major.minor mismatch, accepted + * Non-fatal observations: untested server release series, accepted * drift, big-int key attribute precision hazards, and skipped unknown * lines. Never hides a retry or accepted-drift decision. HTTP API contract * mismatches are fatal errors, not warnings. diff --git a/packages/omnigraph/test/codegen.test.ts b/packages/omnigraph/test/codegen.test.ts index d54842d..2485831 100644 --- a/packages/omnigraph/test/codegen.test.ts +++ b/packages/omnigraph/test/codegen.test.ts @@ -250,7 +250,7 @@ describe('demo.pg fixture — committed golden file', () => { }); describe('generateTypes — mapping edge cases', () => { - it('compiles normalized 0.14 attrs with user ids, nullable list elements, and property-free edges', () => { + it('compiles normalized attrs with user ids, nullable list elements, and property-free edges', () => { const source = 'node Datum { id: I64? times: [DateTime]? } edge Link: Datum -> Datum'; const schema = parsePgSchema(source); const attrs = normalizeNode({ diff --git a/packages/omnigraph/test/loader.test.ts b/packages/omnigraph/test/loader.test.ts index 3e1fc62..123c8ba 100644 --- a/packages/omnigraph/test/loader.test.ts +++ b/packages/omnigraph/test/loader.test.ts @@ -776,8 +776,8 @@ describe('cancellation and error surface', () => { }); }); -describe('server and SDK version mismatch surfacing', () => { - it.each([null, '0.12', '0.13'])('rejects a missing or incompatible discovery contract (%s) before export', async (contract) => { +describe('server release and HTTP contract compatibility', () => { + it.each([null, '0.12', '0.13', '0.15'])('rejects a missing or incompatible discovery contract (%s) before export', async (contract) => { const { instance, source, calls } = harness(recordedRoutes({ 'HEAD /healthz': () => new Response(null, { headers: contract === null ? {} : { [HTTP_API_CONTRACT_HEADER]: contract }, @@ -815,28 +815,34 @@ describe('server and SDK version mismatch surfacing', () => { expect(instance.store.getState().revisions.model).toBe(0); }); - it('the recorded fixture server and the SDK pin share major.minor — no warning', async () => { - // The fixture is regenerated with the same server generation the SDK - // pins (currently 0.14.x) — a mismatch here means the pin and the - // fixture drifted apart and one of them needs regenerating/bumping. + it('loads the recorded 0.15.0 server without a version warning', async () => { const { instance, source } = harness(recordedRoutes()); const result = await source.load(instance); + expect(result.serverVersion).toBe('0.15.0'); + expect(result.warnings).toEqual([]); + }); + + it('continues to support the 0.14 server series', async () => { + const { instance, source } = harness(recordedRoutes({ + 'GET /healthz': json(JSON.stringify({ status: 'ok', version: '0.14.0', internal_schema_version: 16 })), + })); + const result = await source.load(instance); expect(result.warnings).toEqual([]); }); - it('different build metadata warns when the HTTP contract still matches', async () => { + it('warns for an untested server series when the HTTP contract still matches', async () => { const { instance, source } = harness( recordedRoutes({ 'GET /healthz': json( - JSON.stringify({ status: 'ok', version: '0.15.0', internal_schema_version: 16 }), + JSON.stringify({ status: 'ok', version: '0.16.0', internal_schema_version: 16 }), ), }), ); const result = await source.load(instance); - expect(result.serverVersion).toBe('0.15.0'); - expect(result.warnings.some((w) => w.includes('0.15.0') && w.includes('0.14.0'))).toBe(true); + expect(result.serverVersion).toBe('0.16.0'); + expect(result.warnings).toEqual([expect.stringContaining('server version 0.16.0')]); expect(instance.store.getState().nodeCount).toBe(NODE_TOTAL); // load still succeeded }); }); diff --git a/packages/omnigraph/test/recorded-fixtures.test.ts b/packages/omnigraph/test/recorded-fixtures.test.ts index 0802b43..34ce67f 100644 --- a/packages/omnigraph/test/recorded-fixtures.test.ts +++ b/packages/omnigraph/test/recorded-fixtures.test.ts @@ -16,14 +16,14 @@ describe('recorded Omnigraph wire fixtures', () => { expect(recorded).toEqual({ schema_source: demoPg, system_columns: { id: '__id', src: '__src', dst: '__dst' }, - // 0.14 exposes the virtual engine catalogue separately. It must not + // The HTTP 0.14 contract exposes the virtual engine catalogue separately. It must not // be merged into the user graph schema consumed by Orbit's parser. catalogue_source: expect.stringContaining('node @Engine'), }); expect(schemaBody).toBe(JSON.stringify(recorded)); }); - it('preserves physical identity and numeric user ids from actual 0.14 exports', () => { + it('preserves physical identity and numeric user ids from the 0.15.0 export', () => { const records = exportBody.trim().split('\n').map((line) => JSON.parse(line) as ExportRecord); for (const record of records) { expect(typeof record.id).toBe('string'); diff --git a/packages/omnigraph/test/search-service.test.ts b/packages/omnigraph/test/search-service.test.ts index 6633034..b71e298 100644 --- a/packages/omnigraph/test/search-service.test.ts +++ b/packages/omnigraph/test/search-service.test.ts @@ -201,7 +201,7 @@ describe('createOmnigraphSearchService — invocation', () => { // --------------------------------------------------------------------------- describe('row mapping', () => { - it('maps the actual 0.14 stored-query recording through the real SDK', async () => { + it('maps the recorded 0.15.0 stored query through the real SDK', async () => { const { service } = harness({ 'POST /graphs/demo/queries/search_signals': json(searchBody), }, { queryName: 'search_signals', params: (q) => ({ q }) }); diff --git a/packages/omnigraph/test/server-entry.test.ts b/packages/omnigraph/test/server-entry.test.ts index 3fc9f15..3790f37 100644 --- a/packages/omnigraph/test/server-entry.test.ts +++ b/packages/omnigraph/test/server-entry.test.ts @@ -28,7 +28,7 @@ describe('createOmnigraphServerClient in the server-only entry', () => { return new Response( method === 'HEAD' ? null : JSON.stringify(url.endsWith('/schema') ? { schema_source: 'node Actor { slug: String @key }' } - : { status: 'ok', version: '0.14.0', internal_schema_version: 16 }), + : { status: 'ok', version: '0.15.0', internal_schema_version: 16 }), { status: 200, headers: { 'content-type': 'application/json', [HTTP_API_CONTRACT_HEADER]: HTTP_API_CONTRACT } }, ); }; @@ -41,7 +41,7 @@ describe('createOmnigraphServerClient in the server-only entry', () => { expect(client).toBeInstanceOf(Omnigraph); const health = await client.health(); - expect(health.version).toBe('0.14.0'); + expect(health.version).toBe('0.15.0'); await client.graph('demo').schema.get(); expect(seen).toEqual([ { url: 'http://og.internal:8080/healthz', method: 'GET', auth: null, contract: '0.14' }, diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9db45c0..5821026 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,7 +2,7 @@ packages: - packages/* - apps/* -# Explicitly requested SDK release, verified against the matching 0.14 server. +# The adapter uses the 0.14.0 SDK for OmniGraph HTTP contract 0.14. minimumReleaseAgeExclude: - '@modernrelay/omnigraph@0.14.0' diff --git a/scripts/omnigraph-fixture.mjs b/scripts/omnigraph-fixture.mjs index d47f81a..43a0846 100644 --- a/scripts/omnigraph-fixture.mjs +++ b/scripts/omnigraph-fixture.mjs @@ -1,11 +1,11 @@ #!/usr/bin/env node /** - * Regenerate genuine OmniGraph 0.14 HTTP recordings from a fresh temporary + * Regenerate genuine OmniGraph HTTP contract 0.14 recordings from a fresh temporary * cluster. Existing stores are never opened or deleted. Use --serve to keep * the seeded fixture running for the demo/live tests without rewriting files. * * OMNIGRAPH_BIN and OMNIGRAPH_SERVER_BIN select separately installed binaries; - * the CLI and server must both be exactly 0.14.0. No global installation or + * the CLI and server must both be exactly 0.15.0. No global installation or * production service is changed. See fixtures/omnigraph/README.md. */ import { spawn, spawnSync } from 'node:child_process'; @@ -21,7 +21,7 @@ const FIXTURE_DIR = path.join(ROOT, 'fixtures', 'omnigraph'); const RECORDED_DIR = path.join(FIXTURE_DIR, 'recorded'); const CLI = process.env.OMNIGRAPH_BIN || 'omnigraph'; const SERVER = process.env.OMNIGRAPH_SERVER_BIN || 'omnigraph-server'; -const VERSION = '0.14.0'; +const VERSION = '0.15.0'; const CONTRACT = '0.14'; const HEADER = 'Omnigraph-Http-Api'; const GRAPH_ID = 'demo'; @@ -249,7 +249,7 @@ async function main() { } run(SERVER, ['--help']); await requireFreePort(); - const cluster = mkdtempSync(path.join(tmpdir(), 'orbit-omnigraph-014-')); + const cluster = mkdtempSync(path.join(tmpdir(), 'orbit-omnigraph-')); const shutdown = new AbortController(); const stop = () => shutdown.abort(); process.once('SIGINT', stop); @@ -258,7 +258,7 @@ async function main() { let serverClosed; let serverLog = ''; try { - // Isolate the final 0.14 target configuration from any operator defaults or + // Isolate the fixture target configuration from any operator defaults or // credentials on the host. Loopback access is explicitly anonymous. const operatorHome = path.join(cluster, 'operator'); mkdirSync(operatorHome); @@ -334,7 +334,7 @@ async function main() { headBefore: newestCommitId(commits.body), headAfter: newestCommitId(after.body), rowCounts: Object.fromEntries(JSON.parse(snapshot.body).datasets.map((table) => [`${table.entity_kind}:${table.type_name}`, table.entity_count])), exportLineCount: lines.length, edgeLinesBeforeNodeLines: true, - notes: 'Verbatim OmniGraph 0.14.0 HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording.', + notes: `Verbatim OmniGraph ${VERSION} HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording.`, }; mkdirSync(RECORDED_DIR, { recursive: true }); const recordings = { @@ -350,7 +350,7 @@ async function main() { console.log(`Recorded ${file} (${Buffer.byteLength(body)} bytes)`); } writeFileSync(path.join(FIXTURE_DIR, 'seed.ndjson'), seed); - console.log('OK: OmniGraph 0.14 fixtures regenerated'); + console.log(`OK: OmniGraph ${VERSION} fixtures regenerated (HTTP contract ${CONTRACT})`); } finally { process.removeListener('SIGINT', stop); process.removeListener('SIGTERM', stop); From ae49281e6fc8d9c8a1daab8433e2d824d7580c50 Mon Sep 17 00:00:00 2001 From: aaltshuler Date: Sat, 28 Nov 2026 15:50:46 +0200 Subject: [PATCH 2/2] Qualify Orbit export and search with OmniGraph SDK 0.17.1 --- .changeset/omnigraph-sdk-0171.md | 5 ++ .changeset/omnigraph-server-015.md | 5 -- apps/demo/e2e/omnigraph.spec.ts | 27 ++++++++- apps/demo/package.json | 2 +- apps/demo/playwright.config.ts | 12 +++- apps/demo/src/omnigraphPanel.tsx | 11 ++-- fixtures/omnigraph/README.md | 48 ++++++++++----- fixtures/omnigraph/cluster/cluster.yaml | 10 +++- fixtures/omnigraph/cluster/graph.policy.yaml | 13 +++++ fixtures/omnigraph/recorded/commits.json | 2 +- fixtures/omnigraph/recorded/health.json | 2 +- fixtures/omnigraph/recorded/manifest.json | 10 ++-- fixtures/omnigraph/recorded/search.json | 2 +- fixtures/omnigraph/recorded/snapshot.json | 2 +- packages/omnigraph/README.md | 27 +++++++-- packages/omnigraph/package.json | 2 +- packages/omnigraph/src/loader.ts | 17 ++---- packages/omnigraph/src/types.ts | 2 +- packages/omnigraph/test/loader.test.ts | 18 +++--- .../omnigraph/test/recorded-fixtures.test.ts | 2 +- .../omnigraph/test/search-service.test.ts | 2 +- packages/omnigraph/test/server-entry.test.ts | 4 +- pnpm-lock.yaml | 14 ++--- pnpm-workspace.yaml | 4 +- scripts/omnigraph-fixture.mjs | 58 ++++++++++++------- 25 files changed, 199 insertions(+), 102 deletions(-) create mode 100644 .changeset/omnigraph-sdk-0171.md delete mode 100644 .changeset/omnigraph-server-015.md create mode 100644 fixtures/omnigraph/cluster/graph.policy.yaml diff --git a/.changeset/omnigraph-sdk-0171.md b/.changeset/omnigraph-sdk-0171.md new file mode 100644 index 0000000..276a530 --- /dev/null +++ b/.changeset/omnigraph-sdk-0171.md @@ -0,0 +1,5 @@ +--- +'@modernrelay/orbit-omnigraph': patch +--- + +Upgrade the OmniGraph SDK to 0.17.1 and qualify export and stored-query search against server 0.17.1, retaining HTTP contract 0.14. Regenerate wire fixtures from the released server and exercise authenticated graph policy and the browser proxy in the live integration gate. Separate adapter export/search checks preserve warning-free loading on exact server releases 0.14.0 and 0.15.0 with the new SDK. Other server releases produce a warning rather than a version-only rejection. diff --git a/.changeset/omnigraph-server-015.md b/.changeset/omnigraph-server-015.md deleted file mode 100644 index 1b797a3..0000000 --- a/.changeset/omnigraph-server-015.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@modernrelay/orbit-omnigraph': patch ---- - -Support OmniGraph server 0.15.x alongside 0.14.x. The adapter uses TypeScript SDK 0.14.0 and verifies HTTP contract 0.14 for both server series. Live integration tests cover graph export and stored-query search against server 0.15.0. diff --git a/apps/demo/e2e/omnigraph.spec.ts b/apps/demo/e2e/omnigraph.spec.ts index edb5325..383a414 100644 --- a/apps/demo/e2e/omnigraph.spec.ts +++ b/apps/demo/e2e/omnigraph.spec.ts @@ -10,10 +10,10 @@ import { readFileSync } from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -import { Omnigraph } from '@modernrelay/omnigraph'; import { createGraphInstance } from '@modernrelay/orbit-core'; import { FakeEngine } from '@modernrelay/orbit-core/testing'; import { createOmnigraphSearchService, createOmnigraphSource, encodeSourceId } from '@modernrelay/orbit-omnigraph'; +import { createOmnigraphServerClient } from '@modernrelay/orbit-omnigraph/server'; import { expect, test } from '@playwright/test'; import type { Page } from '@playwright/test'; @@ -22,6 +22,7 @@ const CLI = process.env.OMNIGRAPH_BIN || 'omnigraph'; const SERVER = process.env.OMNIGRAPH_SERVER_BIN || 'omnigraph-server'; const BASE = 'http://127.0.0.1:8199'; const REQUIRED = process.env.OMNIGRAPH_LIVE_REQUIRED === '1'; +const TOKEN = process.env.OMNIGRAPH_FIXTURE_TOKEN; const READY_DOT = '[data-testid="status-dot"][title="ready"]'; const NODE_COUNT = '[data-testid="node-count"]'; const EDGE_COUNT = '[data-testid="edge-count"]'; @@ -52,6 +53,7 @@ test.skip(!AVAILABLE && !REQUIRED, SKIP_REASON); test.beforeAll(async () => { test.setTimeout(60_000); if (!AVAILABLE) throw new Error(SKIP_REASON); + if (!TOKEN) throw new Error('Playwright config must provide the fixture reader token'); fixture = spawn(process.execPath, [path.join(ROOT, 'scripts/omnigraph-fixture.mjs'), '--serve'], { cwd: ROOT, env: { ...process.env, OMNIGRAPH_FIXTURE_PORT: '8199' }, stdio: ['ignore', 'pipe', 'pipe'], }); @@ -76,7 +78,8 @@ test.afterAll(async () => { }); test('live export and stored search share system identity while retaining user id data', async () => { - const client = new Omnigraph({ baseUrl: BASE }); + if (!TOKEN) throw new Error('Missing fixture token'); + const client = createOmnigraphServerClient({ baseUrl: BASE, token: TOKEN }); const search = createOmnigraphSearchService({ client, graphId: 'demo', queryName: 'search_signals', typeOf: { s: 'Signal' }, labelColumn: 's.title', params: (q) => ({ q }), @@ -99,6 +102,18 @@ test('live export and stored search share system identity while retaining user i } finally { instance.destroy(); } }); +test('live graph reads require credentials and an applied graph policy', async () => { + const anonymous = await fetch(`${BASE}/graphs/demo/schema`, { + headers: { 'Omnigraph-Http-Api': '0.14' }, + }); + expect(anonymous.status).toBe(401); + const denied = await fetch(`${BASE}/graphs/ungranted/schema`, { + headers: { 'Omnigraph-Http-Api': '0.14', Authorization: `Bearer ${TOKEN}` }, + }); + expect(denied.status).toBe(403); + expect(await denied.json()).toMatchObject({ code: 'forbidden', disposition: { effects: 'none' } }); +}); + /** Sweep a grid around the viewport center until the status bar shows an * omnigraph hover label (hit-testing exact node centers under a live force * layout is flaky — same hunt strategy as the ingestion spec's right-click). */ @@ -124,6 +139,12 @@ test('load from omnigraph → meter completes → counts match manifest → type }, testInfo) => { const nodeTotal = tableTotal(manifest, 'node:'); const edgeTotal = tableTotal(manifest, 'edge:'); + const browserGraphAuth: Array = []; + page.on('request', (request) => { + if (new URL(request.url()).pathname.startsWith('/og/graphs/')) { + browserGraphAuth.push(request.headers().authorization); + } + }); await page.goto('/'); await page.waitForSelector(READY_DOT, { timeout: 60_000 }); @@ -155,6 +176,8 @@ test('load from omnigraph → meter completes → counts match manifest → type await expect(page.getByTestId('og-count-summary')).toHaveText( `${fmt(nodeTotal)} nodes · ${fmt(edgeTotal)} edges`, ); + expect(browserGraphAuth.length).toBeGreaterThan(0); + expect(browserGraphAuth.every((auth) => auth === undefined)).toBe(true); // --- hover a node: the status bar shows a type-derived label --- await page.waitForSelector(READY_DOT, { timeout: 30_000 }); diff --git a/apps/demo/package.json b/apps/demo/package.json index 90d84d3..6380a0d 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -12,7 +12,7 @@ "e2e": "playwright test" }, "dependencies": { - "@modernrelay/omnigraph": "0.14.0", + "@modernrelay/omnigraph": "0.17.1", "@modernrelay/orbit-core": "workspace:*", "@modernrelay/orbit-data": "workspace:*", "@modernrelay/orbit-omnigraph": "workspace:*", diff --git a/apps/demo/playwright.config.ts b/apps/demo/playwright.config.ts index 36880ba..8bf4d45 100644 --- a/apps/demo/playwright.config.ts +++ b/apps/demo/playwright.config.ts @@ -1,5 +1,10 @@ +import { randomUUID } from 'node:crypto'; + import { defineConfig } from '@playwright/test'; +// Shared by the fixture owner, worker and server-side proxy; never browser code. +const fixtureToken = process.env.OMNIGRAPH_FIXTURE_TOKEN ??= randomUUID(); + /** * Selection-workbench interaction smoke suite. * @@ -38,10 +43,11 @@ export default defineConfig({ }, webServer: { command: 'pnpm exec vite --host 127.0.0.1 --port 5199 --strictPort', + env: { OMNIGRAPH_PROXY_TOKEN: fixtureToken, OMNIGRAPH_PROXY_TARGET: 'http://127.0.0.1:8199' }, url: 'http://127.0.0.1:5199', - // CI must always exercise this checkout, never an unrelated process that - // happened to bind the demo port first. - reuseExistingServer: !process.env.CI, + // Own the proxy as well as the fixture: an existing dev server may hold a + // different token, even during optional local OmniGraph tests. + reuseExistingServer: false, timeout: 30_000, }, }); diff --git a/apps/demo/src/omnigraphPanel.tsx b/apps/demo/src/omnigraphPanel.tsx index 20599c4..97baa4a 100644 --- a/apps/demo/src/omnigraphPanel.tsx +++ b/apps/demo/src/omnigraphPanel.tsx @@ -7,8 +7,8 @@ * proxy forwards them to `http://127.0.0.1:8199` with the prefix stripped: * the same-origin BFF pattern. That gives the SDK client constructed here a * safe same-origin transport (the demo is the host app and supplies no token; - * `OmnigraphOptions.token` is optional and the fixture server runs - * `--unauthenticated`), which is exactly what the adapter's browser entry + * `OmnigraphOptions.token` is optional and the proxy adds the fixture's + * reader token server-side), which is exactly what the adapter's browser entry * accepts. Authenticated construction stays confined to * `@modernrelay/orbit-omnigraph/server`. * @@ -338,10 +338,13 @@ export function OmnigraphPanel({ form, onFormChange, meter, result, error, onLoa {error} {CONNECTION_ERROR.test(error) && (
- Start the local OmniGraph fixture with{' '} + Set a disposable{' '} + OMNIGRAPH_FIXTURE_TOKEN and start{' '} node scripts/omnigraph-fixture.mjs --serve - . If the fixture binaries are outside PATH, set{' '} + . Start the demo with{' '} + OMNIGRAPH_PROXY_TOKEN set to the same + value. If the fixture binaries are outside PATH, set{' '} OMNIGRAPH_BIN and{' '} OMNIGRAPH_SERVER_BIN to their paths.
diff --git a/fixtures/omnigraph/README.md b/fixtures/omnigraph/README.md index 79c2b68..0290d6c 100644 --- a/fixtures/omnigraph/README.md +++ b/fixtures/omnigraph/README.md @@ -1,15 +1,23 @@ -# OmniGraph 0.15 integration fixtures +# OmniGraph 0.17.1 integration fixtures -These are verbatim HTTP bodies recorded from the official **OmniGraph 0.15.0** +These are verbatim HTTP bodies recorded from the official **OmniGraph 0.17.1** server using HTTP contract **0.14**. Adapter tests replay them through TypeScript -SDK **0.14.0**. Live integration tests start a fresh local server and exercise +SDK **0.17.1**. Live integration tests start a fresh local server and exercise both the adapter and the demo's same-origin `/og` proxy. +Qualification with the published SDK 0.17.1 on 2026-11-28: + +| Official server | Verified scope | +| --- | --- | +| 0.17.1 | Current recordings and CI: authenticated adapter export/search, default-deny policy and browser proxy loading | +| 0.14.0, 0.15.0 | Separate fresh-fixture adapter export/search checks, stable heads, identity and nullable/date normalization; no historical browser or recurring CI coverage | + ## Contents | Path | Purpose | | --- | --- | -| `cluster/cluster.yaml` | One graph, `demo`, with a stored search query and no credentials or policies | +| `cluster/cluster.yaml` | `demo` with a stored search query; empty `ungranted` with no policy to check default-deny | +| `cluster/graph.policy.yaml` | Separate loader and reader actors; the reader has `read`, `export`, and `invoke_query` only on `demo` | | `cluster/demo.pg` | Five node types and six edge types; dates, enums, numeric values, nullable properties, and a nullable user property named `Signal.id` | | `cluster/queries.gq` | `search_signals`: ordered whole-node and title projections, bounded to ten rows | | `seed.ndjson` | Deterministic 300-node, 500-edge seed, including hostile strings, Unicode, `Number.MAX_SAFE_INTEGER`, and parallel edges | @@ -49,28 +57,34 @@ both the adapter and the demo's same-origin `/og` proxy. ## Regenerate or serve locally -Use the official 0.15.0 CLI and server. The fixture script checks both versions. +Use the official 0.17.1 CLI and server. The fixture script checks both versions. Download the archive and SHA256 checksum for your platform from the -[OmniGraph 0.15.0 release](https://github.com/ModernRelay/omnigraph/releases/tag/v0.15.0). +[OmniGraph 0.17.1 release](https://github.com/ModernRelay/omnigraph/releases/tag/v0.17.1). ```sh # Optional if both binaries are already on PATH. -export OMNIGRAPH_BIN=/path/to/omnigraph-0.15.0/omnigraph -export OMNIGRAPH_SERVER_BIN=/path/to/omnigraph-0.15.0/omnigraph-server +export OMNIGRAPH_BIN=/path/to/omnigraph-0.17.1/omnigraph +export OMNIGRAPH_SERVER_BIN=/path/to/omnigraph-0.17.1/omnigraph-server # Regenerate seed + recordings, then stop and remove the temporary cluster. node scripts/omnigraph-fixture.mjs # Serve a fresh seeded fixture for the demo until Ctrl-C; no files regenerated. +export OMNIGRAPH_FIXTURE_TOKEN=$(node -p 'crypto.randomUUID()') node scripts/omnigraph-fixture.mjs --serve + +# In another terminal with the same fixture token, start the authenticated proxy. +OMNIGRAPH_PROXY_TOKEN="$OMNIGRAPH_FIXTURE_TOKEN" pnpm demo:dev ``` Each invocation copies the declaration into a unique temporary directory and -creates its own operator configuration with an anonymous loopback server target. -It validates/lints the source, plans and applies to an explicit local root target, releases the exact -bootstrap writer lock after that process completes, starts the server, waits -for `/readyz`, and loads the seed through the served target. No operator defaults -or credentials from the host are used. It never opens or +creates its own operator configuration. It validates/lints the source, plans and +applies to an explicit local root target, and verifies that successful bootstrap +released its lock before starting the server. It waits for `/readyz` and loads +the seed once through authenticated `POST /load/ndjson`. The fixture uses a +private random writer token and a separate reader token; recording generates +both, while `--serve` requires `OMNIGRAPH_FIXTURE_TOKEN` for the reader. No operator +defaults or production credentials from the host are used. It never opens or wipes an existing graph. Shutdown waits for the owned server to exit before removing that temporary directory. The default bind address is `127.0.0.1:8199`; `OMNIGRAPH_FIXTURE_PORT` changes the port. An occupied port fails @@ -96,6 +110,10 @@ OMNIGRAPH_LIVE_REQUIRED=1 pnpm --filter orbit-demo exec playwright test e2e/omni The spec owns fixture startup and teardown. It checks real export/search identity, ordinary `id` data, nullable/date normalization, and browser loading through the -demo proxy. The dedicated CI job downloads the checksum-verified 0.15.0 Linux -release and requires both live tests; missing binaries fail that job. Other +demo proxy. It also verifies that anonymous graph reads fail and that a valid +reader token cannot read the graph without a policy. Playwright generates the +disposable reader token and supplies it only to the fixture and server-side proxy; +browser requests carry no bearer token. Playwright starts its own Vite proxy, +so stop any existing demo on port 5199 before running these tests. The dedicated CI job downloads the +checksum-verified 0.17.1 Linux release and requires all three live tests; missing binaries fail that job. Other local/demo runs may skip this spec when the pinned binaries are unavailable. diff --git a/fixtures/omnigraph/cluster/cluster.yaml b/fixtures/omnigraph/cluster/cluster.yaml index 1d76b3a..09b6cb0 100644 --- a/fixtures/omnigraph/cluster/cluster.yaml +++ b/fixtures/omnigraph/cluster/cluster.yaml @@ -2,8 +2,8 @@ # graph ("demo"). scripts/omnigraph-fixture.mjs copies this declaration into # a fresh temporary root, applies it, then serves that isolated cluster. # -# Deliberately minimal: no embedding provider or Cedar policies; -# the stored read query exercises search identity. +# The reader can export and invoke stored queries only on demo. The empty +# ungranted graph has no policy and exercises default-deny for a valid token. version: 1 metadata: name: orbit-fixture @@ -14,3 +14,9 @@ graphs: demo: schema: demo.pg queries: queries.gq + ungranted: + schema: demo.pg +policies: + demo-access: + file: graph.policy.yaml + applies_to: [demo] diff --git a/fixtures/omnigraph/cluster/graph.policy.yaml b/fixtures/omnigraph/cluster/graph.policy.yaml new file mode 100644 index 0000000..7469c3f --- /dev/null +++ b/fixtures/omnigraph/cluster/graph.policy.yaml @@ -0,0 +1,13 @@ +version: 1 +groups: + loaders: [fixture-bot] + readers: [fixture-reader] +rules: + - id: seed-fixture + allow: + actors: { group: loaders } + actions: [read, change] + - id: read-fixture + allow: + actors: { group: readers } + actions: [read, export, invoke_query] diff --git a/fixtures/omnigraph/recorded/commits.json b/fixtures/omnigraph/recorded/commits.json index 0436304..d07b032 100644 --- a/fixtures/omnigraph/recorded/commits.json +++ b/fixtures/omnigraph/recorded/commits.json @@ -1 +1 @@ -{"commits":[{"graph_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91","graph_branch":null,"graph_manifest_version":2,"parent_commit_id":"01M7QMWQ3Y5ZB754D85KSM4ZFB","merged_parent_commit_id":null,"actor_id":null,"created_at":1795016253886076,"published":true,"kind":"published","root_commit_id":null}],"head_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91","next_page_token":"eyJ2ZXJzaW9uIjoxLCJraW5kIjoiY29tbWl0LWxpc3QtcGFnZSIsImdyYXBoX2lkZW50aXR5IjoiTS1lQngyWHRtNFdwdVFZQXE4M3oxMnFKNU1KamlRQ01LNzVGQzVwRGRtWSIsImJyYW5jaCI6IkVwRTZqTFRUYzE0QURucFFhNWF5VW5DUHFjQkhmUTJRaXA0MEo4YzkxRGMiLCJoZWFkX2NvbW1pdF9pZCI6ImhiMS4wMU03UU1XUkRZQzNaN0hLUUVWR001WUc5MS4xLjAxTTdRTVdSRFlDM1o3SEtRRVZHTTVZRzkxIiwibmV4dF9jb21taXRfaWQiOiIwMU03UU1XUTNZNVpCNzU0RDg1S1NNNFpGQiIsImJlbG93X2dlbmVyYXRpb24iOjF9DzQe5ifShEvAQkWBs7Eqms0Bdy2i1Jf9JphM0FMgHuw"} \ No newline at end of file +{"commits":[{"graph_commit_id":"hb1.01M8H65HAATECQ23R02K9HES5K.1.01M8H65HAATECQ23R02K9HES5K","graph_branch":null,"graph_manifest_version":2,"parent_commit_id":"01M8H65H73WMG47FFP8BZ427CY","merged_parent_commit_id":null,"actor_id":"fixture-bot","created_at":1795873228106331,"published":true,"kind":"published","root_commit_id":null}],"head_commit_id":"hb1.01M8H65HAATECQ23R02K9HES5K.1.01M8H65HAATECQ23R02K9HES5K","next_page_token":"eyJ2ZXJzaW9uIjoxLCJraW5kIjoiY29tbWl0LWxpc3QtcGFnZSIsImdyYXBoX2lkZW50aXR5Ijoic0NBbXBKTzZfZGdpZHUyWGdQQ3VzSjE4U05Ob3RrN1FaU2Qwc012MDhiSSIsImJyYW5jaCI6IkVwRTZqTFRUYzE0QURucFFhNWF5VW5DUHFjQkhmUTJRaXA0MEo4YzkxRGMiLCJoZWFkX2NvbW1pdF9pZCI6ImhiMS4wMU04SDY1SEFBVEVDUTIzUjAySzlIRVM1Sy4xLjAxTThINjVIQUFURUNRMjNSMDJLOUhFUzVLIiwibmV4dF9jb21taXRfaWQiOiIwMU04SDY1SDczV01HNDdGRlA4Qlo0MjdDWSIsImJlbG93X2dlbmVyYXRpb24iOjF9gsM9r8X6bPOVkKgIlOL5c96oRGZBN_BXE3exYGpilaU"} \ No newline at end of file diff --git a/fixtures/omnigraph/recorded/health.json b/fixtures/omnigraph/recorded/health.json index b13b4c8..0b23f58 100644 --- a/fixtures/omnigraph/recorded/health.json +++ b/fixtures/omnigraph/recorded/health.json @@ -1 +1 @@ -{"status":"ok","version":"0.15.0","internal_schema_version":16,"source_version":"373834b4c1c4b29cf0ddd64bee9565f98c60cc26"} \ No newline at end of file +{"status":"ok","version":"0.17.1","internal_schema_version":18,"source_version":"5b40a68fc0b29c664b8bc63eae31b2757b0f0f23"} \ No newline at end of file diff --git a/fixtures/omnigraph/recorded/manifest.json b/fixtures/omnigraph/recorded/manifest.json index f6186f7..921d5c1 100644 --- a/fixtures/omnigraph/recorded/manifest.json +++ b/fixtures/omnigraph/recorded/manifest.json @@ -1,11 +1,11 @@ { - "recordedAt": "2026-11-18T15:37:34.105Z", - "serverVersion": "0.15.0", + "recordedAt": "2026-11-28T13:40:28.141Z", + "serverVersion": "0.17.1", "httpApiContract": "0.14", "graphId": "demo", "branch": "main", - "headBefore": "hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91", - "headAfter": "hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91", + "headBefore": "hb1.01M8H65HAATECQ23R02K9HES5K.1.01M8H65HAATECQ23R02K9HES5K", + "headAfter": "hb1.01M8H65HAATECQ23R02K9HES5K.1.01M8H65HAATECQ23R02K9HES5K", "rowCounts": { "edge:Correlates": 50, "edge:OwnedBy": 60, @@ -21,5 +21,5 @@ }, "exportLineCount": 800, "edgeLinesBeforeNodeLines": true, - "notes": "Verbatim OmniGraph 0.15.0 HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording." + "notes": "Verbatim OmniGraph 0.17.1 HTTP bodies from a fresh isolated local cluster. Identity is top-level id in export and @id in query node values; nullable data properties are omitted. The branch was quiescent during recording." } diff --git a/fixtures/omnigraph/recorded/search.json b/fixtures/omnigraph/recorded/search.json index ba2e246..0801e99 100644 --- a/fixtures/omnigraph/recorded/search.json +++ b/fixtures/omnigraph/recorded/search.json @@ -1 +1 @@ -{"query_name":"search_signals","target":{"branch":"main","snapshot":null},"row_count":1,"columns":["s","s.title"],"rows":[{"s":{"@id":"signal-001","body":"Market movement around wire encodings.","category":"customer","id":1,"observed_at":"2017-06-09","slug":"signal-001","strength":0.0,"title":"Signal 1: search admission"},"s.title":"Signal 1: search admission"}],"graph_commit_id":"hb1.01M7QMWRDYC3Z7HKQEVGM5YG91.1.01M7QMWRDYC3Z7HKQEVGM5YG91"} \ No newline at end of file +{"query_name":"search_signals","target":{"branch":"main","snapshot":null},"row_count":1,"columns":["s","s.title"],"rows":[{"s":{"@id":"signal-001","body":"Market movement around wire encodings.","category":"customer","id":1,"observed_at":"2017-06-09","slug":"signal-001","strength":0.0,"title":"Signal 1: search admission"},"s.title":"Signal 1: search admission"}],"graph_commit_id":"hb1.01M8H65HAATECQ23R02K9HES5K.1.01M8H65HAATECQ23R02K9HES5K"} \ No newline at end of file diff --git a/fixtures/omnigraph/recorded/snapshot.json b/fixtures/omnigraph/recorded/snapshot.json index 2670d0d..463ef0f 100644 --- a/fixtures/omnigraph/recorded/snapshot.json +++ b/fixtures/omnigraph/recorded/snapshot.json @@ -1 +1 @@ -{"graph_branch":"main","graph_manifest_version":2,"internal_schema_version":16,"datasets":[{"entity_kind":"edge","type_name":"Correlates","dataset_path":"edges/0000000000000006-0000000000000033","published_dataset_version":2,"native_dataset_branch":null,"entity_count":50},{"entity_kind":"edge","type_name":"OwnedBy","dataset_path":"edges/0000000000000007-0000000000000034","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"edge","type_name":"ParticipatedIn","dataset_path":"edges/0000000000000008-0000000000000035","published_dataset_version":2,"native_dataset_branch":null,"entity_count":120},{"entity_kind":"edge","type_name":"RecordedBy","dataset_path":"edges/0000000000000009-0000000000000036","published_dataset_version":2,"native_dataset_branch":null,"entity_count":90},{"entity_kind":"edge","type_name":"Supports","dataset_path":"edges/000000000000000a-0000000000000037","published_dataset_version":2,"native_dataset_branch":null,"entity_count":110},{"entity_kind":"edge","type_name":"Triggered","dataset_path":"edges/000000000000000b-0000000000000038","published_dataset_version":2,"native_dataset_branch":null,"entity_count":70},{"entity_kind":"node","type_name":"Actor","dataset_path":"nodes/0000000000000001-000000000000002e","published_dataset_version":2,"native_dataset_branch":null,"entity_count":30},{"entity_kind":"node","type_name":"Artifact","dataset_path":"nodes/0000000000000002-000000000000002f","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Decision","dataset_path":"nodes/0000000000000003-0000000000000030","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Signal","dataset_path":"nodes/0000000000000004-0000000000000031","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Trace","dataset_path":"nodes/0000000000000005-0000000000000032","published_dataset_version":2,"native_dataset_branch":null,"entity_count":90}]} \ No newline at end of file +{"graph_branch":"main","graph_manifest_version":2,"internal_schema_version":18,"datasets":[{"entity_kind":"edge","type_name":"Correlates","dataset_path":"edges/0000000000000006-0000000000000033","published_dataset_version":2,"native_dataset_branch":null,"entity_count":50},{"entity_kind":"edge","type_name":"OwnedBy","dataset_path":"edges/0000000000000007-0000000000000034","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"edge","type_name":"ParticipatedIn","dataset_path":"edges/0000000000000008-0000000000000035","published_dataset_version":2,"native_dataset_branch":null,"entity_count":120},{"entity_kind":"edge","type_name":"RecordedBy","dataset_path":"edges/0000000000000009-0000000000000036","published_dataset_version":2,"native_dataset_branch":null,"entity_count":90},{"entity_kind":"edge","type_name":"Supports","dataset_path":"edges/000000000000000a-0000000000000037","published_dataset_version":2,"native_dataset_branch":null,"entity_count":110},{"entity_kind":"edge","type_name":"Triggered","dataset_path":"edges/000000000000000b-0000000000000038","published_dataset_version":2,"native_dataset_branch":null,"entity_count":70},{"entity_kind":"node","type_name":"Actor","dataset_path":"nodes/0000000000000001-000000000000002e","published_dataset_version":2,"native_dataset_branch":null,"entity_count":30},{"entity_kind":"node","type_name":"Artifact","dataset_path":"nodes/0000000000000002-000000000000002f","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Decision","dataset_path":"nodes/0000000000000003-0000000000000030","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Signal","dataset_path":"nodes/0000000000000004-0000000000000031","published_dataset_version":2,"native_dataset_branch":null,"entity_count":60},{"entity_kind":"node","type_name":"Trace","dataset_path":"nodes/0000000000000005-0000000000000032","published_dataset_version":2,"native_dataset_branch":null,"entity_count":90}]} \ No newline at end of file diff --git a/packages/omnigraph/README.md b/packages/omnigraph/README.md index 4e2954f..be15398 100644 --- a/packages/omnigraph/README.md +++ b/packages/omnigraph/README.md @@ -3,9 +3,16 @@ This optional adapter connects Orbit's framework-independent ingestion API to OmniGraph through the official TypeScript SDK, `@modernrelay/omnigraph`. -Server and CLI use requires Node.js 22+. Orbit tests the TypeScript SDK 0.14.0 -against OmniGraph server 0.15.0. Both the 0.14 and 0.15 server series use HTTP -contract `0.14`. The SDK checks that contract before reading graph data. +Server and CLI use requires Node.js 22+. Orbit tests the TypeScript SDK 0.17.1 +against OmniGraph server 0.17.1. The HTTP contract is still `0.14`; its number +is independent of the SDK and server release. The SDK checks that contract +before reading graph data. The live gate verifies authenticated export, +stored-query search, graph policy and loading through the demo proxy. + +The same published SDK 0.17.1 was also checked through this adapter against +official servers 0.14.0 and 0.15.0: export, stored-query search, stable source +heads, identity and nullable/date normalization. Those historical checks do not +cover the browser or run in the current CI gate, which uses server 0.17.1. ## The v1 rule @@ -187,6 +194,15 @@ must preserve these methods and headers. Configure the server access policy to permit the adapter's schema, commit, export, and stored-query reads; supplying a static token alone does not grant every operation under the server's access policy. +When upgrading a server from 0.15 or earlier, apply an explicit graph policy: +since 0.16, a static token cannot read a graph without one. Grant `read`, `export` +and `invoke_query` for this adapter's load and search paths. Valid credentials +alone do not establish graph access: the live fixture verifies `403 forbidden` +for a static token reading a graph without a policy. The authenticated local +[fixture policy](../../fixtures/omnigraph/cluster/graph.policy.yaml) demonstrates +these grants. Use HTTPS for remote authenticated endpoints; the fixture uses +an isolated loopback server with disposable credentials. + ## Error surface SDK typed errors (`NetworkError`, `ConflictError`, …) never cross this package's public @@ -195,8 +211,9 @@ Cancellation (`AbortSignal`) surfaces as an `AbortError`; the session is aborted graph left untouched. This includes cancellation during contract discovery and stored read-query invocation. Missing or mismatched HTTP contract headers fail closed before ingestion can commit. If a server passes the HTTP contract check but reports -a build outside the supported 0.14 and 0.15 series, the adapter includes a version -warning in the load result. +a build outside the exact verified releases 0.14.0, 0.15.0 and 0.17.1, the adapter +includes a version warning in the load result and continues. These checks use +SDK 0.17.1; passing the HTTP contract check alone does not qualify another build. ## Also in the box diff --git a/packages/omnigraph/package.json b/packages/omnigraph/package.json index 0d59bf7..3061db0 100644 --- a/packages/omnigraph/package.json +++ b/packages/omnigraph/package.json @@ -42,7 +42,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "@modernrelay/omnigraph": "0.14.0", + "@modernrelay/omnigraph": "0.17.1", "@modernrelay/orbit-core": "workspace:*" }, "devDependencies": { diff --git a/packages/omnigraph/src/loader.ts b/packages/omnigraph/src/loader.ts index 142f1c0..c6123b1 100644 --- a/packages/omnigraph/src/loader.ts +++ b/packages/omnigraph/src/loader.ts @@ -53,8 +53,8 @@ import type { } from './types'; const DEFAULT_BATCH_SIZE = 2000; -/** Server release series verified with this adapter. Both speak HTTP 0.14. */ -const SUPPORTED_SERVER_SERIES = ['0.14', '0.15']; +/** Exact server releases verified with the current SDK. HTTP remains 0.14. */ +const VERIFIED_SERVER_VERSIONS = ['0.14.0', '0.15.0', '0.17.1']; /** * Finite whole-export cap for the necessarily atomic replace session. A @@ -137,12 +137,6 @@ function canonicalSourceRevision(ref: OmnigraphDataRef): string { return `og:${hash64(JSON.stringify(tuple))}`; } -/** `'0.8.1'` → `'0.8'`; null when unparseable. */ -function majorMinor(version: string): string | null { - const m = /^(\d+)\.(\d+)/.exec(version); - return m ? `${m[1]}.${m[2]}` : null; -} - /** CallOptions without an explicit-undefined signal (exactOptionalPropertyTypes). */ function callOpts(signal: AbortSignal | undefined): CallOptions { return signal ? { signal } : {}; @@ -518,11 +512,10 @@ export function createOmnigraphSource(options: OmnigraphSourceOptions): Omnigrap } catch (err) { throw mapError(err, signal); } - const server = majorMinor(serverVersion); - if (server === null || !SUPPORTED_SERVER_SERIES.includes(server)) { + if (!VERIFIED_SERVER_VERSIONS.includes(serverVersion)) { warnings.push( - `omnigraph: server version ${serverVersion} is outside the adapter's tested release series ` + - `(${SUPPORTED_SERVER_SERIES.join(', ')})`, + `omnigraph: server version ${serverVersion} is outside the adapter's tested releases ` + + `(${VERIFIED_SERVER_VERSIONS.join(', ')})`, ); } diff --git a/packages/omnigraph/src/types.ts b/packages/omnigraph/src/types.ts index 0863653..452cdf2 100644 --- a/packages/omnigraph/src/types.ts +++ b/packages/omnigraph/src/types.ts @@ -117,7 +117,7 @@ export interface OmnigraphLoadResult { /** `og.health().version` — the server build the load ran against. */ serverVersion: string; /** - * Non-fatal observations: untested server release series, accepted + * Non-fatal observations: untested server releases, accepted * drift, big-int key attribute precision hazards, and skipped unknown * lines. Never hides a retry or accepted-drift decision. HTTP API contract * mismatches are fatal errors, not warnings. diff --git a/packages/omnigraph/test/loader.test.ts b/packages/omnigraph/test/loader.test.ts index 123c8ba..8d3ac9f 100644 --- a/packages/omnigraph/test/loader.test.ts +++ b/packages/omnigraph/test/loader.test.ts @@ -815,34 +815,36 @@ describe('server release and HTTP contract compatibility', () => { expect(instance.store.getState().revisions.model).toBe(0); }); - it('loads the recorded 0.15.0 server without a version warning', async () => { + it('loads the recorded 0.17.1 server without a version warning', async () => { const { instance, source } = harness(recordedRoutes()); const result = await source.load(instance); - expect(result.serverVersion).toBe('0.15.0'); + expect(result.serverVersion).toBe('0.17.1'); expect(result.warnings).toEqual([]); }); - it('continues to support the 0.14 server series', async () => { + it.each(['0.14.0', '0.15.0'])('retains warning-free loading for qualified historical server %s', async (version) => { const { instance, source } = harness(recordedRoutes({ - 'GET /healthz': json(JSON.stringify({ status: 'ok', version: '0.14.0', internal_schema_version: 16 })), + 'GET /healthz': json(JSON.stringify({ status: 'ok', version, internal_schema_version: 16 })), })); const result = await source.load(instance); + expect(result.serverVersion).toBe(version); expect(result.warnings).toEqual([]); + expect(instance.store.getState().nodeCount).toBe(NODE_TOTAL); }); - it('warns for an untested server series when the HTTP contract still matches', async () => { + it.each(['0.16.0', '0.17.0', '0.17.2', '0.18.0'])('warns for unverified server %s when the HTTP contract still matches', async (version) => { const { instance, source } = harness( recordedRoutes({ 'GET /healthz': json( - JSON.stringify({ status: 'ok', version: '0.16.0', internal_schema_version: 16 }), + JSON.stringify({ status: 'ok', version, internal_schema_version: 18 }), ), }), ); const result = await source.load(instance); - expect(result.serverVersion).toBe('0.16.0'); - expect(result.warnings).toEqual([expect.stringContaining('server version 0.16.0')]); + expect(result.serverVersion).toBe(version); + expect(result.warnings).toEqual([expect.stringContaining(`server version ${version}`)]); expect(instance.store.getState().nodeCount).toBe(NODE_TOTAL); // load still succeeded }); }); diff --git a/packages/omnigraph/test/recorded-fixtures.test.ts b/packages/omnigraph/test/recorded-fixtures.test.ts index 34ce67f..448e7f0 100644 --- a/packages/omnigraph/test/recorded-fixtures.test.ts +++ b/packages/omnigraph/test/recorded-fixtures.test.ts @@ -23,7 +23,7 @@ describe('recorded Omnigraph wire fixtures', () => { expect(schemaBody).toBe(JSON.stringify(recorded)); }); - it('preserves physical identity and numeric user ids from the 0.15.0 export', () => { + it('preserves physical identity and numeric user ids from the 0.17.1 export', () => { const records = exportBody.trim().split('\n').map((line) => JSON.parse(line) as ExportRecord); for (const record of records) { expect(typeof record.id).toBe('string'); diff --git a/packages/omnigraph/test/search-service.test.ts b/packages/omnigraph/test/search-service.test.ts index b71e298..4f2494f 100644 --- a/packages/omnigraph/test/search-service.test.ts +++ b/packages/omnigraph/test/search-service.test.ts @@ -201,7 +201,7 @@ describe('createOmnigraphSearchService — invocation', () => { // --------------------------------------------------------------------------- describe('row mapping', () => { - it('maps the recorded 0.15.0 stored query through the real SDK', async () => { + it('maps the recorded 0.17.1 stored query through the real SDK', async () => { const { service } = harness({ 'POST /graphs/demo/queries/search_signals': json(searchBody), }, { queryName: 'search_signals', params: (q) => ({ q }) }); diff --git a/packages/omnigraph/test/server-entry.test.ts b/packages/omnigraph/test/server-entry.test.ts index 3790f37..79bf617 100644 --- a/packages/omnigraph/test/server-entry.test.ts +++ b/packages/omnigraph/test/server-entry.test.ts @@ -28,7 +28,7 @@ describe('createOmnigraphServerClient in the server-only entry', () => { return new Response( method === 'HEAD' ? null : JSON.stringify(url.endsWith('/schema') ? { schema_source: 'node Actor { slug: String @key }' } - : { status: 'ok', version: '0.15.0', internal_schema_version: 16 }), + : { status: 'ok', version: '0.17.1', internal_schema_version: 18 }), { status: 200, headers: { 'content-type': 'application/json', [HTTP_API_CONTRACT_HEADER]: HTTP_API_CONTRACT } }, ); }; @@ -41,7 +41,7 @@ describe('createOmnigraphServerClient in the server-only entry', () => { expect(client).toBeInstanceOf(Omnigraph); const health = await client.health(); - expect(health.version).toBe('0.15.0'); + expect(health.version).toBe('0.17.1'); await client.graph('demo').schema.get(); expect(seen).toEqual([ { url: 'http://og.internal:8080/healthz', method: 'GET', auth: null, contract: '0.14' }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45e54d9..a2ccb27 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -197,8 +197,8 @@ importers: apps/demo: dependencies: '@modernrelay/omnigraph': - specifier: 0.14.0 - version: 0.14.0 + specifier: 0.17.1 + version: 0.17.1 '@modernrelay/orbit-core': specifier: workspace:* version: link:../../packages/core @@ -380,8 +380,8 @@ importers: packages/omnigraph: dependencies: '@modernrelay/omnigraph': - specifier: 0.14.0 - version: 0.14.0 + specifier: 0.17.1 + version: 0.17.1 '@modernrelay/orbit-core': specifier: workspace:* version: link:../core @@ -973,8 +973,8 @@ packages: '@types/react': '>=16' react: '>=16' - '@modernrelay/omnigraph@0.14.0': - resolution: {integrity: sha512-IkRUBcnWIv3ZO7ugELl42tEN+wgD4wzYb0xMbZCDTey/0WgkOQUz+58oCseW2qD511r8Qx+0Th52AhLuPG4Now==} + '@modernrelay/omnigraph@0.17.1': + resolution: {integrity: sha512-7gVBZx8w+OBoKmEvB01sybPG9aCBXSDbSZVs0HoCXyPnbwXAFpTEvu/+QEhW5b+TZa8xIKqEQhx2rtwk3wSIcw==} engines: {node: '>=22'} '@napi-rs/lzma-linux-x64-gnu@1.5.1': @@ -3891,7 +3891,7 @@ snapshots: '@types/react': 19.3.0 react: 19.3.1 - '@modernrelay/omnigraph@0.14.0': {} + '@modernrelay/omnigraph@0.17.1': {} '@napi-rs/lzma-linux-x64-gnu@1.5.1': optional: true diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 5821026..081fdcf 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -2,9 +2,9 @@ packages: - packages/* - apps/* -# The adapter uses the 0.14.0 SDK for OmniGraph HTTP contract 0.14. +# The qualified SDK release still uses OmniGraph HTTP contract 0.14. minimumReleaseAgeExclude: - - '@modernrelay/omnigraph@0.14.0' + - '@modernrelay/omnigraph@0.17.1' allowBuilds: esbuild: true diff --git a/scripts/omnigraph-fixture.mjs b/scripts/omnigraph-fixture.mjs index 43a0846..e614de4 100644 --- a/scripts/omnigraph-fixture.mjs +++ b/scripts/omnigraph-fixture.mjs @@ -5,10 +5,11 @@ * the seeded fixture running for the demo/live tests without rewriting files. * * OMNIGRAPH_BIN and OMNIGRAPH_SERVER_BIN select separately installed binaries; - * the CLI and server must both be exactly 0.15.0. No global installation or + * the CLI and server must both be exactly 0.17.1. No global installation or * production service is changed. See fixtures/omnigraph/README.md. */ import { spawn, spawnSync } from 'node:child_process'; +import { randomUUID } from 'node:crypto'; import { once } from 'node:events'; import { cpSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'; import { createServer } from 'node:net'; @@ -21,7 +22,7 @@ const FIXTURE_DIR = path.join(ROOT, 'fixtures', 'omnigraph'); const RECORDED_DIR = path.join(FIXTURE_DIR, 'recorded'); const CLI = process.env.OMNIGRAPH_BIN || 'omnigraph'; const SERVER = process.env.OMNIGRAPH_SERVER_BIN || 'omnigraph-server'; -const VERSION = '0.15.0'; +const VERSION = '0.17.1'; const CONTRACT = '0.14'; const HEADER = 'Omnigraph-Http-Api'; const GRAPH_ID = 'demo'; @@ -30,6 +31,10 @@ const PORT = Number(process.env.OMNIGRAPH_FIXTURE_PORT || 8199); const BIND = `127.0.0.1:${PORT}`; const BASE = `http://${BIND}`; const SERVE = process.argv.includes('--serve'); +// Recording owns its credentials. Serving requires a caller-supplied reader +// token so the demo proxy and tests can use the same ephemeral fixture. +const TOKEN = process.env.OMNIGRAPH_FIXTURE_TOKEN || randomUUID(); +const LOAD_TOKEN = randomUUID(); function run(cmd, args, env = process.env) { const result = spawnSync(cmd, args, { cwd: ROOT, env, encoding: 'utf8', timeout: 60000, maxBuffer: 16 * 1024 * 1024 }); @@ -41,7 +46,11 @@ function run(cmd, args, env = process.env) { async function request(route, init = {}) { const response = await fetch(`${BASE}${route}`, { ...init, - headers: { Accept: 'application/json, application/x-ndjson', [HEADER]: CONTRACT, ...init.headers }, + headers: { + Accept: 'application/json, application/x-ndjson', [HEADER]: CONTRACT, + ...(route.startsWith('/graphs/') ? { Authorization: `Bearer ${TOKEN}` } : {}), + ...init.headers, + }, signal: AbortSignal.timeout(10000), }); if (response.headers.get(HEADER) !== CONTRACT) throw new Error(`${route}: missing ${HEADER}: ${CONTRACT}`); @@ -243,11 +252,14 @@ function generateSeed() { async function main() { if (process.argv.slice(2).some((arg) => arg !== '--serve')) throw new Error('Usage: node scripts/omnigraph-fixture.mjs [--serve]'); if (!Number.isInteger(PORT) || PORT < 1 || PORT > 65535) throw new Error('Invalid OMNIGRAPH_FIXTURE_PORT'); + if (SERVE && !process.env.OMNIGRAPH_FIXTURE_TOKEN) throw new Error('Set OMNIGRAPH_FIXTURE_TOKEN for --serve and use the same token in the demo proxy or SDK client.'); const version = JSON.parse(run(CLI, ['version', '--json'])); if (version.version !== VERSION || version.http_contract !== CONTRACT || version.protocols?.target !== 2) { throw new Error(`Fixture regeneration requires OmniGraph ${VERSION}; set OMNIGRAPH_BIN and OMNIGRAPH_SERVER_BIN to the pinned release.`); } - run(SERVER, ['--help']); + if (!run(SERVER, ['--version']).split(/\r?\n/).includes(`omnigraph-server ${VERSION}`)) { + throw new Error(`Fixture regeneration requires omnigraph-server ${VERSION}.`); + } await requireFreePort(); const cluster = mkdtempSync(path.join(tmpdir(), 'orbit-omnigraph-')); const shutdown = new AbortController(); @@ -259,31 +271,33 @@ async function main() { let serverLog = ''; try { // Isolate the fixture target configuration from any operator defaults or - // credentials on the host. Loopback access is explicitly anonymous. + // credentials on the host. The reader's graph policy is applied explicitly; + // the current server denies token access to graphs without a policy. const operatorHome = path.join(cluster, 'operator'); mkdirSync(operatorHome); - writeFileSync(path.join(operatorHome, 'config.yaml'), [ - 'version: 1', 'targets:', ' fixture:', ' kind: server', - ` endpoint: ${BASE}`, ' auth: { provider: anonymous }', '', - ].join('\n')); - const runCli = (args) => run(CLI, args, { ...process.env, OMNIGRAPH_HOME: operatorHome }); + writeFileSync(path.join(operatorHome, 'config.yaml'), 'version: 1\ntargets: {}\n'); + const env = { + ...Object.fromEntries(Object.entries(process.env).filter(([name]) => !name.startsWith('OMNIGRAPH_'))), + OMNIGRAPH_HOME: operatorHome, + }; + const runCli = (args) => run(CLI, args, env); runCli(['config', 'validate']); - for (const file of ['cluster.yaml', 'demo.pg', 'queries.gq']) cpSync(path.join(FIXTURE_DIR, 'cluster', file), path.join(cluster, file)); + for (const file of ['cluster.yaml', 'demo.pg', 'queries.gq', 'graph.policy.yaml']) cpSync(path.join(FIXTURE_DIR, 'cluster', file), path.join(cluster, file)); console.log(`Preparing fresh OmniGraph ${VERSION} fixture in ${cluster}`); runCli(['cluster', 'validate', '--config', cluster, '--json']); runCli(['lint', '--schema', path.join(cluster, 'demo.pg'), '--query', path.join(cluster, 'queries.gq'), '--json']); runCli(['cluster', 'plan', '--target', cluster, '--config', cluster, '--json']); const applied = JSON.parse(runCli(['cluster', 'apply', '--target', cluster, '--config', cluster, '--as', 'fixture-bot', '--json'])); if (applied.status !== 'complete') throw new Error('Fixture bootstrap did not finish'); - // This uniquely-owned local root has no other readers/writers. The synchronous - // apply process has exited after durable completion, so no native I/O remains. - // Release only its observed exact retained lock before starting the server. + // This fixture's converged local apply releases its own admission lock. + // An unexpected retained lock is a failed bootstrap, not permission to unlock. const observed = JSON.parse(runCli(['cluster', 'observe', '--target', cluster, '--config', cluster, '--json'])); - const lock = observed.state_observations?.lock_id; - if (typeof lock !== 'string') throw new Error('Expected the completed bootstrap writer lock'); - runCli(['cluster', 'force-unlock', lock, '--target', cluster, '--json']); + if (observed.state_observations?.lock_id != null) throw new Error('Completed fixture bootstrap retained its admission lock'); - server = spawn(SERVER, ['--cluster', cluster, '--unauthenticated', '--bind', BIND], { cwd: ROOT, stdio: ['ignore', 'pipe', 'pipe'] }); + server = spawn(SERVER, ['--cluster', cluster, '--bind', BIND], { + cwd: ROOT, stdio: ['ignore', 'pipe', 'pipe'], + env: { ...env, OMNIGRAPH_SERVER_BEARER_TOKENS_JSON: JSON.stringify({ 'fixture-bot': LOAD_TOKEN, 'fixture-reader': TOKEN }) }, + }); serverClosed = once(server, 'close'); for (const output of [server.stdout, server.stderr]) output.on('data', (chunk) => { serverLog = (serverLog + chunk).slice(-16000); }); const deadline = Date.now() + 20000; @@ -298,9 +312,11 @@ async function main() { if (JSON.parse(health.body).version !== VERSION) throw new Error(`Expected server ${VERSION}, got ${health.body}`); const discovery = await request('/healthz', { method: 'HEAD' }); const seed = generateSeed(); - const seedPath = path.join(cluster, 'seed.ndjson'); - writeFileSync(seedPath, seed); - const loaded = JSON.parse(runCli(['load', '--data', seedPath, '--mode', 'merge', '--target', 'fixture', '--graph', GRAPH_ID, '--json'])); + // The CLI requires HTTPS for authenticated server targets. This isolated + // loopback fixture loads directly over HTTP with its private writer token. + const loaded = JSON.parse((await request(`/graphs/${GRAPH_ID}/load/ndjson?mode=merge`, { + method: 'POST', headers: { 'Content-Type': 'application/x-ndjson', Authorization: `Bearer ${LOAD_TOKEN}` }, body: seed, + })).body); const total = (tables) => (tables ?? []).reduce((sum, table) => sum + table.entities_loaded, 0); if (total(loaded.nodes) !== 300 || total(loaded.edges) !== 500) throw new Error(`Unexpected load counts: ${JSON.stringify(loaded)}`); console.log(`FIXTURE_READY ${BASE} · 300 nodes · 500 edges`);