Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
e83f79a
Require all release verification suites and fixtures
christophersesugh Nov 28, 2026
82c882c
Exercise missing-suite guard on a disposable CI checkout
christophersesugh Nov 28, 2026
9c92e14
Verify independent installed NodeNext declarations and emitted ESM
christophersesugh Nov 28, 2026
8465137
Extract credential-free release candidate preflight
christophersesugh Nov 28, 2026
e3accd6
Test synthetic approval, run and artifact rejection matrix
christophersesugh Nov 28, 2026
9fdc03a
Use tested preflight before protected manual staging
christophersesugh Nov 28, 2026
e43e340
Exercise omission and release preflight in read-only quality CI
christophersesugh Nov 28, 2026
ffa11a5
Test overlapping collection cancellation and independent evaluation
christophersesugh Nov 28, 2026
d51ddb6
Reject installed package deep imports at type level
christophersesugh Nov 28, 2026
3b35f66
Check native runtime export map and resolved installed entry
christophersesugh Nov 28, 2026
b4fc792
Document independent consumer and read-only release verification
christophersesugh Nov 28, 2026
c00f656
Document independent consumer and read-only release verification
christophersesugh Nov 28, 2026
f3f0ee1
Apply Biome formatting to NodeNext consumer verifier
christophersesugh Nov 28, 2026
41edba5
Expose shared approval check before release candidate acquisition
christophersesugh Nov 28, 2026
ad1e8a3
Unify protected staging selection and final checks in tested orchestr…
christophersesugh Nov 28, 2026
058257b
Invoke the single tested staging path from the protected workflow
christophersesugh Nov 28, 2026
6614a39
Exercise staging control flow with credential-free GitHub and npm stubs
christophersesugh Nov 28, 2026
1f79323
Align local and CI verification commands
christophersesugh Nov 28, 2026
6c52e8c
Align local and CI verification commands
christophersesugh Nov 28, 2026
b06f50f
Align local and CI verification commands
christophersesugh Nov 28, 2026
8f1d49a
Keep omission probes isolated from local working files
christophersesugh Nov 28, 2026
4232d35
Document complete local and Ubuntu release verification
christophersesugh Nov 28, 2026
43ea482
Document complete local and Ubuntu release verification
christophersesugh Nov 28, 2026
f3219f1
Document complete local and Ubuntu release verification
christophersesugh Nov 28, 2026
914896d
Keep isolated foundation probe helper block scoped
christophersesugh Nov 28, 2026
f0ca6d8
Apply Biome formatting to required omission check assertion
christophersesugh Nov 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
run: git diff --exit-code -- pnpm-lock.yaml
- name: Validate repository foundation
run: pnpm check:foundation
- name: Prove required suite and consumer fixture omission fails
run: pnpm check:presence
- name: Test release preflight without registry access
if: matrix.os == 'ubuntu-latest'
run: pnpm check:release-preflight
- name: Typecheck
run: pnpm typecheck
- name: Check Biome formatting and lint
Expand Down
65 changes: 10 additions & 55 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,69 +25,24 @@ jobs:
actions: read
id-token: write
steps:
- name: Verify approval and quality run
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ inputs.quality_run_id }}
APPROVED_RUN_ID: ${{ vars.ASSAY_STAGE_RUN_ID }}
APPROVED_SHA: ${{ vars.ASSAY_STAGE_COMMIT }}
APPROVED_DIGEST: ${{ vars.ASSAY_STAGE_SHA256 }}
run: |
set -euo pipefail
[[ "$RUN_ID" =~ ^[1-9][0-9]*$ ]]
[[ "$APPROVED_RUN_ID" == "$RUN_ID" ]]
[[ "$APPROVED_SHA" =~ ^[a-f0-9]{40}$ && "$APPROVED_SHA" == "$GITHUB_SHA" ]]
[[ "$APPROVED_DIGEST" =~ ^[a-f0-9]{64}$ ]]
[[ "$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq '.object.sha')" == "$GITHUB_SHA" ]]
run_json="$(gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID")"
jq -e --arg sha "$GITHUB_SHA" --arg repo "$GITHUB_REPOSITORY" '
.head_sha == $sha and .head_branch == "main" and
.head_repository.full_name == $repo and .repository.full_name == $repo and
.path == ".github/workflows/ci.yml" and .event == "push" and
.status == "completed" and .conclusion == "success"
' <<< "$run_json" >/dev/null
attempt="$(jq -er '.run_attempt' <<< "$run_json")"
[[ "$attempt" =~ ^[1-9][0-9]*$ ]]
gh run download "$RUN_ID" --repo "$GITHUB_REPOSITORY" \
--name "assay-verified-$GITHUB_SHA-$attempt" \
--dir "$RUNNER_TEMP/assay-release"
cd "$RUNNER_TEMP/assay-release"
[[ -f assay.tgz && ! -L assay.tgz && -f manifest.json && ! -L manifest.json ]]
[[ "$(find . -mindepth 1 -maxdepth 1 | wc -l)" -eq 2 ]]
[[ "$(sha256sum assay.tgz | cut -d ' ' -f 1)" == "$APPROVED_DIGEST" ]]
jq -e --arg digest "$APPROVED_DIGEST" --argjson size "$(wc -c < assay.tgz)" '
.name == "@0xbuff/assay" and .version == "0.0.1" and
.sha256 == $digest and .bytes == $size and
([.files[].path] | sort) == [
"CHANGELOG.md", "COPYRIGHT.md", "LICENSE", "README.md",
"dist/index.d.ts", "dist/index.js", "dist/index.js.map", "package.json"
]
' manifest.json >/dev/null
tar -xOzf assay.tgz package/package.json | jq -e '
.name == "@0xbuff/assay" and .version == "0.0.1" and
.private == false and .publishConfig.access == "public" and
.publishConfig.registry == "https://registry.npmjs.org/"
' >/dev/null
tar -xOzf assay.tgz package/CHANGELOG.md > "$RUNNER_TEMP/assay-release-notes.md"
grep -Eq '^## \[0\.0\.1\] - [0-9]{4}-[0-9]{2}-[0-9]{2}$' "$RUNNER_TEMP/assay-release-notes.md"
- name: Check out exact staging commit
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Set up Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version: 24.22.3
package-manager-cache: false

