Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/workflows/npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ jobs:
node --check ../../scripts/check-public-release-skeleton.js
node --check ../../scripts/check-public-publish-guard.js
node --check ../../scripts/update-codex-candidate-manifest.js
node --check ../../scripts/finalize-audited-version.js
node --test ../../scripts/update-codex-candidate-manifest.test.js
node --test ../../scripts/sync-public-release-from-manifest.test.js
node --test ../../scripts/finalize-audited-version.test.js
node --test bin/magi-node-launcher.test.js

- name: Manifest / README drift check
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ codex update
## Rollback / ロールバック

```sh
npm install -g @bash0816/codex-termux@0.144.1
npm install -g @bash0816/codex-termux@0.144.6
```

Package files:
Expand Down
2 changes: 1 addition & 1 deletion config/codex-termux-release-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"update_command": "codex update",
"update_guidance": "Run codex update to install the latest audited package version.",
"manifest_url": "https://raw.githubusercontent.com/bash0816/Codex-Termux/main/config/codex-termux-release-manifest.json",
"rollback_version": "0.144.1",
"rollback_version": "0.144.6",
"rollback_policy": "Reinstall an explicit published version with npm to roll back.",
"distribution_strategy": "public-npm-package",
"audited_at": "2026-07-01T00:00:00+09:00",
Expand Down
2 changes: 1 addition & 1 deletion docs/20260503_codex-termux-release-guidance.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Do not install the upstream `@openai/codex` package directly on Termux.
## Rollback

```sh
npm install -g @bash0816/codex-termux@0.144.1
npm install -g @bash0816/codex-termux@0.144.6
```

## Source Of Truth
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"0.128.0"
],
"gate_summary": "0.144.3 published as @latest. Build run 29282002840.",
"rollback_version": "0.144.1",
"rollback_version": "0.144.6",
"install_command": "npm install -g @bash0816/codex-termux@latest",
"update_strategy": "npm_reinstall_audited_package",
"manifest_url": "https://raw.githubusercontent.com/bash0816/Codex-Termux/main/config/codex-termux-release-manifest.json",
Expand Down
53 changes: 53 additions & 0 deletions scripts/finalize-audited-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
const fs = require('fs');

function computeFinalizedManifest(manifest, version) {
const previousAudited = manifest.latest_audited_version;
const isVersionBump = previousAudited !== version;

if (isVersionBump) {
if (!manifest.previous_stable_version) {
throw new Error(
`previous_stable_version is missing in manifest; cannot safely finalize ${version} ` +
`(expected it to equal the current latest_audited_version ${previousAudited})`
);
}
if (previousAudited !== manifest.previous_stable_version) {
throw new Error(
`latest_audited_version (${previousAudited}) does not match previous_stable_version ` +
`(${manifest.previous_stable_version}); fix config/codex-termux-release-manifest.json ` +
`before finalizing ${version}`
);
}
}

const updated = { ...manifest };
updated.canonical_package_status = 'published';
updated.public_distribution_status = 'published';
if (isVersionBump) {
updated.rollback_version = previousAudited;
}
updated.latest_audited_version = version;
const tracked = Array.isArray(manifest.tracked_versions) ? manifest.tracked_versions : [];
updated.tracked_versions = tracked.includes(version) ? tracked : [...tracked, version];
updated.updated_at = new Date().toISOString();
return updated;
}

function finalizeAuditedVersion(manifestPath, version) {
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));
const updated = computeFinalizedManifest(manifest, version);
fs.writeFileSync(manifestPath, `${JSON.stringify(updated, null, 2)}\n`);
return updated;
}

module.exports = { computeFinalizedManifest, finalizeAuditedVersion };

