-
Notifications
You must be signed in to change notification settings - Fork 3.8k
v0.9.4: db contention fixes, databricks genie, snowflake cortex, additional search connectors #8356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
48a13cb
improvement(knowledge): scan processing recovery per connector and pr…
waleedlatif1 5a69768
improvement(chat): stop reloading the full transcript on every turn a…
waleedlatif1 185650f
improvement(knowledge): maintain keyword projections only for search …
waleedlatif1 3945364
improvement(db): tag advisory lock statements by caller (#8331)
waleedlatif1 10282f2
improvement(billing): share the enterprise reporting usage read acros…
waleedlatif1 ce88d8a
fix(files): stop saving fetched URLs to Files and look names up by th…
waleedlatif1 e625a4c
fix(knowledge): count documents through the reader's access and only …
waleedlatif1 5b667d7
fix(api): prevent caching authenticated workflow variables (#8339)
waleedlatif1 d9b9e1d
fix(copilot): bound agent CLI grep matching (#8338)
waleedlatif1 7a36d74
fix(slack-search): stop recovered tool failures from flagging the who…
TheodoreSpeaks ec0f474
fix(api): constrain workflow response headers (#8341)
waleedlatif1 65af161
improvement(db): drop unusable date slot and redundant prefix indexes…
waleedlatif1 c2cce49
feat(databricks): add Genie agent operations to the Databricks block …
waleedlatif1 954012c
fix(execution): bound reference and context processing (#8344)
waleedlatif1 affbc6d
fix(desktop): wait for native update staging and verify installation …
waleedlatif1 c479a5a
improvement(knowledge): serve date tag filters from an index (#8348)
waleedlatif1 045788f
feat(snowflake): add Cortex Analyst operations to the Snowflake block…
waleedlatif1 6a6a882
feat(search): expand live providers and discussion reads (#8340)
waleedlatif1 eeaa57b
improvement(knowledge): walk connector reconciliation by id so seen s…
waleedlatif1 bccc722
fix(chat): use hostname brand icons for inline sources (#8350)
waleedlatif1 2aed9b5
feat(chat): add shared find menu (#8351)
waleedlatif1 5c446f1
fix(function): omit oversized display code instead of failing the exe…
waleedlatif1 bf2594c
fix(search): validate Notion search terms before dispatch (#8358)
waleedlatif1 e1124ff
fix(search): let cancelled live reads stop instead of reporting parti…
waleedlatif1 4fe45a0
fix(billing): key the usage email claim on the exact period start and…
waleedlatif1 635d275
fix(chat): keep find stable across footnotes and pending chats, and m…
waleedlatif1 3896437
fix(databricks): send workspace tokens only to Databricks workspace h…
waleedlatif1 a763b4a
test(knowledge): accept either ordered index in the scale window chec…
waleedlatif1 9070d1b
refactor(db): require a transaction for advisory lock helpers (#8364)
waleedlatif1 dbeb732
fix(knowledge): resume the member resurrection walk from a persisted …
waleedlatif1 8f3eb3a
fix(search): validate a new provider server before the approval trans…
waleedlatif1 a657493
fix(knowledge): serve list totals when a request omits the count flag…
waleedlatif1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| import { writeFileSync } from 'node:fs' | ||
| import { homedir } from 'node:os' | ||
| import { join, relative } from 'node:path' | ||
| import type { DesktopUpdateState } from '@sim/desktop-bridge' | ||
| import { app, autoUpdater as nativeUpdater, net } from 'electron' | ||
| import { MacUpdater } from 'electron-updater' | ||
| import { initUpdater } from '@/main/updater' | ||
|
|
||
| declare global { | ||
| var desktopUpdaterFixture: { | ||
| check(): void | ||
| install(): void | ||
| finishStaging(): void | ||
| failStaging(): void | ||
| read(): { | ||
| state: DesktopUpdateState | ||
| nativeArchive: string | null | ||
| installed: string[] | ||
| events: { name: string; data: unknown }[] | ||
| } | ||
| } | ||
| } | ||
|
|
||
| const directory = process.env.SIM_UPDATER_FIXTURE_DIR | ||
| const origin = process.env.SIM_UPDATER_FIXTURE_ORIGIN | ||
| if (!directory || !origin) throw new Error('Updater fixture configuration is missing') | ||
| app.setPath('userData', join(directory, 'user-data')) | ||
|
|
||
| void app.whenReady().then(() => { | ||
| const configPath = join(directory, 'updater.yml') | ||
| const cache = relative(join(homedir(), 'Library', 'Caches'), join(directory, 'cache')) | ||
| writeFileSync(configPath, `updaterCacheDirName: ${JSON.stringify(cache)}\n`) | ||
|
|
||
| let feed: Electron.FeedURLOptions | undefined | ||
| let nativeArchive: string | null = null | ||
| const installed: string[] = [] | ||
| const events: { name: string; data: unknown }[] = [] | ||
|
|
||
| /** Native verification and installation are simulated; MacUpdater and both HTTP transfers run. */ | ||
| nativeUpdater.setFeedURL = (options) => { | ||
| feed = options | ||
| nativeArchive = null | ||
| } | ||
| nativeUpdater.checkForUpdates = () => { | ||
| void (async () => { | ||
| if (!feed) throw new Error('Native feed was not configured') | ||
| const response = await net.fetch(feed.url, { headers: feed.headers }) | ||
| const manifest: { url: string } = await response.json() | ||
| const archive = await net.fetch(manifest.url) | ||
| nativeArchive = await archive.text() | ||
| })().catch((error) => nativeUpdater.emit('error', error)) | ||
| } | ||
| nativeUpdater.quitAndInstall = () => { | ||
| if (nativeArchive === null) throw new Error('Cannot install before native staging') | ||
| installed.push(nativeArchive) | ||
| } | ||
|
|
||
| const updater = new MacUpdater() | ||
| updater.forceDevUpdateConfig = true | ||
| updater.disableDifferentialDownload = true | ||
| updater.updateConfigPath = configPath | ||
| updater.setFeedURL({ provider: 'generic', url: origin }) | ||
| const handle = initUpdater({ | ||
| getWindow: () => null, | ||
| events: { filePath: '', record: (name, data) => events.push({ name, data }) }, | ||
| appOrigin: () => origin, | ||
| loadAutoUpdater: () => updater, | ||
| canSelfUpdate: async () => true, | ||
| probeOriginFeed: async () => false, | ||
| installStatePath: join(directory, 'update-install.json'), | ||
| }) | ||
|
|
||
| globalThis.desktopUpdaterFixture = { | ||
| check: () => handle.check(), | ||
| install: () => handle.install(), | ||
| finishStaging: () => { | ||
| if (nativeArchive === null) throw new Error('Native transfer has not finished') | ||
| nativeUpdater.emit('update-downloaded', {}, '', nativeArchive, new Date(), '') | ||
| }, | ||
| failStaging: () => nativeUpdater.emit('error', new Error('Native verification failed')), | ||
| read: () => ({ state: handle.getState(), nativeArchive, installed, events }), | ||
| } | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,209 @@ | ||
| import { createHash } from 'node:crypto' | ||
| import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' | ||
| import { createServer } from 'node:http' | ||
| import { tmpdir } from 'node:os' | ||
| import { dirname, join } from 'node:path' | ||
| import { fileURLToPath } from 'node:url' | ||
| import { _electron as electron, expect, test } from '@playwright/test' | ||
| import { getErrorMessage } from '@sim/utils/errors' | ||
| import { build } from 'esbuild' | ||
|
|
||
| const DESKTOP_DIR = fileURLToPath(new URL('..', import.meta.url)) | ||
|
|
||
| test('the real MacUpdater waits for native staging, replaces old builds, and retries failed staging', async () => { | ||
| test.skip(process.platform !== 'darwin', 'Squirrel.Mac lifecycle') | ||
| const directory = mkdtempSync(join(tmpdir(), 'sim-updater-e2e-')) | ||
| const reportPath = | ||
| process.env.DESKTOP_UPDATER_REPORT_PATH ?? test.info().outputPath('updater.json') | ||
| let app: Awaited<ReturnType<typeof electron.launch>> | undefined | ||
| let offeredVersion = '2.0.0' | ||
| const requests: { path: string; status: number }[] = [] | ||
| const checks: { | ||
| name: string | ||
| status: 'passed' | 'failed' | ||
| durationMs: number | ||
| error?: string | ||
| }[] = [] | ||
| const check = async (name: string, run: () => Promise<void>) => { | ||
| const started = Date.now() | ||
| try { | ||
| await run() | ||
| checks.push({ name, status: 'passed', durationMs: Date.now() - started }) | ||
| } catch (error) { | ||
| checks.push({ | ||
| name, | ||
| status: 'failed', | ||
| durationMs: Date.now() - started, | ||
| error: getErrorMessage(error), | ||
| }) | ||
| throw error | ||
| } | ||
| } | ||
| let snapshot: unknown | ||
| const server = createServer((request, response) => { | ||
| const path = new URL(request.url ?? '/', 'http://127.0.0.1').pathname | ||
| requests.push({ path, status: 200 }) | ||
| if (path === '/latest-mac.yml') { | ||
| const archive = Buffer.from(offeredVersion) | ||
| response.end( | ||
| `version: ${offeredVersion}\nfiles:\n - url: Sim-${offeredVersion}-universal.zip\n sha512: ${createHash('sha512').update(archive).digest('base64')}\n size: ${archive.length}\n` | ||
| ) | ||
| } else { | ||
| response.end(/^\/Sim-(.+)-universal.zip$/.exec(path)?.[1] ?? '') | ||
| } | ||
| }) | ||
|
|
||
| try { | ||
| await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve)) | ||
| const address = server.address() | ||
| if (!address || typeof address === 'string') throw new Error('Missing fixture address') | ||
| mkdirSync(join(directory, 'user-data')) | ||
| writeFileSync( | ||
| join(directory, 'package.json'), | ||
| JSON.stringify({ name: 'sim-updater-fixture', version: '1.0.0', main: 'main.cjs' }) | ||
| ) | ||
| await build({ | ||
| entryPoints: [join(DESKTOP_DIR, 'e2e/fixtures/updater.ts')], | ||
| outfile: join(directory, 'main.cjs'), | ||
| bundle: true, | ||
| platform: 'node', | ||
| format: 'cjs', | ||
| external: ['electron'], | ||
| tsconfig: join(DESKTOP_DIR, 'tsconfig.json'), | ||
| plugins: [ | ||
| { | ||
| name: 'approve-fixture-restart', | ||
| setup(builder) { | ||
| builder.onResolve({ filter: /^@\/main\/dialogs$/ }, () => ({ | ||
| path: 'dialog', | ||
| namespace: 'fixture', | ||
| })) | ||
| builder.onLoad({ filter: /.*/, namespace: 'fixture' }, () => ({ | ||
| contents: | ||
| 'export async function showShellDialog() { return { response: 1, checkboxChecked: false } }', | ||
| })) | ||
| }, | ||
| }, | ||
| ], | ||
| }) | ||
| app = await electron.launch({ | ||
| args: [directory, '--use-mock-keychain'], | ||
| env: { | ||
| ...process.env, | ||
| SIM_UPDATER_FIXTURE_DIR: directory, | ||
| SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`, | ||
| }, | ||
| }) | ||
| const shell = app | ||
| const read = () => shell.evaluate(() => globalThis.desktopUpdaterFixture.read()) | ||
| await expect | ||
| .poll(() => shell.evaluate(() => Boolean(globalThis.desktopUpdaterFixture))) | ||
| .toBe(true) | ||
|
|
||
| await check('first download waits for native staging', async () => { | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.check()) | ||
| await expect.poll(async () => (await read()).nativeArchive).toBe('2.0.0') | ||
| expect((await read()).state).toEqual({ | ||
| status: 'downloading', | ||
| version: '2.0.0', | ||
| percent: 100, | ||
| }) | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.install()) | ||
| expect((await read()).installed).toEqual([]) | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.finishStaging()) | ||
| expect((await read()).state).toEqual({ status: 'ready', version: '2.0.0' }) | ||
| }) | ||
|
|
||
| await check('replacement cannot restart into stale native update', async () => { | ||
| offeredVersion = '2.1.0' | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.check()) | ||
| await expect.poll(async () => (await read()).nativeArchive).toBe('2.1.0') | ||
| expect((await read()).state).toEqual({ | ||
| status: 'downloading', | ||
| version: '2.1.0', | ||
| percent: 100, | ||
| }) | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.install()) | ||
| expect((await read()).installed).toEqual([]) | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.failStaging()) | ||
| expect((await read()).state).toEqual({ status: 'error', version: '2.1.0' }) | ||
| }) | ||
|
|
||
| await check('cached retry installs only the verified replacement', async () => { | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.check()) | ||
| await expect | ||
| .poll(async () => (await read()).state) | ||
| .toEqual({ status: 'downloading', version: '2.1.0', percent: 100 }) | ||
| await expect.poll(async () => (await read()).nativeArchive).toBe('2.1.0') | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.finishStaging()) | ||
| expect((await read()).state).toEqual({ status: 'ready', version: '2.1.0' }) | ||
| await shell.evaluate(() => globalThis.desktopUpdaterFixture.install()) | ||
| await expect.poll(async () => (await read()).installed).toEqual(['2.1.0']) | ||
| }) | ||
| snapshot = await read() | ||
| await check( | ||
| 'the next process distinguishes an incomplete update from a successful install', | ||
| async () => { | ||
| const checkpoint = readFileSync(join(directory, 'update-install.json'), 'utf8') | ||
| await app?.close() | ||
| app = await electron.launch({ | ||
| args: [directory, '--use-mock-keychain'], | ||
| env: { | ||
| ...process.env, | ||
| SIM_UPDATER_FIXTURE_DIR: directory, | ||
| SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`, | ||
| }, | ||
| }) | ||
| await expect | ||
| .poll(() => app?.evaluate(() => globalThis.desktopUpdaterFixture?.read().events)) | ||
| .toContainEqual({ | ||
| name: 'update_install_result', | ||
| data: { expected: '2.1.0', installed: '1.0.0', success: false }, | ||
| }) | ||
| await app.close() | ||
| writeFileSync(join(directory, 'update-install.json'), checkpoint) | ||
| writeFileSync( | ||
| join(directory, 'package.json'), | ||
| JSON.stringify({ name: 'sim-updater-fixture', version: '2.1.0', main: 'main.cjs' }) | ||
| ) | ||
| app = await electron.launch({ | ||
| args: [directory, '--use-mock-keychain'], | ||
| env: { | ||
| ...process.env, | ||
| SIM_UPDATER_FIXTURE_DIR: directory, | ||
| SIM_UPDATER_FIXTURE_ORIGIN: `http://127.0.0.1:${address.port}`, | ||
| }, | ||
| }) | ||
| await expect | ||
| .poll(() => app?.evaluate(() => globalThis.desktopUpdaterFixture?.read().events)) | ||
| .toContainEqual({ | ||
| name: 'update_install_result', | ||
| data: { expected: '2.1.0', installed: '2.1.0', success: true }, | ||
| }) | ||
| } | ||
| ) | ||
| } finally { | ||
| if (!snapshot && app) | ||
| snapshot = await app | ||
| .evaluate(() => globalThis.desktopUpdaterFixture?.read()) | ||
| .catch(() => undefined) | ||
| mkdirSync(dirname(reportPath), { recursive: true }) | ||
| writeFileSync( | ||
| reportPath, | ||
| JSON.stringify( | ||
| { | ||
| passed: checks.length === 4 && checks.every((check) => check.status === 'passed'), | ||
| checks, | ||
| requests, | ||
| snapshot, | ||
| }, | ||
| null, | ||
| 2 | ||
| ) | ||
| ) | ||
| await app?.close() | ||
| server.closeAllConnections() | ||
| await new Promise<void>((resolve) => server.close(() => resolve())) | ||
| rmSync(directory, { recursive: true, force: true }) | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.