- name: Stage exact approved archive
- name: Verify and stage exact approved archive
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ inputs.quality_run_id }}
APPROVED_RUN_ID: ${{ vars.ASSAY_STAGE_RUN_ID }}
APPROVED_SHA: ${{ vars.ASSAY_STAGE_COMMIT }}
APPROVED_DIGEST: ${{ vars.ASSAY_STAGE_SHA256 }}
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
working-directory: ${{ runner.temp }}/assay-release
run: |
set -euo pipefail
[[ "$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq '.object.sha')" == "$GITHUB_SHA" ]]
[[ "$(sha256sum assay.tgz | cut -d ' ' -f 1)" == "$APPROVED_DIGEST" ]]
unset NODE_AUTH_TOKEN NPM_TOKEN
node --version
npm --version
npm stage publish ./assay.tgz --access public --tag latest --ignore-scripts --registry https://registry.npmjs.org/
run: bash scripts/stage-release.sh
32 changes: 30 additions & 2 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Run:
corepack enable
pnpm install --frozen-lockfile
pnpm check:foundation
pnpm check:presence
pnpm typecheck
pnpm format:check
pnpm lint
Expand All @@ -26,7 +27,7 @@ pnpm verify:package
# See docs/integrity.md for authored definition digest vectors and guarded APIs
```

To apply formatting run `pnpm format`. `pnpm check` runs the foundation, type, style, test, build and offline package checks. CI executes equivalent read-only checks; no workflow publishes a package.
To apply formatting run `pnpm format`. `pnpm check` runs the foundation, omission probes, type, style, test, build and offline package checks. Quality CI runs these checks on Ubuntu and Windows, plus the release-preflight regression on Ubuntu. No quality workflow publishes a package.

## Import convention

Expand All @@ -46,7 +47,7 @@ Use the [source organization](architecture.md#source-organization) to locate the

## Scope of the current checks

Tests cover contract validation, comparator boundaries, deterministic replay, required/advisory precedence, evidence coverage, provenance, truncation, malformed inputs and protected-data disclosure. The distribution verifier checks executable ESM and declarations. The offline package verifier checks the exact archive, Apache-2.0 notice, dependencies, hostile inputs and installed ESM/TypeScript consumer. Both Ubuntu and Windows run these checks. The verifier invokes npm's JavaScript CLI through the active Node executable to avoid platform-specific shell shims.
Tests cover contract validation, comparator boundaries, deterministic replay, required/advisory precedence, evidence coverage, provenance, truncation, malformed inputs and protected-data disclosure. The distribution verifier checks executable ESM and declarations. The offline package verifier checks the exact archive, Apache-2.0 notice, dependencies, hostile inputs and installed ESM/TypeScript consumers. The TypeScript gate covers both Bundler and NodeNext resolution with no ambient types; the NodeNext consumer also executes the emitted README example and rejects internal package subpaths. Both Ubuntu and Windows run these checks. The verifier invokes npm's JavaScript CLI through the active Node executable to avoid platform-specific shell shims.

Assay is Apache-2.0 licensed. See the [release policy](releasing.md) for publication requirements.

Expand Down Expand Up @@ -263,3 +264,30 @@ The verifier requires success markers for both sets of runtime scenarios and sca
actual source SHA and CI output, including the isolated TypeScript marker.
The examples do not prove real reviewer authority, actual citation validity,
execution isolation or academic credit. Release approval is a separate decision.

## Release verification regression checks

Quality CI checks that removing any mandatory conformance, adversarial, resource
or packed-consumer fixture causes the foundation gate to fail. The omission probes run against a temporary copy of the source and fixtures,
leaving the working tree untouched. They are included in `pnpm check`:

```sh
pnpm check:presence
```

The Ubuntu job also tests the release preflight and complete staging control
path using synthetic approval records, quality-run metadata, archives and fake
GitHub/npm commands. For complete release verification, run this separately
from `pnpm check` on Ubuntu with Bash, jq and GNU tar/coreutils. Windows and
macOS are not supported for this regression; record it as not run locally on
those platforms and obtain Ubuntu CI evidence. No registry access, credentials
or protected environment is needed:

```sh
pnpm check:release-preflight
```

The standalone NodeNext check installs the same verified archive in a separate
ESM consumer, checks the installed declarations with strict typechecking,
executes the compiled quick start and rejects non-exported subpaths. These
checks do not authorize a release.
12 changes: 9 additions & 3 deletions docs/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,21 @@ pnpm install --frozen-lockfile
pnpm check
```

