refactor(flags): migrate skip migrations flag (#27705)
This commit is contained in:
@@ -29,6 +29,7 @@ describe("RuntimeFlags", () => {
|
||||
OPENCODE_DISABLE_EMBEDDED_WEB_UI: "true",
|
||||
OPENCODE_DISABLE_EXTERNAL_SKILLS: "true",
|
||||
OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
|
||||
OPENCODE_SKIP_MIGRATIONS: "true",
|
||||
OPENCODE_EXPERIMENTAL: "true",
|
||||
OPENCODE_ENABLE_EXA: "true",
|
||||
OPENCODE_ENABLE_PARALLEL: "true",
|
||||
@@ -46,6 +47,7 @@ describe("RuntimeFlags", () => {
|
||||
expect(flags.disableEmbeddedWebUi).toBe(true)
|
||||
expect(flags.disableExternalSkills).toBe(true)
|
||||
expect(flags.disableLspDownload).toBe(true)
|
||||
expect(flags.skipMigrations).toBe(true)
|
||||
expect(flags.disableClaudeCodePrompt).toBe(false)
|
||||
expect(flags.enableExa).toBe(true)
|
||||
expect(flags.enableParallel).toBe(true)
|
||||
@@ -91,6 +93,7 @@ describe("RuntimeFlags", () => {
|
||||
expect(flags.disableEmbeddedWebUi).toBe(false)
|
||||
expect(flags.disableExternalSkills).toBe(false)
|
||||
expect(flags.disableLspDownload).toBe(false)
|
||||
expect(flags.skipMigrations).toBe(false)
|
||||
expect(flags.disableClaudeCodePrompt).toBe(false)
|
||||
expect(flags.disableClaudeCodeSkills).toBe(false)
|
||||
expect(flags.enableExa).toBe(false)
|
||||
@@ -143,6 +146,22 @@ describe("RuntimeFlags", () => {
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("skipMigrations defaults to false", () =>
|
||||
Effect.gen(function* () {
|
||||
const flags = yield* readFlags.pipe(Effect.provide(fromConfig({})))
|
||||
|
||||
expect(flags.skipMigrations).toBe(false)
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("skipMigrations reads OPENCODE_SKIP_MIGRATIONS", () =>
|
||||
Effect.gen(function* () {
|
||||
const flags = yield* readFlags.pipe(Effect.provide(fromConfig({ OPENCODE_SKIP_MIGRATIONS: "true" })))
|
||||
|
||||
expect(flags.skipMigrations).toBe(true)
|
||||
}),
|
||||
)
|
||||
|
||||
it.effect("disableClaudeCodePrompt defaults to false", () =>
|
||||
Effect.gen(function* () {
|
||||
const flags = yield* readFlags.pipe(Effect.provide(fromConfig({})))
|
||||
@@ -288,6 +307,7 @@ describe("RuntimeFlags", () => {
|
||||
OPENCODE_DISABLE_DEFAULT_PLUGINS: "true",
|
||||
OPENCODE_DISABLE_EXTERNAL_SKILLS: "true",
|
||||
OPENCODE_DISABLE_LSP_DOWNLOAD: "true",
|
||||
OPENCODE_SKIP_MIGRATIONS: "true",
|
||||
OPENCODE_EXPERIMENTAL: "true",
|
||||
OPENCODE_ENABLE_EXA: "true",
|
||||
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS: "1234",
|
||||
@@ -303,6 +323,7 @@ describe("RuntimeFlags", () => {
|
||||
expect(flags.disableEmbeddedWebUi).toBe(false)
|
||||
expect(flags.disableExternalSkills).toBe(false)
|
||||
expect(flags.disableLspDownload).toBe(false)
|
||||
expect(flags.skipMigrations).toBe(false)
|
||||
expect(flags.disableClaudeCodePrompt).toBe(false)
|
||||
expect(flags.disableClaudeCodeSkills).toBe(false)
|
||||
expect(flags.enableExa).toBe(false)
|
||||
|
||||
@@ -26,4 +26,13 @@ describe("Database.getChannelPath", () => {
|
||||
expect(Database.getChannelPath(flags)).toBe(path.join(Global.Path.data, "opencode.db"))
|
||||
}).pipe(Effect.provide(RuntimeFlags.layer({ disableChannelDb: true }))),
|
||||
)
|
||||
|
||||
it.effect("accepts RuntimeFlags with skipMigrations for database callers", () =>
|
||||
Effect.gen(function* () {
|
||||
const flags = yield* RuntimeFlags.Service
|
||||
|
||||
expect(flags.skipMigrations).toBe(true)
|
||||
expect(Database.getChannelPath(flags)).toBe(Database.getChannelPath({ disableChannelDb: flags.disableChannelDb }))
|
||||
}).pipe(Effect.provide(RuntimeFlags.layer({ skipMigrations: true }))),
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user