chore(opencode): move the pinned OpenCode version to 2.1.2

The supported floor is derived from the pin, so this raises the accepted
range to >=2.1.2 <3.0.0 for the bundled image, managed installs, and the
version check that gates startup.

- Dockerfile ARG OPENCODE_VERSION and the shared pin move together
- CI e2e installs 2.1.2 instead of 2.0.24
- contract, installer, manager, registry and settings fixtures follow the new
  floor, keeping their below-floor and wrong-major rejection cases
This commit is contained in:
Chris Scott committed 2026-10-23 14:41:48 -04:00
1 parent 36a5693b5c
commit 19b52ecd58
9 files changed
+191 -189

No files matched your search

+22 -20
View File
@@ -46,56 +46,58 @@ function createFetchSpy() {
describe('OpenCode v2 contract', () => {
describe('version policy', () => {
it('pins the client version, derives the floor from it and fixes the V2 server username', () => {
expect(OPENCODE_PINNED_VERSION).toBe('2.0.15')
expect(OPENCODE_SUPPORTED_VERSION_RANGE).toBe('>=2.0.15 <3.0.0')
expect(OPENCODE_PINNED_VERSION).toBe('2.1.2')
expect(OPENCODE_SUPPORTED_VERSION_RANGE).toBe('>=2.1.2 <3.0.0')
expect(OPENCODE_SERVER_USERNAME).toBe('opencode')
})
it('accepts releases of the pinned major at or above the pin and rejects everything else', () => {
expect(isSupportedOpenCodeVersion('1.18.32')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.0')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.14')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15')).toBe(true)
expect(isSupportedOpenCodeVersion('2.0.16')).toBe(true)
expect(isSupportedOpenCodeVersion('2.1.0')).toBe(true)
expect(isSupportedOpenCodeVersion('v2.0.15')).toBe(true)
expect(isSupportedOpenCodeVersion(' v2.0.15 ')).toBe(true)
expect(isSupportedOpenCodeVersion('2.0.15')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.0')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.1')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2')).toBe(true)
expect(isSupportedOpenCodeVersion('2.1.3')).toBe(true)
expect(isSupportedOpenCodeVersion('2.2.0')).toBe(true)
expect(isSupportedOpenCodeVersion('v2.1.2')).toBe(true)
expect(isSupportedOpenCodeVersion(' v2.1.2 ')).toBe(true)
expect(isSupportedOpenCodeVersion('3.0.0')).toBe(false)
expect(isSupportedOpenCodeVersion('3.1.0')).toBe(false)
expect(isSupportedOpenCodeVersion('not-a-version')).toBe(false)
})
it('rejects prereleases of the pinned version', () => {
expect(isSupportedOpenCodeVersion('2.0.15-alpha.1')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15-alpha')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15-rc.1+build.5')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15-0')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2-alpha.1')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2-alpha')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2-rc.1+build.5')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2-0')).toBe(false)
})
it('accepts prereleases of higher numeric cores within the pinned major', () => {
expect(isSupportedOpenCodeVersion('2.1.0-beta.1')).toBe(true)
expect(isSupportedOpenCodeVersion('2.0.16-rc.2')).toBe(true)
expect(isSupportedOpenCodeVersion('2.2.0-beta.1')).toBe(true)
expect(isSupportedOpenCodeVersion('2.1.3-rc.2')).toBe(true)
expect(isSupportedOpenCodeVersion('3.0.0-beta.1')).toBe(false)
})
it('ignores build metadata for precedence', () => {
expect(isSupportedOpenCodeVersion('2.0.15+build')).toBe(true)
expect(isSupportedOpenCodeVersion('2.0.15+2.0.0')).toBe(true)
expect(isSupportedOpenCodeVersion('2.1.2+build')).toBe(true)
expect(isSupportedOpenCodeVersion('2.1.2+2.0.0')).toBe(true)
})
it('rejects malformed and incomplete versions', () => {
expect(isSupportedOpenCodeVersion('2garbage')).toBe(false)
expect(isSupportedOpenCodeVersion('2')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15.1')).toBe(false)
expect(isSupportedOpenCodeVersion('02.0.15')).toBe(false)
expect(isSupportedOpenCodeVersion('2.0.15-alpha..1')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2.1')).toBe(false)
expect(isSupportedOpenCodeVersion('02.1.2')).toBe(false)
expect(isSupportedOpenCodeVersion('2.1.2-alpha..1')).toBe(false)
expect(isSupportedOpenCodeVersion('')).toBe(false)
})
it('describes the supported range for unsupported versions', () => {
expect(describeUnsupportedOpenCodeVersion('3.0.0')).toBe(
'OpenCode 3.0.0 is not supported; OpenCode Manager requires OpenCode >=2.0.15 <3.0.0',
'OpenCode 3.0.0 is not supported; OpenCode Manager requires OpenCode >=2.1.2 <3.0.0',
)
})
})