GeezerVison is showing github.com — fix: restore recent test regressions and upgrade effect beta (#18158) · HashNuke/opencode@5d2f8d7
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: bun.lock +10-7Lines changed: 10 additions & 7 deletions Collapse file Copy file name to clipboardExpand all lines: package.json +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 25 | 25 | "packages/slack" | 26 | 26 | ], | 27 | 27 | "catalog": { | | 28 | + "@effect/platform-node": "4.0.0-beta.35", | 28 | 29 | "@types/bun": "1.3.9", | 29 | 30 | "@octokit/rest": "22.0.0", | 30 | 31 | "@hono/zod-validator": "0.4.2", | | 44 | 45 | "dompurify": "3.3.1", | 45 | 46 | "drizzle-kit": "1.0.0-beta.16-ea816b6", | 46 | 47 | "drizzle-orm": "1.0.0-beta.16-ea816b6", | 47 | | - "effect": "4.0.0-beta.31", | | 48 | + "effect": "4.0.0-beta.35", | 48 | 49 | "ai": "5.0.124", | 49 | 50 | "hono": "4.10.7", | 50 | 51 | "hono-openapi": "1.1.2", | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/e2e/prompt/prompt-multiline.spec.ts +12-6Lines changed: 12 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -7,12 +7,18 @@ test("shift+enter inserts a newline without submitting", async ({ page, gotoSess | 7 | 7 | await expect(page).toHaveURL(/\/session\/?$/) | 8 | 8 |
| 9 | 9 | const prompt = page.locator(promptSelector) | 10 | | - await prompt.click() | 11 | | - await page.keyboard.type("line one") | 12 | | - await page.keyboard.press("Shift+Enter") | 13 | | - await page.keyboard.type("line two") | | 10 | + await prompt.focus() | | 11 | + await expect(prompt).toBeFocused() | | 12 | + | | 13 | + await prompt.pressSequentially("line one") | | 14 | + await expect(prompt).toBeFocused() | | 15 | + | | 16 | + await prompt.press("Shift+Enter") | | 17 | + await expect(page).toHaveURL(/\/session\/?$/) | | 18 | + await expect(prompt).toBeFocused() | | 19 | + | | 20 | + await prompt.pressSequentially("line two") | 14 | 21 |
| 15 | 22 | await expect(page).toHaveURL(/\/session\/?$/) | 16 | | - await expect(prompt).toContainText("line one") | 17 | | - await expect(prompt).toContainText("line two") | | 23 | + await expect.poll(() => prompt.evaluate((el) => el.innerText)).toBe("line one\nline two") | 18 | 24 | }) |
Collapse file Copy file name to clipboardExpand all lines: packages/app/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 56 | 56 | "@solidjs/router": "catalog:", | 57 | 57 | "@thisbeyond/solid-dnd": "0.7.5", | 58 | 58 | "diff": "catalog:", | 59 | | - "effect": "4.0.0-beta.31", | | 59 | + "effect": "catalog:", | 60 | 60 | "fuzzysort": "catalog:", | 61 | 61 | "ghostty-web": "github:anomalyco/ghostty-web#main", | 62 | 62 | "luxon": "catalog:", | |
Collapse file Copy file name to clipboardExpand all lines: packages/app/src/pages/layout.tsx +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -566,6 +566,7 @@ export default function Layout(props: ParentProps) { | 566 | 566 | const [autoselecting] = createResource(async () => { | 567 | 567 | await ready.promise | 568 | 568 | await layout.ready.promise | | 569 | + if (!untrack(() => state.autoselect)) return | 569 | 570 |
| 570 | 571 | const list = layout.projects.list() | 571 | 572 | const last = server.projects.last() | |
Collapse file Copy file name to clipboardExpand all lines: packages/desktop-electron/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 30 | 30 | "@solid-primitives/storage": "catalog:", | 31 | 31 | "@solidjs/meta": "catalog:", | 32 | 32 | "@solidjs/router": "0.15.4", | 33 | | - "effect": "4.0.0-beta.31", | | 33 | + "effect": "catalog:", | 34 | 34 | "electron-log": "^5", | 35 | 35 | "electron-store": "^10", | 36 | 36 | "electron-updater": "^6", | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 82 | 82 | "@ai-sdk/xai": "2.0.51", | 83 | 83 | "@aws-sdk/credential-providers": "3.993.0", | 84 | 84 | "@clack/prompts": "1.0.0-alpha.1", | 85 | | - "@effect/platform-node": "4.0.0-beta.31", | 86 | 85 | "@gitlab/gitlab-ai-provider": "3.6.0", | 87 | 86 | "@gitlab/opencode-gitlab-auth": "1.3.3", | 88 | 87 | "@hono/standard-validator": "0.1.5", | | 98 | 97 | "@openrouter/ai-sdk-provider": "1.5.4", | 99 | 98 | "@opentui/core": "0.1.87", | 100 | 99 | "@opentui/solid": "0.1.87", | | 100 | + "@effect/platform-node": "catalog:", | 101 | 101 | "@parcel/watcher": "2.5.1", | 102 | 102 | "@pierre/diffs": "catalog:", | 103 | 103 | "@solid-primitives/event-bus": "1.1.2", | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/file/watcher.ts +8-1Lines changed: 8 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -51,6 +51,13 @@ export namespace FileWatcher { | 51 | 51 | if (process.platform === "linux") return "inotify" | 52 | 52 | } | 53 | 53 |
| | 54 | + function protecteds(dir: string) { | | 55 | + return Protected.paths().filter((item) => { | | 56 | + const rel = path.relative(dir, item) | | 57 | + return rel !== "" && !rel.startsWith("..") && !path.isAbsolute(rel) | | 58 | + }) | | 59 | + } | | 60 | + | 54 | 61 | export const hasNativeBinding = () => !!watcher() | 55 | 62 |
| 56 | 63 | export class Service extends ServiceMap.Service<Service, {}>()("@opencode/FileWatcher") {} | @@ -105,7 +112,7 @@ export namespace FileWatcher { | 105 | 112 | const cfgIgnores = cfg.watcher?.ignore ?? [] | 106 | 113 |
| 107 | 114 | if (yield* Flag.OPENCODE_EXPERIMENTAL_FILEWATCHER) { | 108 | | - yield* subscribe(instance.directory, [...FileIgnore.PATTERNS, ...cfgIgnores, ...Protected.paths()]) | | 115 | + yield* subscribe(instance.directory, [...FileIgnore.PATTERNS, ...cfgIgnores, ...protecteds(instance.directory)]) | 109 | 116 | } | 110 | 117 |
| 111 | 118 | if (instance.project.vcs === "git") { | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/src/util/process.ts +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -98,6 +98,7 @@ export namespace Process { | 98 | 98 | reject(error) | 99 | 99 | }) | 100 | 100 | }) | | 101 | + void exited.catch(() => undefined) | 101 | 102 |
| 102 | 103 | if (opts.abort) { | 103 | 104 | opts.abort.addEventListener("abort", abort, { once: true }) | |
Collapse file Copy file name to clipboardExpand all lines: packages/opencode/test/file/watcher.test.ts +26-28Lines changed: 26 additions & 28 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { $ } from "bun" | 2 | 2 | import { afterEach, describe, expect, test } from "bun:test" | 3 | 3 | import fs from "fs/promises" | 4 | 4 | import path from "path" | 5 | | -import { Deferred, Effect, Fiber, Option } from "effect" | | 5 | +import { Deferred, Effect, Option } from "effect" | 6 | 6 | import { tmpdir } from "../fixture/fixture" | 7 | 7 | import { watcherConfigLayer, withServices } from "../fixture/instance" | 8 | 8 | import { FileWatcher } from "../../src/file/watcher" | @@ -25,6 +25,7 @@ function withWatcher<E>(directory: string, body: Effect.Effect<void, E>) { | 25 | 25 | directory, | 26 | 26 | FileWatcher.layer, | 27 | 27 | async (rt) => { | | 28 | + await rt.runPromise(FileWatcher.Service.use(() => Effect.void)) | 28 | 29 | await Effect.runPromise(ready(directory)) | 29 | 30 | await Effect.runPromise(body) | 30 | 31 | }, | @@ -54,24 +55,29 @@ function listen(directory: string, check: (evt: WatcherEvent) => boolean, hit: ( | 54 | 55 | } | 55 | 56 |
| 56 | 57 | function wait(directory: string, check: (evt: WatcherEvent) => boolean) { | 57 | | - return Effect.callback<WatcherEvent>((resume) => { | 58 | | - const cleanup = listen(directory, check, (evt) => { | 59 | | - cleanup() | 60 | | - resume(Effect.succeed(evt)) | | 58 | + return Effect.gen(function* () { | | 59 | + const deferred = yield* Deferred.make<WatcherEvent>() | | 60 | + const cleanup = yield* Effect.sync(() => { | | 61 | + let off = () => {} | | 62 | + off = listen(directory, check, (evt) => { | | 63 | + off() | | 64 | + Deferred.doneUnsafe(deferred, Effect.succeed(evt)) | | 65 | + }) | | 66 | + return off | 61 | 67 | }) | 62 | | - return Effect.sync(cleanup) | 63 | | - }).pipe(Effect.timeout("5 seconds")) | | 68 | + return { cleanup, deferred } | | 69 | + }) | 64 | 70 | } | 65 | 71 |
| 66 | 72 | function nextUpdate<E>(directory: string, check: (evt: WatcherEvent) => boolean, trigger: Effect.Effect<void, E>) { | 67 | 73 | return Effect.acquireUseRelease( | 68 | | - wait(directory, check).pipe(Effect.forkChild({ startImmediately: true })), | 69 | | - (fiber) => | | 74 | + wait(directory, check), | | 75 | + ({ deferred }) => | 70 | 76 | Effect.gen(function* () { | 71 | 77 | yield* trigger | 72 | | - return yield* Fiber.join(fiber) | | 78 | + return yield* Deferred.await(deferred).pipe(Effect.timeout("5 seconds")) | 73 | 79 | }), | 74 | | - Fiber.interrupt, | | 80 | + ({ cleanup }) => Effect.sync(cleanup), | 75 | 81 | ) | 76 | 82 | } | 77 | 83 |
| @@ -82,23 +88,15 @@ function noUpdate<E>( | 82 | 88 | trigger: Effect.Effect<void, E>, | 83 | 89 | ms = 500, | 84 | 90 | ) { | 85 | | - return Effect.gen(function* () { | 86 | | - const deferred = yield* Deferred.make<WatcherEvent>() | 87 | | - | 88 | | - yield* Effect.acquireUseRelease( | 89 | | - Effect.sync(() => | 90 | | - listen(directory, check, (evt) => { | 91 | | - Effect.runSync(Deferred.succeed(deferred, evt)) | 92 | | - }), | 93 | | - ), | 94 | | - () => | 95 | | - Effect.gen(function* () { | 96 | | - yield* trigger | 97 | | - expect(yield* Deferred.await(deferred).pipe(Effect.timeoutOption(`${ms} millis`))).toEqual(Option.none()) | 98 | | - }), | 99 | | - (cleanup) => Effect.sync(cleanup), | 100 | | - ) | 101 | | - }) | | 91 | + return Effect.acquireUseRelease( | | 92 | + wait(directory, check), | | 93 | + ({ deferred }) => | | 94 | + Effect.gen(function* () { | | 95 | + yield* trigger | | 96 | + expect(yield* Deferred.await(deferred).pipe(Effect.timeoutOption(`${ms} millis`))).toEqual(Option.none()) | | 97 | + }), | | 98 | + ({ cleanup }) => Effect.sync(cleanup), | | 99 | + ) | 102 | 100 | } | 103 | 101 |
| 104 | 102 | function ready(directory: string) { | |
|