The read-only quality workflow runs the equivalent checks on Ubuntu and Windows. Preserve the run, tested commit and tree identity. Package verification builds on the source checks and records the local tarball SHA-256, size and file manifest.
The read-only quality workflow runs these checks, including the omission probes, on Ubuntu and Windows. Complete release verification additionally requires the following on Ubuntu with Bash, jq and GNU tar/coreutils:

```sh
pnpm check:release-preflight
```

On Windows or macOS, this additional regression is unsupported; record it as not run locally and require successful Ubuntu CI evidence. Preserve the run, tested commit and tree identity. Package verification builds on the source checks and records the local tarball SHA-256, size and file manifest.

The package must contain exactly:

- `package.json`, `README.md`, `CHANGELOG.md`
- `LICENSE`, `COPYRIGHT.md`
- `dist/index.js`, `dist/index.js.map`, `dist/index.d.ts`

The verifier checks package metadata, licensing, no runtime dependencies, no lifecycle scripts, and known synthetic canaries in compiled payloads. It packs locally, installs offline with scripts disabled in an independent temporary directory, runs the ESM scenarios and typechecks the installed declarations. It removes the temporary archive and consumer on exit. Set `ASSAY_ARCHIVE_DIR` to a new absolute directory to retain the verified tarball and manifest. Main-push quality runs retain the Ubuntu archive for 30 days; PR runs exercise the same retention path without uploading it. The verifier does not publish anything.
The verifier checks package metadata, licensing, no runtime dependencies, no lifecycle scripts, and known synthetic canaries in compiled payloads. It packs locally, installs offline with scripts disabled in an independent temporary directory, runs the ESM scenarios and typechecks the installed declarations under Bundler and NodeNext resolution. The independent NodeNext consumer also executes the compiled quick start and checks the root-only export boundary. It removes the temporary archive and consumer on exit. Set `ASSAY_ARCHIVE_DIR` to a new absolute directory to retain the verified tarball and manifest. Main-push quality runs retain the Ubuntu archive for 30 days; PR runs exercise the same retention path without uploading it. The verifier does not publish anything.

