Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
Close out phase 3 release-state review follow-ups (PRD-9389) (#6806)
Andrew Mikofalvy24a29a9a8f85
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.ymlindex cf9fc73d1..18c9b782d 100644--- a/.github/workflows/desktop-release.yml+++ b/.github/workflows/desktop-release.yml@@ -2046,7 +2046,6 @@ jobs:echo "configured=true" >> "$GITHUB_OUTPUT"elseecho "configured=false" >> "$GITHUB_OUTPUT"- echo "::notice::OK_RELEASE_BRIDGE_APP_ID not set; skipping the docs changelog refresh for ${RELEASE_TAG}. The changelog picks it up on the next docs deploy."fi- name: Mint docs refresh token (bridge App)@@ -2061,18 +2060,43 @@ jobs:repositories: agents-private- name: Refresh the docs changelog on agents-private- if: success() && steps.docs-bridge-token.outputs.token != ''+ if: success() && needs.prepare.outputs.channel == 'latest'env:+ BRIDGE_CONFIGURED: ${{ steps.docs-bridge.outputs.configured }}+ MINT_OUTCOME: ${{ steps.docs-bridge-token.outcome }}GH_TOKEN: ${{ steps.docs-bridge-token.outputs.token }}run: |set -uo pipefail+ RECOVERY="gh workflow run public-open-knowledge-docs-changelog-deploy.yml --repo inkeep/agents-private -f reason=\"${RELEASE_TAG} published\""+ missed() {+ echo "::warning::$1, so the docs changelog does not list ${RELEASE_TAG} until it is rebuilt by hand: ${RECOVERY}"+ {+ echo "### Docs changelog not refreshed for ${RELEASE_TAG}"+ echo ""+ echo "$1. The npm publish is not affected. Rebuild the changelog by hand:"+ echo ""+ echo " ${RECOVERY}"+ } >> "$GITHUB_STEP_SUMMARY"+ }+ if [[ "${BRIDGE_CONFIGURED:-}" != "true" ]]; then+ missed "OK_RELEASE_BRIDGE_APP_ID is not set, so ok-stable-published was not sent"+ exit 0+ fi+ if [[ "${MINT_OUTCOME:-}" != "success" || -z "${GH_TOKEN:-}" ]]; then+ missed "The bridge App token could not be minted (mint step: ${MINT_OUTCOME:-not run}), so ok-stable-published was not sent"+ exit 0+ fiSELF_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"- payload=$(jq -nc --arg tag "$RELEASE_TAG" --arg by "$SELF_URL" \- '{event_type: "ok-stable-published", client_payload: {release_tag: $tag, dispatched_by: $by}}')+ if ! payload=$(jq -nc --arg tag "$RELEASE_TAG" --arg by "$SELF_URL" \+ '{event_type: "ok-stable-published", client_payload: {release_tag: $tag, dispatched_by: $by}}'); then+ missed "Building the ok-stable-published payload failed, so it was not sent"+ exit 0+ fiif gh api -X POST "repos/inkeep/agents-private/dispatches" --input - <<<"$payload" >/dev/null; thenecho "Dispatched ok-stable-published to agents-private for ${RELEASE_TAG}; the docs changelog rebuilds there."+ echo "Dispatched \`ok-stable-published\` to agents-private for ${RELEASE_TAG}; the docs changelog rebuilds there." >> "$GITHUB_STEP_SUMMARY"else- echo "::warning::Could not dispatch ok-stable-published for ${RELEASE_TAG}; the docs changelog refreshes on the next docs deploy, or run public-open-knowledge-docs-changelog-deploy.yml by hand."+ missed "Dispatching ok-stable-published to agents-private failed"fi# FR5b — the npm stable publish sits downstream of the DMG smoke gatediff --git a/docs/src/lib/releases.test.ts b/docs/src/lib/releases.test.tsindex 75f90f36a..3af66ef8a 100644--- a/docs/src/lib/releases.test.ts+++ b/docs/src/lib/releases.test.ts@@ -636,12 +636,14 @@ describe('fetchReleaseFeed', () => {test('a body read that times out or resets is retried, and reported as a request failure rather than as a body that is not JSON', async () => {const cut = (reason: () => Error) =>- ({- ok: true,- status: 200,- headers: new Headers(),- text: () => Promise.reject(reason()),- }) as unknown as Response;+ new Response(+ new ReadableStream({+ start(controller) {+ controller.error(reason());+ },+ }),+ { status: 200 },+ );const answers = [cut(() => new DOMException('The operation was aborted due to timeout', 'TimeoutError')),json([apiRelease('v1.1.0', { body: marked('- New.') })]),@@ -657,23 +659,31 @@ describe('fetchReleaseFeed', () => {expect(recovered.failure).toBeNull();expect([...recovered.notes.keys()]).toEqual(['v1.1.0']);expect(waits).toEqual([1000]);- const reset = (() =>- Promise.resolve(+ let resets = 0;+ const reset = (() => {+ resets += 1;+ return Promise.resolve(cut(() =>new TypeError('terminated', {cause: Object.assign(new Error('other side closed'), { code: 'UND_ERR_SOCKET' }),}),),- )) as unknown as typeof fetch;+ );+ }) as unknown as typeof fetch;+ waits.length = 0;const failed = await fetchReleaseFeed({changelogTags: new Set(['v1.0.0']),fetchImpl: reset,- sleep: noWait,+ sleep: async (ms) => {+ waits.push(ms);+ },});expect(failed.failure).toBe('page 1 request failed after 3 attempts: terminated (UND_ERR_SOCKET)',);+ expect(resets).toBe(3);+ expect(waits).toEqual([1000, 2000]);});test('warns about a published stable that has neither marked notes nor a CHANGELOG.md section', async () => {diff --git a/packages/app/src/build/app-version.test.ts b/packages/app/src/build/app-version.test.tsindex f29fab573..b7a285007 100644--- a/packages/app/src/build/app-version.test.ts+++ b/packages/app/src/build/app-version.test.ts@@ -1,10 +1,24 @@-import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { dirname, join, resolve } from 'node:path';import { fileURLToPath } from 'node:url';import { CLIENT_RUNTIME_VERSION_FALLBACK } from '@inkeep/open-knowledge-core';import { loadConfigFromFile } from 'vite';import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';++const stamped = vi.hoisted(() => ({ version: '9.8.7-stamped.1' }));++vi.mock('node:fs', async (importOriginal) => {+ const actual = await importOriginal<typeof import('node:fs')>();+ const { fileURLToPath: toPath } = await import('node:url');+ const appPackageJson = toPath(new URL('../../package.json', import.meta.url));+ const readFileSync = ((path: Parameters<typeof actual.readFileSync>[0], ...rest: unknown[]) =>+ String(path) === appPackageJson+ ? JSON.stringify({ name: '@inkeep/open-knowledge-app', version: stamped.version })+ : Reflect.apply(actual.readFileSync, actual, [path, ...rest])) as typeof actual.readFileSync;+ return { ...actual, readFileSync };+});+import {APP_VERSION_ENV_VAR,APP_VERSION_UNKNOWN,@@ -13,11 +27,6 @@ import {} from './app-version.ts';const here = dirname(fileURLToPath(import.meta.url));-const appPkgVersion = (- JSON.parse(readFileSync(resolve(here, '..', '..', 'package.json'), 'utf-8')) as {- version: string;- }-).version;describe('the unresolved-version sentinel', () => {test('matches the core client-version fallback it is duplicated from', () => {@@ -33,7 +42,7 @@ describe('resolveAppVersion', () => {afterEach(() => rmSync(fixtureDir, { recursive: true, force: true }));test('reads packages/app/package.json by default', () => {- expect(resolveAppVersion()).toBe(appPkgVersion);+ expect(resolveAppVersion()).toBe(stamped.version);});test('returns the version a package.json carries, not the sentinel', () => {@@ -65,8 +74,8 @@ describe('injectAppVersionEnv', () => {test('sets VITE_APP_VERSION on process.env and returns it', () => {const returned = injectAppVersionEnv();- expect(returned).toBe(appPkgVersion);- expect(process.env[APP_VERSION_ENV_VAR]).toBe(appPkgVersion);+ expect(returned).toBe(stamped.version);+ expect(process.env[APP_VERSION_ENV_VAR]).toBe(stamped.version);});});@@ -74,6 +83,12 @@ describe('build-path version injection', () => {afterEach(() => vi.unstubAllEnvs());test('vite.config.ts injects the app package version while loading', async () => {+ const actualFs = await vi.importActual<typeof import('node:fs')>('node:fs');+ const committed = (+ JSON.parse(actualFs.readFileSync(resolve(here, '..', '..', 'package.json'), 'utf-8')) as {+ version: string;+ }+ ).version;const configPath = resolve(here, '../..', 'vite.config.ts');vi.stubEnv(APP_VERSION_ENV_VAR, undefined);vi.stubEnv('LINGUI_CONFIG', undefined);@@ -83,6 +98,6 @@ describe('build-path version injection', () => {dirname(configPath),);expect(result).not.toBeNull();- expect(process.env[APP_VERSION_ENV_VAR]).toBe(appPkgVersion);+ expect(process.env[APP_VERSION_ENV_VAR]).toBe(committed);});});diff --git a/packages/server/src/version-constants.test.ts b/packages/server/src/version-constants.test.tsindex 594a5fa9a..614ad9bf0 100644--- a/packages/server/src/version-constants.test.ts+++ b/packages/server/src/version-constants.test.ts@@ -1,8 +1,22 @@-import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';+import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';import { tmpdir } from 'node:os';import { join } from 'node:path';import { CLIENT_RUNTIME_VERSION_FALLBACK } from '@inkeep/open-knowledge-core';-import { describe, expect, test } from 'vitest';+import { describe, expect, test, vi } from 'vitest';++const stamped = vi.hoisted(() => ({ version: '9.8.7-stamped.1' }));++vi.mock('node:fs', async (importOriginal) => {+ const actual = await importOriginal<typeof import('node:fs')>();+ const { fileURLToPath: toPath } = await import('node:url');+ const serverPackageJson = toPath(new URL('../package.json', import.meta.url));+ const readFileSync = ((path: Parameters<typeof actual.readFileSync>[0], ...rest: unknown[]) =>+ String(path) === serverPackageJson+ ? JSON.stringify({ name: '@inkeep/open-knowledge-server', version: stamped.version })+ : Reflect.apply(actual.readFileSync, actual, [path, ...rest])) as typeof actual.readFileSync;+ return { ...actual, readFileSync };+});+import {PROTOCOL_VERSION,RUNTIME_VERSION,@@ -11,15 +25,17 @@ import {} from './version-constants.ts';describe('version-constants', () => {- test('RUNTIME_VERSION is the version field of the neighbouring package.json', () => {- const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8')) as {- version: string;- };- expect(RUNTIME_VERSION).toBe(pkg.version);+ test('RUNTIME_VERSION and the default readRuntimeVersion read the package.json beside src', () => {+ expect(RUNTIME_VERSION).toBe(stamped.version);+ expect(readRuntimeVersion()).toBe(stamped.version);});- test('a source checkout carries the unknown placeholder, which clients read as indeterminate', () => {- expect(RUNTIME_VERSION).toBe(CLIENT_RUNTIME_VERSION_FALLBACK);+ test('a source checkout carries the unknown placeholder, which clients read as indeterminate', async () => {+ const actualFs = await vi.importActual<typeof import('node:fs')>('node:fs');+ const committed = JSON.parse(+ actualFs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'),+ ) as { version: string };+ expect(committed.version).toBe(CLIENT_RUNTIME_VERSION_FALLBACK);});test('readRuntimeVersion reads a stamped version and falls back when the file is missing or unversioned', () => {