The supported range is now two baselines - dsh-v0.1.5-rc.1 (session
format V3) and dsh-v0.1.7-rc.2 (V4) - enforced by the runtime gate at
BASELINE_DSH_VERSION = 0.1.5-rc.1; below it the fallback units and the
upgrade modal take over (0.1.2/0.1.3 hosts were previously served by the
real folds).
The pre-V3 log shapes are dead code on every supported harness: the
running harness migrates historical logs on every read path (or refuses
the session wholesale), and 0.1.5-rc.1 rejects a request/header carrying
header.system outright. The fold therefore drops the V0/V2-only paths -
the header.system envelope system prompt, assistant/chunk floods,
{start, end} replacement endpoints, tool/code-dispatch - and the state
fields only they wrote (systemsFromHeader, the stepStart decode
accumulators). stateVersion stays 20: no supported log folds
differently, and pre-V3-era cached rows are discarded by the projection
cache's identity gate (and the strict stepStart sub-schema) instead of
served. The headers unit folds metadata-only epochs (envelope
systemTokens write dropped; the v1 cached-row read-compat and its pinned
stateVersion 1 stay); replaceRangeOf speaks startSeq/endSeq only; the
browser's epoch fetch maps request/header to tools and system/message to
the prompt text.
tests/baselines.ts re-fits to the two entries (the right Sidebar seam is
required on both), the compat matrix drives both tags' REAL sources
(canonical logs re-shaped to V3, the hostile probe renumbered past them),
and the version fixtures pin the new floor. Manifest: dshReleases
{0.1.5-rc.1, 0.1.7-rc.2}, dsh peers >=0.1.5-rc.1 (satisfies the 0.1.7
admission check under includePrerelease), devDeps pinned to the
0.1.5-rc.1 surface plus the ui-primitives runtime closure the client
lane inlines (test-only), and the release workflow fetches the two tags.
docs/compatibility.md is rewritten around the two-line matrix; README,
AGENTS.md and the issue template follow.
Also riding this move, from the audit pass: the fold re-proves an inject
source's form before it books the event record (the harness validates
`kind` but not `form` - a hostile one previously failed the strict
wire/state schemas on every delivery, the #44 freeze class), the headers
unit guards a data-less envelope (it has no try/catch of its own), the
schemastery schema annotations drop the explicit z<T> wrappers the 3.18.4
Mode generics reject, and the version-history note records why
stateVersion is deliberately not bumped.
74 lines
3.6 KiB
TypeScript
74 lines
3.6 KiB
TypeScript
// The version gate's arithmetic (src/shared/version.ts): parsing, the total
|
|
// order (release > rc > beta > alpha at equal X.Y.Z), and the fail-open
|
|
// baseline check.
|
|
|
|
import assert from 'node:assert/strict'
|
|
import { describe, test } from 'vitest'
|
|
import { BASELINE_DSH_VERSION, compareVersions, meetsBaseline, parseVersion } from '../../src/shared/version'
|
|
|
|
describe('parseVersion', () => {
|
|
test('parses plain releases, channels, serials, v-prefixes and build metadata', () => {
|
|
assert.deepEqual(parseVersion('0.1.2-rc.1'), { major: 0, minor: 1, patch: 2, rank: 3, serial: 1 })
|
|
assert.deepEqual(parseVersion('1.2.3'), { major: 1, minor: 2, patch: 3, rank: 4, serial: 0 })
|
|
assert.deepEqual(parseVersion('v2.0.0-alpha'), { major: 2, minor: 0, patch: 0, rank: 1, serial: 0 })
|
|
assert.deepEqual(parseVersion('0.1.2-beta.3'), { major: 0, minor: 1, patch: 2, rank: 2, serial: 3 })
|
|
assert.deepEqual(parseVersion(' 0.1.2-RC.2 '), { major: 0, minor: 1, patch: 2, rank: 3, serial: 2 })
|
|
assert.deepEqual(parseVersion('1.0.0+build.5'), { major: 1, minor: 0, patch: 0, rank: 4, serial: 0 })
|
|
})
|
|
|
|
test('rejects non-semver strings', () => {
|
|
for (const bad of ['', 'abc', '1.2', '1.2.3.4', '1.2.3-nightly', '1.2.3-rc.x', '0.0.0-dev', 'v1.2.3.4-something']) {
|
|
assert.equal(parseVersion(bad), null, bad)
|
|
}
|
|
})
|
|
})
|
|
|
|
describe('compareVersions', () => {
|
|
test('orders numerically, then channel (release > rc > beta > alpha), then serial', () => {
|
|
assert.ok(compareVersions('1.0.0', '0.9.9') > 0)
|
|
assert.ok(compareVersions('0.2.0', '0.1.9') > 0)
|
|
assert.ok(compareVersions('0.1.3', '0.1.2') > 0)
|
|
assert.ok(compareVersions('0.1.2', '0.1.2-rc.9') > 0, 'final outranks rc')
|
|
assert.ok(compareVersions('0.1.2-rc.1', '0.1.2-beta.9') > 0, 'rc outranks beta')
|
|
assert.ok(compareVersions('0.1.2-beta.1', '0.1.2-alpha.9') > 0, 'beta outranks alpha')
|
|
assert.ok(compareVersions('0.1.2-rc.2', '0.1.2-rc.1') > 0, 'higher serial wins')
|
|
assert.equal(compareVersions('0.1.2-rc.1', '0.1.2-rc.1'), 0)
|
|
assert.ok(compareVersions('0.1.3-alpha.1', '0.1.2') > 0, 'a newer X.Y.Z beats any older channel')
|
|
})
|
|
|
|
test('an unparseable side compares equal', () => {
|
|
assert.equal(compareVersions('dev-build', '0.1.2'), 0)
|
|
assert.equal(compareVersions('0.1.2', 'dev-build'), 0)
|
|
})
|
|
})
|
|
|
|
describe('meetsBaseline', () => {
|
|
test(`the supported baseline is ${BASELINE_DSH_VERSION}`, () => {
|
|
assert.equal(BASELINE_DSH_VERSION, '0.1.5-rc.1')
|
|
})
|
|
|
|
test('baseline and above pass; anything below fails', () => {
|
|
assert.equal(meetsBaseline('0.1.5-rc.1'), true, 'the baseline itself')
|
|
assert.equal(meetsBaseline('0.1.5-rc.2'), true)
|
|
assert.equal(meetsBaseline('0.1.5'), true, 'the final release of the baseline line')
|
|
assert.equal(meetsBaseline('0.1.7-rc.2'), true)
|
|
assert.equal(meetsBaseline('0.1.7-alpha.1'), true, 'a newer X.Y.Z outranks any channel (the 0.1.7 previews pass)')
|
|
assert.equal(meetsBaseline('0.1.3-alpha.2'), false)
|
|
assert.equal(meetsBaseline('0.1.5-beta.3'), false, 'beta is below rc at equal X.Y.Z')
|
|
assert.equal(meetsBaseline('0.1.5-alpha.1'), false)
|
|
assert.equal(meetsBaseline('0.1.2-rc.1'), false)
|
|
assert.equal(meetsBaseline('0.0.9'), false)
|
|
})
|
|
|
|
test('fails open: an unparseable version (or baseline) never gates', () => {
|
|
assert.equal(meetsBaseline('0.0.0-dev'), true)
|
|
assert.equal(meetsBaseline('not-a-version'), true)
|
|
assert.equal(meetsBaseline('0.1.0', 'also-junk'), true)
|
|
})
|
|
|
|
test('accepts an explicit baseline', () => {
|
|
assert.equal(meetsBaseline('0.1.5-rc.1', '0.2.0'), false)
|
|
assert.equal(meetsBaseline('0.2.0', '0.2.0-alpha.1'), true)
|
|
})
|
|
})
|