From 143e4b5259f2436944e0e8d1595c775d68e3dde4 Mon Sep 17 00:00:00 2001 From: James Ross Date: Tue, 1 Dec 2026 03:30:44 -0800 Subject: [PATCH 1/3] fix: stamp manifests with the core package version The manifest schema has accepted only MAJOR.MINOR.PATCH formatVersion values since 6.0.0. A prerelease package version such as 8.0.0-rc.1 would make every new manifest fail validation, and older readers would refuse it. The facade and the encryption migration script now stamp the version's core (8.0.0). --- index.js | 4 +- scripts/migrate-encryption.js | 6 +- src/package-version.js | 17 ++++- ...entAddressableStore.format-version.test.js | 63 +++++++++++++++++++ 4 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 test/unit/facade/ContentAddressableStore.format-version.test.js diff --git a/index.js b/index.js index b45b2ade..0969b2b5 100644 --- a/index.js +++ b/index.js @@ -43,7 +43,7 @@ import resolveChunker from './src/infrastructure/chunkers/resolveChunker.js'; import { CasError, createCasError, ErrorCodes } from './src/domain/errors/index.js'; import FixedChunker from './src/infrastructure/chunkers/FixedChunker.js'; import NodeCompressionAdapter from './src/infrastructure/adapters/NodeCompressionAdapter.js'; -import { PACKAGE_VERSION } from './src/package-version.js'; +import { MANIFEST_FORMAT_VERSION, PACKAGE_VERSION } from './src/package-version.js'; import parseApplicationHandle from './src/domain/value-objects/ApplicationHandle.js'; /** @typedef {import('./src/domain/value-objects/Manifest.js').default} Manifest */ @@ -336,7 +336,7 @@ export default class ContentAddressableStore { maxRestoreBufferSize: cfg.maxRestoreBufferSize, maxBlobSize: cfg.maxBlobSize, compressionAdapter: cfg.compressionAdapter || new NodeCompressionAdapter(), - formatVersion: PKG_VERSION, + formatVersion: MANIFEST_FORMAT_VERSION, }); const ref = new GitRefAdapter({ diff --git a/scripts/migrate-encryption.js b/scripts/migrate-encryption.js index e673111e..3df54e1c 100644 --- a/scripts/migrate-encryption.js +++ b/scripts/migrate-encryption.js @@ -489,9 +489,7 @@ async function buildLegacyDeps(plumbing) { const { default: NodeCompressionAdapter } = await import( '../src/infrastructure/adapters/NodeCompressionAdapter.js' ); - const { createRequire } = await import('node:module'); - const require = createRequire(import.meta.url); - const { version } = require('../package.json'); + const { MANIFEST_FORMAT_VERSION } = await import('../src/package-version.js'); return { persistence: new GitPersistenceAdapter({ plumbing }), @@ -500,7 +498,7 @@ async function buildLegacyDeps(plumbing) { chunker: new FixedChunker({ chunkSize: 256 * 1024 }), compressionAdapter: new NodeCompressionAdapter(), chunkSize: 256 * 1024, - formatVersion: version, + formatVersion: MANIFEST_FORMAT_VERSION, }; } diff --git a/src/package-version.js b/src/package-version.js index 74c6f7c6..71f9477d 100644 --- a/src/package-version.js +++ b/src/package-version.js @@ -1 +1,16 @@ -export const PACKAGE_VERSION = '7.2.0'; +export const PACKAGE_VERSION = '8.0.0-rc.1'; + +/** + * Returns the `MAJOR.MINOR.PATCH` core of a package version. Manifests record + * this as `formatVersion`, whose schema (and every earlier reader) accepts + * only three numeric components, so a prerelease such as `8.0.0-rc.1` stamps + * `8.0.0`. + * + * @param {string} version + * @returns {string} + */ +export function manifestFormatVersion(version) { + return version.replace(/[-+].*$/u, ''); +} + +export const MANIFEST_FORMAT_VERSION = manifestFormatVersion(PACKAGE_VERSION); diff --git a/test/unit/facade/ContentAddressableStore.format-version.test.js b/test/unit/facade/ContentAddressableStore.format-version.test.js new file mode 100644 index 00000000..c387cbd0 --- /dev/null +++ b/test/unit/facade/ContentAddressableStore.format-version.test.js @@ -0,0 +1,63 @@ +import { describe, it, expect, vi } from 'vitest'; +import { readFileSync } from 'node:fs'; +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import ContentAddressableStore from '../../../index.js'; +import { ManifestSchema } from '../../../src/domain/schemas/ManifestSchema.js'; +import { + MANIFEST_FORMAT_VERSION, + manifestFormatVersion, +} from '../../../src/package-version.js'; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const { version } = JSON.parse( + readFileSync(path.resolve(__dirname, '../../../package.json'), 'utf8'), +); + +const minimalManifest = { + slug: 'format-version', + filename: 'format-version.bin', + size: 0, + chunks: [], +}; + +function mockPlumbing() { + return { + execute: vi.fn(), + executeStream: vi.fn(), + }; +} + +describe('manifest formatVersion stamp', () => { + it('drops prerelease and build identifiers from the package version', () => { + expect(manifestFormatVersion('8.0.0-rc.1')).toBe('8.0.0'); + expect(manifestFormatVersion('8.0.0-rc.1+abc1234')).toBe('8.0.0'); + expect(manifestFormatVersion('8.0.0+abc1234')).toBe('8.0.0'); + expect(manifestFormatVersion('7.2.0')).toBe('7.2.0'); + }); + + it('stamps the core of the package version, which the manifest schema accepts', () => { + expect(MANIFEST_FORMAT_VERSION).toBe(version.replace(/[-+].*$/u, '')); + expect(() => ManifestSchema.parse({ ...minimalManifest, formatVersion: MANIFEST_FORMAT_VERSION })) + .not.toThrow(); + }); + + it('gives the facade service the schema-valid stamp', async () => { + const store = new ContentAddressableStore({ plumbing: mockPlumbing() }); + const service = await store.getService(); + + expect(service.formatVersion).toBe(MANIFEST_FORMAT_VERSION); + }); +}); + +describe('encryption migration formatVersion stamp', () => { + it('stamps migrated manifests with the schema-valid core version', async () => { + const { createMigrationContext } = await import('../../../scripts/migrate-encryption.js'); + const context = await createMigrationContext(mockPlumbing()); + + expect(context.deps.formatVersion).toBe(MANIFEST_FORMAT_VERSION); + for (const service of Object.values(context.services)) { + expect(service.formatVersion).toBe(MANIFEST_FORMAT_VERSION); + } + }); +}); From b513d8b7159ec0172ed33c7a057cdd2ab69f9e1c Mon Sep 17 00:00:00 2001 From: James Ross Date: Tue, 1 Dec 2026 03:30:48 -0800 Subject: [PATCH 2/3] ci: publish prerelease versions under the npm next dist-tag The validate job derives npm-dist-tag and prerelease outputs from the package version. A version containing a hyphen publishes with --tag next and creates a GitHub prerelease; a plain version publishes under latest. The publish step refuses a dist-tag that disagrees with the version. Tests execute the workflow's shell blocks. --- .github/workflows/release.yml | 29 ++++- test/unit/scripts/release-workflow.test.js | 118 ++++++++++++++++++++- 2 files changed, 144 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97875bcb..c2163c9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,7 +7,7 @@ on: workflow_dispatch: inputs: release_ref: - description: 'Existing vX.Y.Z tag to validate, publish, and release' + description: 'Existing vX.Y.Z or vX.Y.Z-prerelease tag to validate, publish, and release' required: true default: 'v6.0.0' type: string @@ -25,6 +25,8 @@ jobs: outputs: version: ${{ steps.check-version.outputs.version }} tag: ${{ steps.check-version.outputs.tag }} + npm-dist-tag: ${{ steps.check-version.outputs.npm-dist-tag }} + prerelease: ${{ steps.check-version.outputs.prerelease }} steps: - uses: actions/checkout@v6 with: @@ -45,6 +47,15 @@ jobs: fi echo "version=$PKG_VERSION" >> "$GITHUB_OUTPUT" echo "tag=$TAG_NAME" >> "$GITHUB_OUTPUT" + # A prerelease (any version with a hyphen, such as 8.0.0-rc.1) goes to + # npm under `next` and to GitHub as a prerelease; never to `latest`. + if [[ "$PKG_VERSION" == *-* ]]; then + echo "npm-dist-tag=next" >> "$GITHUB_OUTPUT" + echo "prerelease=true" >> "$GITHUB_OUTPUT" + else + echo "npm-dist-tag=latest" >> "$GITHUB_OUTPUT" + echo "prerelease=false" >> "$GITHUB_OUTPUT" + fi test: needs: validate @@ -98,7 +109,20 @@ jobs: } JS - name: Publish to npm - run: npm publish --access public + env: + RELEASE_VERSION: ${{ needs.validate.outputs.version }} + NPM_DIST_TAG: ${{ needs.validate.outputs.npm-dist-tag }} + run: | + if [[ "$RELEASE_VERSION" == *-* ]]; then + EXPECTED_TAG=next + else + EXPECTED_TAG=latest + fi + if [ -z "$RELEASE_VERSION" ] || [ "$NPM_DIST_TAG" != "$EXPECTED_TAG" ]; then + echo "::error::Version $RELEASE_VERSION must publish under dist-tag $EXPECTED_TAG, got $NPM_DIST_TAG" + exit 1 + fi + npm publish --access public --tag "$NPM_DIST_TAG" github-release: needs: [validate, publish-npm] @@ -116,3 +140,4 @@ jobs: with: tag_name: ${{ needs.validate.outputs.tag }} generate_release_notes: true + prerelease: ${{ needs.validate.outputs.prerelease == 'true' }} diff --git a/test/unit/scripts/release-workflow.test.js b/test/unit/scripts/release-workflow.test.js index 1ae73f9a..9562c6a4 100644 --- a/test/unit/scripts/release-workflow.test.js +++ b/test/unit/scripts/release-workflow.test.js @@ -1,5 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { readFileSync } from 'node:fs'; +import { spawnSync } from 'node:child_process'; +import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; +import { tmpdir } from 'node:os'; import path from 'node:path'; const repoRoot = process.cwd(); @@ -55,6 +57,120 @@ describe('release workflow publishing', () => { }); +/** + * Returns the dedented `run: |` script of the first step in a job block that + * contains the marker line. + * + * @param {string} job + * @param {string} marker + * @returns {string} + */ +function stepScript(job, marker) { + const lines = job.split('\n'); + const start = lines.findIndex((line) => line.includes(marker)); + const runIndex = lines.findIndex((line, index) => index > start && /^\s+run: \|$/u.test(line)); + const indent = lines[runIndex].indexOf('run:') + 2; + const body = []; + for (const line of lines.slice(runIndex + 1)) { + if (line.trim() !== '' && line.search(/\S/u) < indent) { break; } + body.push(line.slice(indent)); + } + return body.join('\n'); +} + +function runValidate(version) { + const dir = mkdtempSync(path.join(tmpdir(), 'cas-release-validate-')); + try { + writeFileSync(path.join(dir, 'package.json'), JSON.stringify({ version })); + const outputPath = path.join(dir, 'github-output'); + writeFileSync(outputPath, ''); + const script = stepScript(jobBlock(read('.github/workflows/release.yml'), 'validate'), 'id: check-version'); + const result = spawnSync('bash', ['-e', '-c', script], { + cwd: dir, + encoding: 'utf8', + env: { PATH: process.env.PATH, RELEASE_REF: `v${version}`, GITHUB_OUTPUT: outputPath }, + }); + expect(result.status, result.stderr).toBe(0); + return Object.fromEntries( + readFileSync(outputPath, 'utf8').trim().split('\n').map((line) => line.split('=', 2)), + ); + } finally { + rmSync(dir, { recursive: true, force: true }); + } +} + +function runPublish({ version, distTag }) { + const dir = mkdtempSync(path.join(tmpdir(), 'cas-release-publish-')); + try { + const npmLog = path.join(dir, 'npm-args'); + writeFileSync(path.join(dir, 'npm'), `#!/usr/bin/env bash\nprintf '%s\\n' "$*" > "${npmLog}"\n`); + chmodSync(path.join(dir, 'npm'), 0o755); + const script = stepScript(jobBlock(read('.github/workflows/release.yml'), 'publish-npm'), 'name: Publish to npm'); + const result = spawnSync('bash', ['-e', '-c', script], { + cwd: dir, + encoding: 'utf8', + env: { + PATH: `${dir}:${process.env.PATH}`, + RELEASE_VERSION: version, + NPM_DIST_TAG: distTag, + }, + }); + let npmArgs = null; + try { npmArgs = readFileSync(npmLog, 'utf8').trim(); } catch { npmArgs = null; } + return { status: result.status, npmArgs, stdout: result.stdout }; + } finally { + rmSync(dir, { recursive: true, force: true }); + } +} + +describe('release workflow dist-tag selection', () => { + it('sends a prerelease to npm next and marks its GitHub Release as a prerelease', () => { + const outputs = runValidate('8.0.0-rc.1'); + expect(outputs).toMatchObject({ + version: '8.0.0-rc.1', + tag: 'v8.0.0-rc.1', + 'npm-dist-tag': 'next', + prerelease: 'true', + }); + const publish = runPublish({ version: outputs.version, distTag: outputs['npm-dist-tag'] }); + expect(publish.status).toBe(0); + expect(publish.npmArgs).toBe('publish --access public --tag next'); + }); + + it('sends a plain version to npm latest as a full GitHub Release', () => { + const outputs = runValidate('8.0.0'); + expect(outputs).toMatchObject({ + version: '8.0.0', + tag: 'v8.0.0', + 'npm-dist-tag': 'latest', + prerelease: 'false', + }); + const publish = runPublish({ version: outputs.version, distTag: outputs['npm-dist-tag'] }); + expect(publish.status).toBe(0); + expect(publish.npmArgs).toBe('publish --access public --tag latest'); + }); + + it('refuses to publish a prerelease under latest or with a missing dist-tag', () => { + for (const distTag of ['latest', '']) { + const publish = runPublish({ version: '8.0.0-rc.1', distTag }); + expect(publish.status).not.toBe(0); + expect(publish.npmArgs).toBeNull(); + } + const stable = runPublish({ version: '8.0.0', distTag: 'next' }); + expect(stable.status).not.toBe(0); + expect(stable.npmArgs).toBeNull(); + }); + + it('passes the prerelease flag to the GitHub Release', () => { + const releaseJob = jobBlock(read('.github/workflows/release.yml'), 'github-release'); + expect(releaseJob).toContain("prerelease: ${{ needs.validate.outputs.prerelease == 'true' }}"); + const validateJob = jobBlock(read('.github/workflows/release.yml'), 'validate'); + expect(validateJob).toContain('npm-dist-tag: ${{ steps.check-version.outputs.npm-dist-tag }}'); + expect(validateJob).toContain('prerelease: ${{ steps.check-version.outputs.prerelease }}'); + }); +}); + + describe('release test isolation', () => { it('runs the Node unit gate through COPY-based Docker in CI and publication', () => { for (const file of ['.github/workflows/ci.yml', '.github/workflows/release.yml']) { From 6b8b114b2fa6d957adba2ffd75e73787ce91d026 Mon Sep 17 00:00:00 2001 From: James Ross Date: Tue, 1 Dec 2026 03:30:50 -0800 Subject: [PATCH 3/3] release: v8.0.0-rc.1 Moves @git-stunts/plumbing from exactly 4.0.0-rc.1 to ^4.0.0-rc.1, bumps package.json, jsr.json and src/package-version.js to 8.0.0-rc.1, dates the changelog section, and adds release notes and the 7.2.0 to 8.0.0-rc.1 upgrade guide. The release-state test now orders prerelease versions. BREAKING CHANGE: git-cas depends on @git-stunts/plumbing 4. An application that injects its own plumbing instance must use plumbing 4 installed as the same copy, because git-cas matches plumbing errors by class. GitPersistenceAdapter.readBlobStream() starts its one-shot git command on first read. --- BEARING.md | 2 +- CHANGELOG.md | 12 +++++++++- README.md | 2 ++ STATUS.md | 2 +- UPGRADING.md | 20 +++++++++++++--- docs/releases/v8.0.0-rc.1.md | 25 +++++++++++++++++++ jsr.json | 2 +- package.json | 7 +++--- pnpm-lock.yaml | 2 +- test/unit/docs/release-state.test.js | 36 ++++++++++++++++++++++++---- 10 files changed, 94 insertions(+), 16 deletions(-) create mode 100644 docs/releases/v8.0.0-rc.1.md diff --git a/BEARING.md b/BEARING.md index 2d068412..a3e93774 100644 --- a/BEARING.md +++ b/BEARING.md @@ -14,7 +14,7 @@ timeline ## Current State -`v7.0.0` shipped on `2026-11-01`, moving the public schema boundary and Plumbing dependency to Zod 4 and rejecting unsafe integer metadata. It requires published Plumbing 3.3.3. The v7.1.0 reservation capability from [#157](https://github.com/git-stunts/git-cas/issues/157) is merged in PR #158 at `4782052`; the maintainer explicitly authorized an admin merge after independent reviewers became unavailable. [#162](https://github.com/git-stunts/git-cas/issues/162) records successful v7.1.0 publication and a fresh registry consumer in both Git object formats. The signed tag and npm artifact identify release source `18f87dd`. Earlier Plumbing recovery work classifies closed mktree transport input for bounded immutable-object retry; mutable-ref semantics are unchanged. Published `v7.2.0` path-compresses the reservation index ([#167](https://github.com/git-stunts/git-cas/issues/167)); the signed tag, npm gitHead and release workflow identify source `3008b4a`, and [#169](https://github.com/git-stunts/git-cas/issues/169) holds the verification record. git-cas 7.1.0 refuses an index 7.2.0 has written, so processes sharing a ledger upgrade together. +`v7.0.0` shipped on `2026-11-01`, moving the public schema boundary and Plumbing dependency to Zod 4 and rejecting unsafe integer metadata. It requires published Plumbing 3.3.3. The v7.1.0 reservation capability from [#157](https://github.com/git-stunts/git-cas/issues/157) is merged in PR #158 at `4782052`; the maintainer explicitly authorized an admin merge after independent reviewers became unavailable. [#162](https://github.com/git-stunts/git-cas/issues/162) records successful v7.1.0 publication and a fresh registry consumer in both Git object formats. The signed tag and npm artifact identify release source `18f87dd`. Earlier Plumbing recovery work classifies closed mktree transport input for bounded immutable-object retry; mutable-ref semantics are unchanged. Published `v7.2.0` path-compresses the reservation index ([#167](https://github.com/git-stunts/git-cas/issues/167)); the signed tag, npm gitHead and release workflow identify source `3008b4a`, and [#169](https://github.com/git-stunts/git-cas/issues/169) holds the verification record. git-cas 7.1.0 refuses an index 7.2.0 has written, so processes sharing a ledger upgrade together. The unpublished `v8.0.0-rc.1` candidate moves git-cas to `@git-stunts/plumbing` `^4.0.0-rc.1`, starts one-shot `readBlobStream()` reads lazily and adds `materializeFile()`; it is bound for the npm `next` dist-tag while plumbing 4.0.0 is itself a release candidate. It is not the planned v8.0.0 Cleave workspace split ([#133](https://github.com/git-stunts/git-cas/issues/133)), whose numbering now needs revisiting. Application asset, bundle, page, cache, expiry, witness, and repository-diagnostics APIs sit above mutable root sets and the low-level CAS pipeline. Direct bundle-reference reads and bounded diff --git a/CHANGELOG.md b/CHANGELOG.md index f99c4db0..f12cbb1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,14 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [8.0.0-rc.1] — 2026-12-01 + +### Breaking Changes + +- git-cas depends on `@git-stunts/plumbing` 4 (`^4.0.0-rc.1`) instead of 3.x. Plumbing 4 itself changes behavior for applications that also call it directly; see `UPGRADING.md`. +- An application that passes its own plumbing instance to git-cas must use plumbing 4, installed as the same copy git-cas uses. git-cas recognises plumbing's errors by class, so an instance from a separate 3.x copy turns, for example, a missing object into plumbing's `GitObjectMissingError` instead of git-cas's `GIT_OBJECT_NOT_FOUND`. +- `GitPersistenceAdapter.readBlobStream()` starts its one-shot `git cat-file blob` command when the caller first reads the returned stream, not when the stream is returned. A stream that is never read starts no git process, and a stream first read after the adapter closed fails with `RESOURCE_CLOSED`. + ### Added - Optional `@git-stunts/git-cas/files` helper `materializeFile()` streams an async byte source to a private sibling file, then renames on success, and resolves if and only if the file was published. It does not fsync. It supports cancellation, which rejects with `signal.reason` until the rename starts, and optional whole-plaintext SHA-256 verification. It follows a destination symlink, including a dangling one, that resolves inside the base and replaces or creates the file it names. It reuses restore path confinement, rejects an output path that resolves to the base directory before reading the source, rejects source chunks that are not `Uint8Array` with `INVALID_OPTIONS`, and leaves the core byte-stream and buffer APIs unchanged. `restoreFile()` changes only by the path fixes listed under Fixed. ### Changed -- `@git-stunts/plumbing` is pinned to exactly `4.0.0-rc.1`, the first 4.0.0 release candidate (npm `next` tag), in place of `^3.3.3`. An application that passes its own plumbing instance to git-cas must use the same version, `4.0.0-rc.1`, so that git-cas recognises plumbing's errors; see `UPGRADING.md`. git-cas already accepts 40- and 64-digit object ids, installs no signal handlers, supplies no custom command runner, and does not retry on plumbing timeouts. The unit and integration suites pass on Node, Bun and Deno, and 500 consecutive two-writer guarded root-set replacements (`scripts/diagnostics/stress-root-set-replacement.js`) each accept exactly one winner. +- `@git-stunts/plumbing` moves from `^3.3.3` to `^4.0.0-rc.1`, which accepts the first 4.0.0 release candidate (npm `next` tag) and every later 4.x release, including 4.0.0 final. The lockfile resolves `4.0.0-rc.1`. An application that passes its own plumbing instance to git-cas must use plumbing 4 resolved to the same installed copy, so that git-cas recognises plumbing's errors; see `UPGRADING.md`. git-cas already accepts 40- and 64-digit object ids, installs no signal handlers, supplies no custom command runner, and does not retry on plumbing timeouts. The unit and integration suites pass on Node, Bun and Deno, and 500 consecutive two-writer guarded root-set replacements (`scripts/diagnostics/stress-root-set-replacement.js`) each accept exactly one winner. - With 4.0.0-rc.1, a guarded `update-ref` that loses a compare-and-swap race through `plumbing.execute()` reports git's complete stderr and arrives as `GitRepositoryLockedError` (git-stunts/plumbing#9). Root-set persistence keeps its fallback that treats an exit-128 failure with empty stderr and an observed head advance as a conflict. +- Manifests record `formatVersion` as the `MAJOR.MINOR.PATCH` core of the package version, so 8.0.0-rc.1 writes `"8.0.0"`. The manifest schema, in this release and every release since 6.0.0, accepts only three numeric components; stamping `8.0.0-rc.1` would have made every new manifest fail validation. The encryption migration script stamps the same value. Stable versions are unchanged. +- The release workflow publishes a version that contains a hyphen, such as `8.0.0-rc.1`, to npm under the `next` dist-tag and marks its GitHub Release as a prerelease. A plain version publishes under `latest` as before. The publish step refuses to run if the dist-tag does not match the version. ### Performance diff --git a/README.md b/README.md index 0fc4e4a9..c1f8bd74 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ reads and updates, but 7.1.0 refuses an index 7.2.0 has written; see the [release notes](./docs/releases/v7.2.0.md) and [#169](https://github.com/git-stunts/git-cas/issues/169). +The v8.0.0-rc.1 release candidate moves git-cas to `@git-stunts/plumbing` 4 and is bound for npm's `next` dist-tag; `latest` stays on 7.2.0. An application that passes its own plumbing instance must use plumbing 4 too, and `readBlobStream()` now starts git on first read. See the [migration guidance](./UPGRADING.md#v720-to-v800-rc1) and [release notes](./docs/releases/v8.0.0-rc.1.md). + The published v6.5.12 release bounds object-metadata requests so root sets with more than 1000 targets (936 for SHA-256) validate within Plumbing's cat-file request limits. Admission still rejects missing and mismatched targets before publication; see [v6.5.12 Release Notes](./docs/releases/v6.5.12.md). ### 1. CLI Usage diff --git a/STATUS.md b/STATUS.md index 58ca4372..c3b6c804 100644 --- a/STATUS.md +++ b/STATUS.md @@ -1,7 +1,7 @@ # STATUS **Last tagged release:** `v7.2.0` (`2026-11-06`) -**Current release state:** `v7.2.0` is published to npm and GitHub Releases ([#169](https://github.com/git-stunts/git-cas/issues/169)). +**Current release state:** `v7.2.0` is published to npm and GitHub Releases ([#169](https://github.com/git-stunts/git-cas/issues/169)); `v8.0.0-rc.1`, which moves git-cas to plumbing 4, is an unpublished release candidate bound for the npm `next` dist-tag ([release notes](./docs/releases/v8.0.0-rc.1.md)). **Verification:** Signed tag `v7.2.0`, npm gitHead and release workflow `42249242979` agree on `3008b4a`. The 14-step release verifier passes at the tag, with test suites in Docker: 2,416 unit tests on Node and Bun (3 skips each), 2,407 on Deno (12 skips), and 353 integration tests on each runtime. git-warp installed the registry artifact by lockfile integrity and passed 333 custody, Warp and migration-golden tests ([git-warp#1083](https://github.com/git-stunts/git-warp/pull/1083)). [#169](https://github.com/git-stunts/git-cas/issues/169#issuecomment-7308539667) retains the verification record. v7.1.0 evidence remains in [#162](https://github.com/git-stunts/git-cas/issues/162). **Playback truth:** `main` **Runtimes:** Node.js 22.x, Bun, Deno diff --git a/UPGRADING.md b/UPGRADING.md index b0c4d901..729339f7 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -2,11 +2,25 @@ This guide covers breaking changes and migration steps for git-cas releases. -## Unreleased: `@git-stunts/plumbing` 4.0.0-rc.1 +## v7.2.0 To v8.0.0-rc.1 -git-cas now depends on `@git-stunts/plumbing` `4.0.0-rc.1`. git-cas's own API and stored data do not change. If your application also uses plumbing directly, read the plumbing 4.0.0 changelog: a deadline now kills git's whole process group and is not retried, more than 10 MiB of unread stdout fails with `UnreadOutputLimitError`, `GitSha` accepts SHA-256 ids, and plumbing forwards `SIGINT`, `SIGTERM` and `SIGHUP` to running git commands (declare a handler plumbing cannot see with `declareSignalHandler()`). +git-cas 8.0.0-rc.1 is a release candidate on npm's `next` dist-tag (`npm install @git-stunts/git-cas@next`); `latest` stays on 7.2.0. It depends on `@git-stunts/plumbing` `^4.0.0-rc.1`, which accepts plumbing 4.0.0 final and later 4.x releases. The stored data format and the public API's signatures do not change, but three behaviors are breaking for consumers. See the [release notes](./docs/releases/v8.0.0-rc.1.md). -If you pass your own plumbing instance to `ContentAddressableStore` (or to `GitPersistenceAdapter`, `GitRefAdapter` or `GitRepositoryInspectionAdapter`), change your application's `@git-stunts/plumbing` dependency to exactly `4.0.0-rc.1` as well, so that your package manager installs one copy shared with git-cas. git-cas recognises plumbing's errors (`GitObjectMissingError`, `GitProtocolError`, `InvalidArgumentError`) by class. An instance from a separately installed 3.x copy throws errors of other classes, so, for example, reading a missing object reports plumbing's `GitObjectMissingError` instead of git-cas's `GIT_OBJECT_NOT_FOUND`, and git-cas's one-time recovery of a failed object session does not run. +### Plumbing 4 + +If your application also uses plumbing directly, read the plumbing 4.0.0 changelog: a deadline now kills git's whole process group and is not retried, more than 10 MiB of unread stdout fails with `UnreadOutputLimitError`, `GitSha` accepts SHA-256 ids, and plumbing forwards `SIGINT`, `SIGTERM` and `SIGHUP` to running git commands (declare a handler plumbing cannot see with `declareSignalHandler()`). + +### Injected plumbing instances + +If you pass your own plumbing instance to `ContentAddressableStore` (or to `GitPersistenceAdapter`, `GitRefAdapter` or `GitRepositoryInspectionAdapter`), change your application's `@git-stunts/plumbing` dependency to a plumbing 4 range that resolves to the same version git-cas uses, such as `^4.0.0-rc.1`, so that your package manager installs one copy shared with git-cas. Check with `npm ls @git-stunts/plumbing` or `pnpm why @git-stunts/plumbing` that only one copy is installed. git-cas recognises plumbing's errors (`GitObjectMissingError`, `GitProtocolError`, `InvalidArgumentError`) by class. An instance from a separately installed 3.x copy throws errors of other classes, so, for example, reading a missing object reports plumbing's `GitObjectMissingError` instead of git-cas's `GIT_OBJECT_NOT_FOUND`, and git-cas's one-time recovery of a failed object session does not run. + +### Lazy `readBlobStream()` + +`GitPersistenceAdapter.readBlobStream()` now starts its one-shot `git cat-file blob` command when you first read the returned stream, not when the call returns. This path serves blobs over 10 MiB, blobs the adapter's `cat-file` session cannot describe or read, and plumbing without object sessions. Code that obtained such a stream and read it only after closing the adapter (or the store that owns it) now gets `RESOURCE_CLOSED`; read the stream before closing. A stream you never read no longer starts a git process. Blobs of 10 MiB or less that the session reads are unchanged: they are read into memory before the call returns, and their streams still yield after close. + +### Manifest `formatVersion` + +New manifests record `formatVersion: "8.0.0"`, the `MAJOR.MINOR.PATCH` core of the package version, not `8.0.0-rc.1`. The manifest schema accepts only three numeric components, so 7.x readers accept manifests this candidate writes. ## v6.5.12 To v7.0.0 (candidate) diff --git a/docs/releases/v8.0.0-rc.1.md b/docs/releases/v8.0.0-rc.1.md new file mode 100644 index 00000000..e903fddc --- /dev/null +++ b/docs/releases/v8.0.0-rc.1.md @@ -0,0 +1,25 @@ +# git-cas v8.0.0-rc.1: plumbing 4 release candidate + +This release candidate moves git-cas onto `@git-stunts/plumbing` 4. It is a major release because applications that share a plumbing instance with git-cas must move to plumbing 4 with it, and because `GitPersistenceAdapter.readBlobStream()` now starts git lazily. Plumbing 4.0.0 is itself only a release candidate, so this version publishes to npm under the `next` dist-tag and leaves `latest` on 7.2.0. The plumbing upgrade merged in [PR #177](https://github.com/git-stunts/git-cas/pull/177). This document claims no published 8.0.0-rc.1 artifact. See [UPGRADING.md](../../UPGRADING.md#v720-to-v800-rc1) before adopting it. + +## Breaking changes + +git-cas depends on `@git-stunts/plumbing` `^4.0.0-rc.1` instead of `^3.3.3`. The range accepts plumbing 4.0.0 final and later 4.x releases without a new git-cas release. Plumbing 4 changes behavior for applications that also call it directly: a deadline kills git's whole process group and is not retried, more than 10 MiB of unread stdout fails with `UnreadOutputLimitError`, `GitSha` accepts SHA-256 ids, and plumbing forwards `SIGINT`, `SIGTERM` and `SIGHUP` to running git commands. + +An application that passes its own plumbing instance to `ContentAddressableStore`, `GitPersistenceAdapter`, `GitRefAdapter` or `GitRepositoryInspectionAdapter` must use plumbing 4, installed as the same copy git-cas uses. git-cas recognises plumbing's errors by class. An instance from a separate 3.x copy throws errors of other classes, so a missing object reports plumbing's `GitObjectMissingError` instead of git-cas's `GIT_OBJECT_NOT_FOUND`, and git-cas's one-time recovery of a failed object session does not run. + +`GitPersistenceAdapter.readBlobStream()` starts its one-shot `git cat-file blob` command when the caller first reads the returned stream, not when the stream is returned. That path serves a blob over 10 MiB, a blob the adapter's `cat-file` session cannot describe or read, and plumbing without object sessions. A stream that is never read starts no git process. A stream first read after the adapter closed fails with `RESOURCE_CLOSED`. A blob of 10 MiB or less that the session reads is still read into memory before the call returns, and its stream still yields after close. + +## Other changes + +The optional `@git-stunts/git-cas/files` entrypoint adds `materializeFile()`, which streams an async byte source to a private sibling file and renames it on success. `restoreFile()` and `materializeFile()` resolve destination symlinks one component at a time, refuse a dangling link that points outside the base directory, and accept names such as `..cache`. The default JSON façade decodes UTF-8 natively, 2.6x to 6x faster on Node 22 for manifest-shaped metadata. [CHANGELOG.md](../../CHANGELOG.md) lists each change. + +## Stored data + +Stored objects, refs and manifests keep their format. New manifests record `formatVersion: "8.0.0"`, the `MAJOR.MINOR.PATCH` core of the package version. The manifest schema has accepted only three numeric components since 6.0.0, so stamping `8.0.0-rc.1` would have made every new manifest fail validation, and 6.x and 7.x readers would refuse it. With the core version, 7.x readers accept manifests written by this candidate. + +## Publication + +The release workflow now chooses the npm dist-tag from the version. A version that contains a hyphen publishes with `npm publish --access public --tag next`, and its GitHub Release is marked as a prerelease. A plain version publishes under `latest`. The publish step refuses to run if the dist-tag and the version disagree. + +This candidate does not contain the planned v8.0.0 Cleave workspace split ([#133](https://github.com/git-stunts/git-cas/issues/133)). Merge approval, a signed tag, a successful release workflow and registry-consumer evidence remain required before any claim of publication. diff --git a/jsr.json b/jsr.json index 8bc8e8ea..aa1b9a71 100644 --- a/jsr.json +++ b/jsr.json @@ -1,6 +1,6 @@ { "name": "@git-stunts/git-cas", - "version": "7.2.0", + "version": "8.0.0-rc.1", "exports": { ".": "./index.js", "./service": "./src/domain/services/CasService.js", diff --git a/package.json b/package.json index 1cba51cd..097b41c1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@git-stunts/git-cas", - "version": "7.2.0", + "version": "8.0.0-rc.1", "description": "Content-addressed storage backed by Git's object database, with optional encryption and pluggable codecs", "type": "module", "main": "index.js", @@ -66,7 +66,8 @@ "docs/releases/v6.5.12.md", "docs/releases/v7.0.0.md", "docs/releases/v7.1.0.md", - "docs/releases/v7.2.0.md" + "docs/releases/v7.2.0.md", + "docs/releases/v8.0.0-rc.1.md" ], "engines": { "node": ">=22.0.0" @@ -123,7 +124,7 @@ "@flyingrobots/bijou-tui": "^7.2.0", "@flyingrobots/bijou-tui-app": "^7.2.0", "@git-stunts/alfred": "^0.10.0", - "@git-stunts/plumbing": "4.0.0-rc.1", + "@git-stunts/plumbing": "^4.0.0-rc.1", "@git-stunts/vault": "^1.0.1", "cbor-x": "^1.6.0", "commander": "14.0.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 990c8e72..cfd86081 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -24,7 +24,7 @@ importers: specifier: ^0.10.0 version: 0.10.0 '@git-stunts/plumbing': - specifier: 4.0.0-rc.1 + specifier: ^4.0.0-rc.1 version: 4.0.0-rc.1 '@git-stunts/vault': specifier: ^1.0.1 diff --git a/test/unit/docs/release-state.test.js b/test/unit/docs/release-state.test.js index 82079334..47c69cc9 100644 --- a/test/unit/docs/release-state.test.js +++ b/test/unit/docs/release-state.test.js @@ -45,17 +45,43 @@ const v650PublicationPath = const v640PublicationPath = 'docs/design/0049-scoped-staging-workspaces/witness/release-publication.md'; +function parseVersion(version) { + const match = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/u.exec(version); + if (!match) { + throw new Error(`Not a semantic version: ${version}`); + } + return { core: match.slice(1, 4).map(Number), prerelease: match[4] ?? null }; +} + +function comparePrerelease(left, right) { + if (left === right) { return 0; } + // A version with a prerelease ranks below the same core version without one. + if (left === null) { return 1; } + if (right === null) { return -1; } + return left.localeCompare(right, 'en', { numeric: true }); +} + function compareVersions(left, right) { - const leftParts = left.split('.').map(Number); - const rightParts = right.split('.').map(Number); + const leftVersion = parseVersion(left); + const rightVersion = parseVersion(right); for (let index = 0; index < 3; index += 1) { - if (leftParts[index] !== rightParts[index]) { - return leftParts[index] - rightParts[index]; + if (leftVersion.core[index] !== rightVersion.core[index]) { + return leftVersion.core[index] - rightVersion.core[index]; } } - return 0; + return comparePrerelease(leftVersion.prerelease, rightVersion.prerelease); } +describe('release version ordering', () => { + it('orders prerelease package versions after the published release they follow', () => { + expect(compareVersions('7.2.0', '8.0.0-rc.1')).toBeLessThan(0); + expect(compareVersions('8.0.0-rc.1', '8.0.0')).toBeLessThan(0); + expect(compareVersions('8.0.0-rc.1', '8.0.0-rc.2')).toBeLessThan(0); + expect(compareVersions('8.0.0', '8.0.0')).toBe(0); + expect(() => compareVersions('8.0', '8.0.0')).toThrow(/Not a semantic version/u); + }); +}); + function read(relPath) { return readFileSync(path.join(repoRoot, relPath), 'utf8'); }