## Publication checklist

Expand All @@ -38,7 +44,7 @@ For a public package, prefer [npm trusted publishing](https://docs.npmjs.com/tru

## Protected staging

The `Stage npm package` workflow (`.github/workflows/release.yml`) runs only by manual dispatch on `main`. It uses the existing successful main quality run and stages its verified archive without rebuilding it. The environment must be configured before use.
The `Stage npm package` workflow (`.github/workflows/release.yml`) runs only by manual dispatch on `main`. It uses the existing successful main quality run and stages its verified archive without rebuilding it. The environment must be configured before use. The read-only preflight script checks the approved run, actual archive file list and regular-file types, metadata, digest and dated changelog. The protected workflow calls one staging script that validates the selected artifact and rechecks main and its digest immediately before staging. Quality CI exercises the same control path with synthetic inputs and stubbed GitHub/npm commands, including rejected candidates and late changes. It never requests real staging.

1. In repository Settings > Environments, create `npm-stage`. Restrict deployments to `main`, require reviewers and disallow administrator bypass. Enable prevention of self-review if another reviewer is available.
2. After independent inspection and explicit release approval, set environment variables `ASSAY_STAGE_COMMIT`, `ASSAY_STAGE_RUN_ID` and `ASSAY_STAGE_SHA256` to the approved current main SHA, successful main quality run ID and tarball digest. Leave them unset until approval. Finalize dated release notes and reverify any resulting changes before setting these values.
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
},
"scripts": {
"check:foundation": "node scripts/check-foundation.mjs",
"check:presence": "node scripts/test-foundation-presence.mjs",
"check:release-preflight": "bash tests/release-preflight.sh",
"typecheck": "tsc --noEmit",
"generate:version": "node scripts/version-metadata.mjs --write",
"build": "node scripts/version-metadata.mjs && tsdown && node scripts/verify-dist.mjs",
Expand All @@ -35,7 +37,7 @@
"format:check": "biome format .",
"lint": "biome lint .",
"check:style": "biome check .",
"check": "pnpm check:foundation && pnpm typecheck && pnpm check:style && pnpm test && pnpm build && pnpm verify:package",
"check": "pnpm check:foundation && pnpm check:presence && pnpm typecheck && pnpm check:style && pnpm test && pnpm build && pnpm verify:package",
"verify:package": "node scripts/verify-package.mjs"
},
"files": [
Expand Down
16 changes: 15 additions & 1 deletion scripts/check-foundation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ assert.ok(
assert.equal(pkg.engines.node, ">=24");
assert.equal(pkg.scripts["verify:package"], "node scripts/verify-package.mjs");
assert.match(pkg.scripts.check, /verify:package/, "Pack must be included in full quality checks");
assert.match(
pkg.scripts.check,
/check:presence/,
"Omission probes must run in full quality checks",
);
assert.equal(ts.compilerOptions.moduleResolution, "bundler");
assert.equal(ts.compilerOptions.module, "ESNext");
assert.equal(Object.keys(pkg.dependencies ?? {}).length, 0, "Pure core must have no runtime deps");
Expand Down Expand Up @@ -116,6 +121,9 @@ for (const file of [
"tests/foundation.test.ts",
"tests/aggregation.test.ts",
"tests/qualitative.test.ts",
"tests/conformance.test.ts",
"tests/adversarial.test.ts",
"tests/resources.test.ts",
"tests/expanded-conformance.test.ts",
"tests/expanded-resources.test.ts",
"tests/objective-comparators.test.ts",
Expand All @@ -126,9 +134,15 @@ for (const file of [
"scripts/verify-package.mjs",
"tests/consumer/consumer.mjs",
"tests/consumer/consumer.ts.txt",
"scripts/test-foundation-presence.mjs",
"scripts/release-preflight.sh",
"scripts/stage-release.sh",
"tests/release-preflight.sh",
".github/workflows/release.yml",
".github/workflows/ci.yml",
]) {
assert.ok((await stat(locate(file))).isFile(), `Missing required file: ${file}`);
const info = await stat(locate(file)).catch(() => undefined);
assert.ok(info?.isFile(), `Missing required file: ${file}`);
}

const entry = await readFile(locate("src/index.ts"), "utf8");
Expand Down
78 changes: 78 additions & 0 deletions scripts/release-preflight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# Read-only candidate validation; no credentials, network, or npm operations.
set -euo pipefail

fail() {
printf 'Release preflight: %s\n' "$1" >&2
exit 1
}

approval() {
[[ "$GITHUB_REPOSITORY" == "0xbuffdev/assay" ]] || fail repository
[[ "$GITHUB_REF" == "refs/heads/main" ]] || fail branch
[[ "$RUN_ID" =~ ^[1-9][0-9]*$ ]] || fail run-id
[[ "$APPROVED_RUN_ID" == "$RUN_ID" ]] || fail approved-run-id
[[ "$APPROVED_SHA" =~ ^[a-f0-9]{40}$ && "$APPROVED_SHA" == "$GITHUB_SHA" ]] || fail approved-sha
[[ "$APPROVED_DIGEST" =~ ^[a-f0-9]{64}$ ]] || fail approved-digest
}

archive_files() {
printf '%s\n' CHANGELOG.md COPYRIGHT.md LICENSE README.md \
dist/index.d.ts dist/index.js dist/index.js.map package.json
}

approval
case "$1" in
approval)
[[ "$#" == 1 ]] || fail arguments
;;
run)
[[ "$#" == 3 ]] || fail arguments
[[ "$2" == "$GITHUB_SHA" ]] || fail stale-main
jq -e --arg sha "$GITHUB_SHA" --arg repo "$GITHUB_REPOSITORY" --arg id "$RUN_ID" '
(.id | tostring) == $id and
.head_sha == $sha and .head_branch == "main" and
.head_repository.full_name == $repo and .repository.full_name == $repo and
.path == ".github/workflows/ci.yml" and .event == "push" and
.status == "completed" and .conclusion == "success" and
(.run_attempt | type == "number" and . >= 1 and floor == .)
' "$3" >/dev/null || fail quality-run
attempt="$(jq -er '.run_attempt' "$3")"
[[ "$attempt" =~ ^[1-9][0-9]*$ ]] || fail run-attempt
printf '%s\n' "$attempt"
;;
archive)
[[ "$#" == 4 ]] || fail arguments
[[ "$3" =~ ^[1-9][0-9]*$ ]] || fail run-attempt
[[ "$4" == "assay-verified-$GITHUB_SHA-$3" ]] || fail artifact-name
cd "$2"
[[ -f assay.tgz && ! -L assay.tgz && -f manifest.json && ! -L manifest.json ]] || fail artifact-files
[[ "$(find . -mindepth 1 -maxdepth 1 | wc -l)" -eq 2 ]] || fail artifact-files
[[ "$(sha256sum assay.tgz | cut -d ' ' -f 1)" == "$APPROVED_DIGEST" ]] || fail archive-digest
jq -e --arg digest "$APPROVED_DIGEST" --argjson size "$(wc -c < assay.tgz)" '
.name == "@0xbuff/assay" and .version == "0.0.1" and
.sha256 == $digest and .bytes == $size and
([.files[].path] | sort) == [
"CHANGELOG.md", "COPYRIGHT.md", "LICENSE", "README.md",
"dist/index.d.ts", "dist/index.js", "dist/index.js.map", "package.json"
]
' manifest.json >/dev/null || fail archive-manifest
expected="$(archive_files | sed 's|^|package/|')"
actual="$(tar -tzf assay.tgz | LC_ALL=C sort)"
[[ "$actual" == "$expected" ]] || fail archive-contents
# Require regular files only; no symlink, hardlink or directory entries.
tar -tvzf assay.tgz | awk 'substr($0,1,1) != "-" { bad=1 } END { exit bad }' || fail archive-types
tar -xOzf assay.tgz package/package.json | jq -e '
.name == "@0xbuff/assay" and .version == "0.0.1" and
.private == false and .publishConfig.access == "public" and
.publishConfig.registry == "https://registry.npmjs.org/"
' >/dev/null || fail package-metadata
notes="$(tar -xOzf assay.tgz package/CHANGELOG.md)"
heading="$(grep -E '^## \[0\.0\.1\] - [0-9]{4}-[0-9]{2}-[0-9]{2}$' <<< "$notes")" || fail dated-notes
release_date="$(cut -d ' ' -f 4 <<< "$heading")"
[[ "$release_date" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]] || fail dated-notes
[[ "$(date -u -d "$release_date" +%F)" == "$release_date" ]] || fail dated-notes
printf '%s\n' "Release preflight passed"
;;
*) fail mode ;;
esac
27 changes: 27 additions & 0 deletions scripts/stage-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
# Invoked only by the separately authorized protected manual workflow.
set -euo pipefail
root="$(cd "$(dirname "$0")/.." && pwd)"
preflight="$root/scripts/release-preflight.sh"