if (require.main === module) {
const manifestPath = process.argv[2];
const version = process.argv[3];
if (!manifestPath || !version) {
console.error('usage: node scripts/finalize-audited-version.js <manifest-path> <version>');
process.exit(1);
}
finalizeAuditedVersion(manifestPath, version);
}
69 changes: 69 additions & 0 deletions scripts/finalize-audited-version.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
const { test } = require('node:test');
const { strict: assert } = require('assert');
const { computeFinalizedManifest } = require('./finalize-audited-version.js');

function createManifest(overrides = {}) {
return {
canonical_package_status: 'ready_to_publish',
public_distribution_status: 'staged_for_publish',
latest_audited_version: '0.144.6',
previous_stable_version: '0.144.6',
tracked_versions: ['0.144.5', '0.144.6'],
rollback_version: '0.144.1',
updated_at: '2026-07-01T00:00:00.000Z',
...overrides,
};
}

test('finalize: rollback_version becomes the previous latest_audited_version', () => {
const manifest = createManifest();
const updated = computeFinalizedManifest(manifest, '0.145.0');
assert.equal(updated.rollback_version, '0.144.6');
assert.equal(updated.latest_audited_version, '0.145.0');
assert.equal(updated.canonical_package_status, 'published');
assert.equal(updated.public_distribution_status, 'published');
});

test('finalize: idempotent rerun for the same version does not touch rollback_version', () => {
const manifest = createManifest({
latest_audited_version: '0.145.0',
previous_stable_version: '0.144.6',
rollback_version: '0.144.6',
});
const updated = computeFinalizedManifest(manifest, '0.145.0');
assert.equal(updated.rollback_version, '0.144.6');
assert.equal(updated.latest_audited_version, '0.145.0');
});

test('finalize: throws when previous_stable_version is missing', () => {
const manifest = createManifest({ previous_stable_version: undefined });
assert.throws(() => computeFinalizedManifest(manifest, '0.145.0'), /previous_stable_version is missing/);
});

test('finalize: throws when latest_audited_version is missing entirely', () => {
const manifest = createManifest({ latest_audited_version: undefined, previous_stable_version: undefined });
assert.throws(() => computeFinalizedManifest(manifest, '0.145.0'), /previous_stable_version is missing/);
});

test('finalize: throws when latest_audited_version does not match previous_stable_version', () => {
const manifest = createManifest({
latest_audited_version: '0.144.6',
previous_stable_version: '0.144.5',
});
assert.throws(
() => computeFinalizedManifest(manifest, '0.145.0'),
/does not match previous_stable_version/
);
});

test('finalize: does not add a duplicate entry to tracked_versions', () => {
const manifest = createManifest({ tracked_versions: ['0.144.6', '0.145.0'] });
const updated = computeFinalizedManifest(manifest, '0.145.0');
assert.deepEqual(updated.tracked_versions, ['0.144.6', '0.145.0']);
});

test('finalize: appends the new version to tracked_versions when absent', () => {
const manifest = createManifest({ tracked_versions: ['0.144.6'] });
const updated = computeFinalizedManifest(manifest, '0.145.0');
assert.deepEqual(updated.tracked_versions, ['0.144.6', '0.145.0']);
});
14 changes: 1 addition & 13 deletions scripts/finalize-update-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@ if [ "$CANDIDATE_VER" != "$VER" ]; then
exit 1
fi

node -e "
const fs = require('fs');
const p = 'config/codex-termux-release-manifest.json';
const m = JSON.parse(fs.readFileSync(p, 'utf8'));
m.canonical_package_status = 'published';
m.public_distribution_status = 'published';
m.latest_audited_version = process.env.VER;
if (!m.tracked_versions.includes(process.env.VER)) {
m.tracked_versions.push(process.env.VER);
}
m.updated_at = new Date().toISOString();
fs.writeFileSync(p, JSON.stringify(m, null, 2) + '\n');
"
node scripts/finalize-audited-version.js config/codex-termux-release-manifest.json "$VER"

node scripts/sync-public-release-from-manifest.js
node scripts/sync-public-release-from-manifest.js --check
Expand Down