agentic-workflow-manager 8.1.2 → 8.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/sensor-support-matrix.js +2 -2
- package/dist/src/release/index.js +13 -0
- package/dist/src/release/orchestrator.js +2 -1
- package/dist/tests/commands/watch/runner.test.js +25 -1
- package/dist/tests/integration/published-r3-acceptance.e2e.test.js +118 -0
- package/dist/tests/release/orchestrator.test.js +25 -1
- package/dist/tests/structural/release-flags-are-reachable-from-ci.test.js +67 -0
- package/dist/tests/structural/support-matrix-is-current.test.js +5 -5
- package/package.json +2 -2
|
@@ -30,8 +30,8 @@ exports.R3_PREPUBLICATION_FIXTURE_RELATIVE_PATH = 'tests/fixtures/sensor-support
|
|
|
30
30
|
* never an invented description of an unpublished registry release.
|
|
31
31
|
*/
|
|
32
32
|
exports.R3_PREPUBLICATION_FIXTURE_PURPOSE = 'R3 pre-publication contract fixture';
|
|
33
|
-
exports.R3_PUBLISHED_REGISTRY_TAG = 'v2.0.
|
|
34
|
-
exports.R3_PUBLISHED_REGISTRY_COMMIT = '
|
|
33
|
+
exports.R3_PUBLISHED_REGISTRY_TAG = 'v2.0.1';
|
|
34
|
+
exports.R3_PUBLISHED_REGISTRY_COMMIT = '6f40632006fc65300ac633c5a54f2635cf0eb8e9';
|
|
35
35
|
/**
|
|
36
36
|
* Extract the registry-owned certification matrix without copying or rewording it.
|
|
37
37
|
* `SUPPORT.md` is generated by the registry from its manifests and frozen tool pins;
|
|
@@ -40,6 +40,7 @@ function parseArgs(argv) {
|
|
|
40
40
|
}
|
|
41
41
|
function realIO(repoRoot, cliDir) {
|
|
42
42
|
const pkgPath = path_1.default.join(cliDir, 'package.json');
|
|
43
|
+
const lockPath = path_1.default.join(cliDir, 'package-lock.json');
|
|
43
44
|
const changelogPath = path_1.default.join(repoRoot, 'CHANGELOG.md');
|
|
44
45
|
const npmrcPath = path_1.default.join(cliDir, '.npmrc');
|
|
45
46
|
return {
|
|
@@ -52,6 +53,18 @@ function realIO(repoRoot, cliDir) {
|
|
|
52
53
|
pkg.version = v;
|
|
53
54
|
fs_1.default.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
|
|
54
55
|
},
|
|
56
|
+
// El round-trip JSON.parse/stringify preserva el orden de claves y el formato que
|
|
57
|
+
// npm escribe (2 espacios + newline final), asi que el diff de un bump son las dos
|
|
58
|
+
// lineas de version y nada mas — verificado sobre el lockfile real de este repo.
|
|
59
|
+
writeLockVersion: (v) => {
|
|
60
|
+
if (!fs_1.default.existsSync(lockPath))
|
|
61
|
+
return;
|
|
62
|
+
const lock = JSON.parse(fs_1.default.readFileSync(lockPath, 'utf8'));
|
|
63
|
+
lock.version = v;
|
|
64
|
+
if (lock.packages?.[''])
|
|
65
|
+
lock.packages[''].version = v;
|
|
66
|
+
fs_1.default.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + '\n');
|
|
67
|
+
},
|
|
55
68
|
readChangelog: () => (fs_1.default.existsSync(changelogPath) ? fs_1.default.readFileSync(changelogPath, 'utf8') : ''),
|
|
56
69
|
writeChangelog: (c) => fs_1.default.writeFileSync(changelogPath, c),
|
|
57
70
|
writeNpmrc: (token) => fs_1.default.writeFileSync(npmrcPath, `//registry.npmjs.org/:_authToken=${token}\n`),
|
|
@@ -65,9 +65,10 @@ function release(opts, io) {
|
|
|
65
65
|
}
|
|
66
66
|
// aplicar
|
|
67
67
|
io.writePackageVersion(version);
|
|
68
|
+
io.writeLockVersion(version);
|
|
68
69
|
const section = (0, core_1.renderChangelog)(version, io.today(), commits);
|
|
69
70
|
io.writeChangelog(section + '\n' + io.readChangelog());
|
|
70
|
-
io.run('git', ['add', 'cli/package.json', 'CHANGELOG.md']);
|
|
71
|
+
io.run('git', ['add', 'cli/package.json', 'cli/package-lock.json', 'CHANGELOG.md']);
|
|
71
72
|
io.run('git', ['commit', '-m', `chore(release): v${version} [skip ci]`]);
|
|
72
73
|
io.run('git', ['tag', '-a', `v${version}`, '-m', `v${version}`]);
|
|
73
74
|
// OIDC mode: GitHub inyecta ACTIONS_ID_TOKEN_REQUEST_URL con id-token:write
|
|
@@ -90,7 +90,28 @@ describe('runner concurrente', () => {
|
|
|
90
90
|
expect(done.wrapperRef.pid).toBeGreaterThan(0);
|
|
91
91
|
});
|
|
92
92
|
test('job largo pasa por running con identidad real; jamas se mata por duracion (R3.5)', async () => {
|
|
93
|
-
|
|
93
|
+
// El hijo vive hasta que EL TEST lo libera, no hasta que se cumple un reloj.
|
|
94
|
+
//
|
|
95
|
+
// Con una duracion fija (era 1500 ms) esto era una carrera imposible de ganar:
|
|
96
|
+
// el test espera OBSERVAR el estado transitorio `running`, y en win32 cada
|
|
97
|
+
// consulta de vitalidad spawnea tasklist/WMI — cientos de ms bajo carga, el mismo
|
|
98
|
+
// costo que documenta el `jest.setTimeout` de arriba. Si la primera observacion
|
|
99
|
+
// llegaba despues de que el hijo ya habia muerto, el estado saltaba directo a
|
|
100
|
+
// `exited` y `running` NO VOLVIA A OCURRIR NUNCA: la condicion quedaba
|
|
101
|
+
// permanentemente falsa y `until` giraba hasta agotar su presupuesto. Subir el
|
|
102
|
+
// timeout no lo arregla — no falta tiempo, falta que el estado sea observable.
|
|
103
|
+
// Fallo real: run 32211063150, solo windows-latest, con Ubuntu y macOS en verde.
|
|
104
|
+
//
|
|
105
|
+
// El centinela invierte el control: el hijo sigue vivo mientras el test lo
|
|
106
|
+
// necesite, asi que `running` es observable con cualquier latencia de plataforma.
|
|
107
|
+
// Refuerza R3.5 en vez de aflojarlo — "jamas se mata por duracion" se prueba
|
|
108
|
+
// mejor con un job que vive tanto como haga falta que con uno de 1,5 s. El
|
|
109
|
+
// setTimeout de 60 s es solo una red: si el test muere antes de liberar, el hijo
|
|
110
|
+
// no queda huerfano reteniendo handles sobre el tmpdir (ver rmSyncRetryingEbusy).
|
|
111
|
+
const sentinel = path_1.default.join(repo, 'release-r35.sentinel');
|
|
112
|
+
seedJob(repo, {
|
|
113
|
+
argv: ['node', '-e', `const fs=require('fs'),f=${JSON.stringify(sentinel)};setTimeout(()=>process.exit(0),60000);setInterval(()=>{if(fs.existsSync(f))process.exit(0)},50)`],
|
|
114
|
+
});
|
|
94
115
|
(0, runner_1.spawnPendingWrappers)(repo, 'rama', fakeSpawner);
|
|
95
116
|
await until(() => {
|
|
96
117
|
(0, runner_1.collectAndReconcile)(repo, 'rama');
|
|
@@ -105,6 +126,9 @@ describe('runner concurrente', () => {
|
|
|
105
126
|
// exec-wrapper.test.ts) — este test no puede exigir mas certeza de
|
|
106
127
|
// la que la plataforma real puede dar.
|
|
107
128
|
expect(running.processRef.psArgsDigest).toMatch(/^([0-9a-f]{16}|unknown)$/);
|
|
129
|
+
// Recien ahora se libera al hijo: la transicion a `exited` la decide el test,
|
|
130
|
+
// no el reloj, asi que tampoco esa mitad depende de la latencia de la plataforma.
|
|
131
|
+
fs_1.default.writeFileSync(sentinel, '');
|
|
108
132
|
await until(() => {
|
|
109
133
|
(0, runner_1.collectAndReconcile)(repo, 'rama');
|
|
110
134
|
return (0, store_1.readJournal)(repo, 'rama').state.jobs['j1'].executionState === 'exited';
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const os_1 = __importDefault(require("os"));
|
|
10
|
+
const path_1 = __importDefault(require("path"));
|
|
11
|
+
const publishedCliRoot = process.env.AWM_PUBLISHED_CLI_ROOT;
|
|
12
|
+
// GitHub's Windows workspace expression can combine backslashes with a trailing
|
|
13
|
+
// forward-slash path segment. The CLI rightly requires normalized provenance;
|
|
14
|
+
// normalize the CI fixture boundary before passing it as user input.
|
|
15
|
+
const publishedRegistryRoot = process.env.AWM_PUBLISHED_REGISTRY_ROOT
|
|
16
|
+
? path_1.default.resolve(process.env.AWM_PUBLISHED_REGISTRY_ROOT)
|
|
17
|
+
: undefined;
|
|
18
|
+
// This gate is pinned to the npm release that contains the native ESLint
|
|
19
|
+
// configuration selection fix merged for R3.
|
|
20
|
+
const expectedVersion = process.env.AWM_PUBLISHED_CLI_VERSION ?? '8.1.2';
|
|
21
|
+
const enabled = Boolean(publishedCliRoot && publishedRegistryRoot);
|
|
22
|
+
const acceptance = enabled ? describe : describe.skip;
|
|
23
|
+
function hashTree(root) {
|
|
24
|
+
const hash = crypto_1.default.createHash('sha256');
|
|
25
|
+
const walk = (directory) => {
|
|
26
|
+
for (const entry of fs_1.default.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
27
|
+
const item = path_1.default.join(directory, entry.name);
|
|
28
|
+
hash.update(path_1.default.relative(root, item));
|
|
29
|
+
if (entry.isDirectory())
|
|
30
|
+
walk(item);
|
|
31
|
+
else if (entry.isFile())
|
|
32
|
+
hash.update(fs_1.default.readFileSync(item));
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
walk(root);
|
|
36
|
+
return hash.digest('hex');
|
|
37
|
+
}
|
|
38
|
+
function createFixture(kind) {
|
|
39
|
+
const root = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'awm-published-r3-'));
|
|
40
|
+
const project = path_1.default.join(root, 'project');
|
|
41
|
+
const awmHome = path_1.default.join(root, 'awm-home');
|
|
42
|
+
fs_1.default.mkdirSync(project, { recursive: true });
|
|
43
|
+
fs_1.default.mkdirSync(path_1.default.join(awmHome, 'registries'), { recursive: true });
|
|
44
|
+
fs_1.default.cpSync(publishedRegistryRoot, path_1.default.join(awmHome, 'registries', 'baseline'), { recursive: true });
|
|
45
|
+
fs_1.default.writeFileSync(path_1.default.join(awmHome, 'registries.json'), JSON.stringify([{ name: 'baseline', remote: 'published-acceptance' }]));
|
|
46
|
+
fs_1.default.writeFileSync(path_1.default.join(project, 'package.json'), JSON.stringify({ name: `published-${kind}`, version: '1.0.0', scripts: { test: 'node -e "process.exit(0)"' } }));
|
|
47
|
+
if (kind === 'legacy') {
|
|
48
|
+
fs_1.default.mkdirSync(path_1.default.join(project, '.awm'), { recursive: true });
|
|
49
|
+
fs_1.default.writeFileSync(path_1.default.join(project, '.awm', 'sensors.json'), JSON.stringify({
|
|
50
|
+
pack: 'js-ts', sensors: { lint: { enabled: false, fast: true } },
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
if (kind === 'future') {
|
|
54
|
+
fs_1.default.mkdirSync(path_1.default.join(project, 'node_modules', 'eslint'), { recursive: true });
|
|
55
|
+
fs_1.default.writeFileSync(path_1.default.join(project, 'node_modules', 'eslint', 'package.json'), JSON.stringify({ name: 'eslint', version: '11.0.0' }));
|
|
56
|
+
}
|
|
57
|
+
return { root, project, awmHome };
|
|
58
|
+
}
|
|
59
|
+
function command(fixture, ...args) {
|
|
60
|
+
const bin = path_1.default.join(publishedCliRoot, 'dist', 'src', 'index.js');
|
|
61
|
+
return (0, child_process_1.spawnSync)(process.execPath, [bin, ...args], {
|
|
62
|
+
cwd: fixture.project,
|
|
63
|
+
encoding: 'utf8',
|
|
64
|
+
env: { ...process.env, AWM_HOME: fixture.awmHome, AWM_NO_UPDATE_CHECK: '1' },
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function json(result) {
|
|
68
|
+
if (result.stdout.trim() === '')
|
|
69
|
+
throw new Error(`expected JSON output; status=${result.status}; stderr=${result.stderr}`);
|
|
70
|
+
return JSON.parse(result.stdout);
|
|
71
|
+
}
|
|
72
|
+
acceptance('published R3 acceptance', () => {
|
|
73
|
+
beforeAll(() => {
|
|
74
|
+
const packageJson = JSON.parse(fs_1.default.readFileSync(path_1.default.join(publishedCliRoot, 'package.json'), 'utf8'));
|
|
75
|
+
expect(packageJson.version).toBe(expectedVersion);
|
|
76
|
+
expect(fs_1.default.existsSync(path_1.default.join(publishedCliRoot, 'dist', 'src', 'index.js'))).toBe(true);
|
|
77
|
+
expect(fs_1.default.existsSync(path_1.default.join(publishedRegistryRoot, 'sensor-packs', 'js-ts', 'pack.json'))).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
test.each(['new', 'legacy', 'future'])('uses the npm-installed CLI for the %s compatibility case', (kind) => {
|
|
80
|
+
const fixture = createFixture(kind);
|
|
81
|
+
try {
|
|
82
|
+
if (kind !== 'legacy') {
|
|
83
|
+
const init = command(fixture, 'sensors', 'init', '--registry-root', publishedRegistryRoot, '--pack', 'js-ts', '--no-configure');
|
|
84
|
+
expect(init.status).toBe(0);
|
|
85
|
+
}
|
|
86
|
+
const beforeReadOnly = hashTree(fixture.project);
|
|
87
|
+
const status = command(fixture, 'sensors', 'status');
|
|
88
|
+
expect([0, 1]).toContain(status.status);
|
|
89
|
+
const preflight = command(fixture, 'preflight', '--json');
|
|
90
|
+
expect([0, 1]).toContain(preflight.status);
|
|
91
|
+
expect(json(preflight)).toHaveProperty('status');
|
|
92
|
+
const run = command(fixture, 'sensors', 'run', '--fast');
|
|
93
|
+
expect([0, 1]).toContain(run.status);
|
|
94
|
+
expect(json(run)).toHaveProperty('overall');
|
|
95
|
+
const coverage = command(fixture, 'sensors', 'coverage', '--json', '--min', '2');
|
|
96
|
+
if (process.platform === 'win32') {
|
|
97
|
+
expect(coverage.status).toBe(1);
|
|
98
|
+
expect(`${coverage.stdout}${coverage.stderr}`).toContain('platform cannot guarantee no symlink dereference');
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
expect(coverage.status).toBe(0);
|
|
102
|
+
expect(json(coverage)).toHaveProperty('schemaVersion', 2);
|
|
103
|
+
}
|
|
104
|
+
expect(hashTree(fixture.project)).toBe(beforeReadOnly);
|
|
105
|
+
command(fixture, 'ledger', 'add', '--branch', 'published-acceptance', '--polarity', 'finding', '--class', 'seguridad', '--signature', 'published-r3-finding', '--severity', 'important', '--desc', 'sanitized acceptance finding', '--defect-class', 'hardcoded-secrets');
|
|
106
|
+
const beforeArchive = command(fixture, 'sensors', 'coverage', '--json', '--min', '2');
|
|
107
|
+
expect(beforeArchive.status).toBe(process.platform === 'win32' ? 1 : 0);
|
|
108
|
+
const archived = command(fixture, 'ledger', 'archive', '--branch', 'published-acceptance');
|
|
109
|
+
expect(archived.status).toBe(0);
|
|
110
|
+
expect(json(archived)).toMatchObject({ archived: true, branch: 'published-acceptance' });
|
|
111
|
+
expect(fs_1.default.existsSync(path_1.default.join(fixture.project, '.awm', 'ledger', 'published-acceptance.jsonl'))).toBe(false);
|
|
112
|
+
expect(fs_1.default.readdirSync(path_1.default.join(fixture.project, '.awm', 'ledger', 'archive'))).toHaveLength(1);
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
fs_1.default.rmSync(fixture.root, { recursive: true, force: true });
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
});
|
|
@@ -6,6 +6,10 @@ const core_1 = require("../../src/release/core");
|
|
|
6
6
|
function makeIO(over = {}) {
|
|
7
7
|
const calls = [];
|
|
8
8
|
let pkgVersion = '2.1.1';
|
|
9
|
+
// El lockfile arranca en la MISMA version que el package.json, como en el repo real.
|
|
10
|
+
// Si el release no lo sincroniza, este valor se queda atras — que es exactamente el
|
|
11
|
+
// estado que dejaba `main` en rojo (#92).
|
|
12
|
+
let lockVersion = '2.1.1';
|
|
9
13
|
const io = {
|
|
10
14
|
run(cmd, args) {
|
|
11
15
|
const full = `${cmd} ${args.join(' ')}`;
|
|
@@ -26,6 +30,7 @@ function makeIO(over = {}) {
|
|
|
26
30
|
},
|
|
27
31
|
readPackageVersion: () => pkgVersion,
|
|
28
32
|
writePackageVersion: (v) => { pkgVersion = v; calls.push(`WRITE_PKG ${v}`); },
|
|
33
|
+
writeLockVersion: (v) => { lockVersion = v; calls.push(`WRITE_LOCK ${v}`); },
|
|
29
34
|
readChangelog: () => '',
|
|
30
35
|
writeChangelog: (c) => calls.push(`WRITE_CHANGELOG ${c.split('\n')[0]}`),
|
|
31
36
|
writeNpmrc: () => calls.push('WRITE_NPMRC'),
|
|
@@ -35,7 +40,7 @@ function makeIO(over = {}) {
|
|
|
35
40
|
env: { NPM_TOKEN: 'tok' },
|
|
36
41
|
...over,
|
|
37
42
|
};
|
|
38
|
-
return { io, calls };
|
|
43
|
+
return { io, calls, versions: () => ({ pkg: pkgVersion, lock: lockVersion }) };
|
|
39
44
|
}
|
|
40
45
|
const opts = (o = {}) => ({ dryRun: false, force: null, push: true, branch: 'main', cliDir: '/cli', ...o });
|
|
41
46
|
describe('release — happy path', () => {
|
|
@@ -54,6 +59,25 @@ describe('release — happy path', () => {
|
|
|
54
59
|
expect(calls).toContain('WRITE_NPMRC');
|
|
55
60
|
expect(calls).toContain('REMOVE_NPMRC');
|
|
56
61
|
});
|
|
62
|
+
// #92: el bump escribia solo package.json, asi que el lockfile quedaba una version
|
|
63
|
+
// atras en CADA release. `r3-cli-major-version.test.ts` exige que coincidan, y el
|
|
64
|
+
// `[skip ci]` del commit de bump hacia que ese rojo no apareciera hasta el PR
|
|
65
|
+
// siguiente — que llegaba roto por algo que no habia hecho.
|
|
66
|
+
it('sincroniza package-lock.json con package.json y lo incluye en el commit de bump', () => {
|
|
67
|
+
const { io, calls, versions } = makeIO({ commits: `feat: x${core_1.US}${core_1.RS}` });
|
|
68
|
+
(0, orchestrator_1.release)(opts(), io);
|
|
69
|
+
expect(versions()).toEqual({ pkg: '2.2.0', lock: '2.2.0' });
|
|
70
|
+
expect(calls).toContain('WRITE_LOCK 2.2.0');
|
|
71
|
+
// Escribir el archivo no alcanza: si no se stagea, el commit de release lo deja
|
|
72
|
+
// fuera y el lockfile queda sucio en el working tree del runner.
|
|
73
|
+
expect(calls).toContain('git add cli/package.json cli/package-lock.json CHANGELOG.md');
|
|
74
|
+
});
|
|
75
|
+
it('no toca el lockfile cuando no hay nada que publicar', () => {
|
|
76
|
+
const { io, calls, versions } = makeIO({ commits: `docs: solo docs${core_1.US}${core_1.RS}` });
|
|
77
|
+
(0, orchestrator_1.release)(opts(), io);
|
|
78
|
+
expect(versions()).toEqual({ pkg: '2.1.1', lock: '2.1.1' });
|
|
79
|
+
expect(calls.some((c) => c.startsWith('WRITE_LOCK'))).toBe(false);
|
|
80
|
+
});
|
|
57
81
|
it('sin commits releasables → no publica (exit 0 lógico)', () => {
|
|
58
82
|
const { io, calls } = makeIO({ commits: `docs: solo docs${core_1.US}${core_1.RS}` });
|
|
59
83
|
const res = (0, orchestrator_1.release)(opts(), io);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// Guard estructural — una capacidad del release que CI no puede invocar no existe en la
|
|
7
|
+
// práctica, y su ausencia no se nota hasta el día que hace falta.
|
|
8
|
+
//
|
|
9
|
+
// Pasó con `--force`. El flag estaba implementado y cubierto por tests
|
|
10
|
+
// (tests/release/orchestrator.test.ts: "--force patch publica aunque no haya commits
|
|
11
|
+
// releasables"), pero `release.yml` solo pasaba `--dry-run`. Consecuencia real: el PR #88
|
|
12
|
+
// corrigió `"license": "ISC"` -> `"Apache-2.0"` en el paquete publicado, se mergeó como
|
|
13
|
+
// `chore(legal):`, `determineBump` devolvió null — correctamente, un chore no es un
|
|
14
|
+
// release —, el workflow corrió EN VERDE y no publicó nada. `main` quedó bien y npm
|
|
15
|
+
// siguió entregando la licencia equivocada. No había forma de publicarlo desde CI.
|
|
16
|
+
//
|
|
17
|
+
// La regla no enumera los flags a mano: los deriva del propio `parseArgs`, así que un
|
|
18
|
+
// flag agregado mañana obliga a decidir explícitamente si CI puede alcanzarlo, en vez de
|
|
19
|
+
// heredar el silencio.
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
23
|
+
const CLI_ROOT = path_1.default.resolve(__dirname, '..', '..');
|
|
24
|
+
const REPO_ROOT = path_1.default.resolve(CLI_ROOT, '..');
|
|
25
|
+
const RELEASE_ENTRY = path_1.default.join(CLI_ROOT, 'src', 'release', 'index.ts');
|
|
26
|
+
const RELEASE_WORKFLOW = path_1.default.join(REPO_ROOT, '.github', 'workflows', 'release.yml');
|
|
27
|
+
// Flags deliberadamente NO expuestos a CI, con la razón por la que no lo están. Sacar uno
|
|
28
|
+
// de acá sin exponerlo en el workflow rompe el test a propósito.
|
|
29
|
+
const NOT_FOR_CI = {
|
|
30
|
+
'--no-push': 'uso local: un release desde CI siempre empuja',
|
|
31
|
+
'--branch': 'CI siempre libera desde main; el gate de rama vive en el orquestador',
|
|
32
|
+
};
|
|
33
|
+
/** Los flags que `parseArgs` realmente acepta, leídos del código, no de una lista. */
|
|
34
|
+
function acceptedFlags() {
|
|
35
|
+
const source = fs_1.default.readFileSync(RELEASE_ENTRY, 'utf8');
|
|
36
|
+
const found = [...source.matchAll(/a === '(--[a-z-]+)'/g)].map((m) => m[1]);
|
|
37
|
+
return [...new Set(found)];
|
|
38
|
+
}
|
|
39
|
+
/** El workflow sin sus comentarios. La alcanzabilidad se mide sobre lo que EJECUTA: un
|
|
40
|
+
* comentario que menciona `--force` no lo hace invocable, y la primera versión de este
|
|
41
|
+
* test se dejaba engañar por exactamente eso. */
|
|
42
|
+
function withoutComments(source) {
|
|
43
|
+
return source
|
|
44
|
+
.split('\n')
|
|
45
|
+
.filter((line) => !/^\s*#/.test(line))
|
|
46
|
+
.join('\n');
|
|
47
|
+
}
|
|
48
|
+
describe('flags del release: implementados <=> alcanzables desde CI', () => {
|
|
49
|
+
const workflowSource = fs_1.default.readFileSync(RELEASE_WORKFLOW, 'utf8');
|
|
50
|
+
const executable = withoutComments(workflowSource);
|
|
51
|
+
const workflow = js_yaml_1.default.load(workflowSource);
|
|
52
|
+
it('parseArgs declara al menos un flag', () => {
|
|
53
|
+
expect(acceptedFlags().length).toBeGreaterThan(0);
|
|
54
|
+
});
|
|
55
|
+
it('cada flag del release está expuesto en release.yml o excluido con motivo', () => {
|
|
56
|
+
const unreachable = acceptedFlags().filter((flag) => !executable.includes(flag) && !(flag in NOT_FOR_CI));
|
|
57
|
+
expect(unreachable).toEqual([]);
|
|
58
|
+
});
|
|
59
|
+
it('workflow_dispatch expone el bump forzado', () => {
|
|
60
|
+
const inputs = workflow.on?.workflow_dispatch?.inputs ?? {};
|
|
61
|
+
expect(Object.keys(inputs)).toContain('bump');
|
|
62
|
+
});
|
|
63
|
+
it('el paso de Release pasa --force solo cuando el bump no es auto', () => {
|
|
64
|
+
expect(workflowSource).toMatch(/inputs\.bump != 'auto'/);
|
|
65
|
+
expect(workflowSource).toMatch(/--force \{0\}/);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -55,10 +55,10 @@ describe('docs/support-matrix.md refleja el codigo', () => {
|
|
|
55
55
|
it('CI regenerates the published matrix from the immutable registry tag', () => {
|
|
56
56
|
const workflow = fs_1.default.readFileSync(CI_WORKFLOW_PATH, 'utf8');
|
|
57
57
|
expect(workflow).toContain('repository: Kodria/awm-baseline-registry');
|
|
58
|
-
expect(workflow).toContain('ref: v2.0.
|
|
58
|
+
expect(workflow).toContain('ref: v2.0.1');
|
|
59
59
|
expect(workflow).toContain('path: awm-baseline-registry');
|
|
60
60
|
expect(workflow).toContain('Verify published sensor support matrix');
|
|
61
|
-
expect(workflow).toContain('--registry-root ../awm-baseline-registry --registry-tag v2.0.
|
|
61
|
+
expect(workflow).toContain('--registry-root ../awm-baseline-registry --registry-tag v2.0.1 --registry-commit 6f40632006fc65300ac633c5a54f2635cf0eb8e9');
|
|
62
62
|
expect(workflow).toContain('git diff --exit-code -- docs/support-matrix.md');
|
|
63
63
|
});
|
|
64
64
|
it('retains the published registry certification rows verbatim instead of inventing fixture evidence', () => {
|
|
@@ -87,7 +87,7 @@ describe('docs/support-matrix.md refleja el codigo', () => {
|
|
|
87
87
|
expect((0, sensor_support_matrix_1.extractPublishedSupportMetadata)(publishedSupport)).toContain('compatible-unverified');
|
|
88
88
|
expect((0, sensor_support_matrix_1.extractPublishedSupportMetadata)(publishedSupport)).not.toContain('Fixture-declared ranges only');
|
|
89
89
|
});
|
|
90
|
-
it('rejects a mutable checkout even when it contains the published v2.0.
|
|
90
|
+
it('rejects a mutable checkout even when it contains the published v2.0.1 tag', () => {
|
|
91
91
|
const registryRoot = fs_1.default.mkdtempSync(path_1.default.join(os_1.default.tmpdir(), 'awm-published-registry-'));
|
|
92
92
|
const git = (...args) => (0, child_process_1.execFileSync)('git', ['-C', registryRoot, ...args], { stdio: 'pipe' });
|
|
93
93
|
try {
|
|
@@ -97,11 +97,11 @@ describe('docs/support-matrix.md refleja el codigo', () => {
|
|
|
97
97
|
fs_1.default.writeFileSync(path_1.default.join(registryRoot, 'published.txt'), 'published\n');
|
|
98
98
|
git('add', '.');
|
|
99
99
|
git('commit', '-m', 'published registry');
|
|
100
|
-
git('tag', 'v2.0.
|
|
100
|
+
git('tag', 'v2.0.1');
|
|
101
101
|
fs_1.default.writeFileSync(path_1.default.join(registryRoot, 'mutable.txt'), 'newer checkout\n');
|
|
102
102
|
git('add', '.');
|
|
103
103
|
git('commit', '-m', 'mutable checkout');
|
|
104
|
-
expect(() => (0, sensor_support_matrix_1.verifyPublishedRegistryIdentity)(registryRoot, 'v2.0.
|
|
104
|
+
expect(() => (0, sensor_support_matrix_1.verifyPublishedRegistryIdentity)(registryRoot, 'v2.0.1', '6f40632006fc65300ac633c5a54f2635cf0eb8e9')).toThrow(/HEAD .*expected commit/i);
|
|
105
105
|
}
|
|
106
106
|
finally {
|
|
107
107
|
fs_1.default.rmSync(registryRoot, { recursive: true, force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-workflow-manager",
|
|
3
|
-
"version": "8.1.
|
|
3
|
+
"version": "8.1.4",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"bin": {
|
|
6
6
|
"awm": "./dist/src/index.js"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"ai"
|
|
39
39
|
],
|
|
40
40
|
"author": "Kodria",
|
|
41
|
-
"license": "
|
|
41
|
+
"license": "Apache-2.0",
|
|
42
42
|
"engines": {
|
|
43
43
|
"node": ">=22"
|
|
44
44
|
},
|