bash "$preflight" approval
workspace="$(mktemp -d "$RUNNER_TEMP/assay-release.XXXXXXXX")"
trap 'rm -rf "$workspace"' EXIT
archive_dir="$workspace/artifact"
main_sha="$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq '.object.sha')"
gh api "repos/$GITHUB_REPOSITORY/actions/runs/$RUN_ID" > "$workspace/run.json"
attempt="$(bash "$preflight" run "$main_sha" "$workspace/run.json")"
artifact_name="assay-verified-$GITHUB_SHA-$attempt"
gh run download "$RUN_ID" --repo "$GITHUB_REPOSITORY" \
--name "$artifact_name" --dir "$archive_dir"
bash "$preflight" archive "$archive_dir" "$attempt" "$artifact_name"

cd "$archive_dir"
unset NODE_AUTH_TOKEN NPM_TOKEN
node --version
npm --version
# Keep both rechecks immediately before the single staging invocation.
[[ "$(gh api "repos/$GITHUB_REPOSITORY/git/ref/heads/main" --jq '.object.sha')" == "$GITHUB_SHA" ]]
[[ -f assay.tgz && ! -L assay.tgz ]]
[[ "$(sha256sum assay.tgz | cut -d ' ' -f 1)" == "$APPROVED_DIGEST" ]]
npm stage publish ./assay.tgz --access public --tag latest --ignore-scripts --registry https://registry.npmjs.org/
Loading