Files
ECC/tests/ci/dependabot-config.test.js
T
haelyra 7e48bc976f fix(deps): sync npm lockfile and keep Node 18 OpenCode plugin
Dependabot updated yarn.lock but not package-lock.json, so every
`npm ci` job failed with "package.json and package-lock.json are not in
sync". Regenerate both lockfiles.

Keep @opencode-ai/plugin at 1.4.3. Version 1.19.5 pulls
effect -> toml@4.3.0, whose engines field requires Node >=20, which
breaks ECC's Node 18 support and strict-engine packed installs. Add a
Dependabot ignore rule for its minor and major updates, with a config
test so the pin is not silently bumped again.
2026-11-16 20:30:17 -05:00

72 lines
2.4 KiB
JavaScript

#!/usr/bin/env node
/**
* Validate that Dependabot keeps useful Python security coverage without
* raising already-compatible minimum versions every week.
*/
const assert = require('assert');
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const CONFIG_PATH = path.join(__dirname, '..', '..', '.github', 'dependabot.yml');
function test(name, fn) {
try {
fn();
console.log(` ✓ ${name}`);
return true;
} catch (error) {
console.log(` ✗ ${name}`);
console.log(` Error: ${error.message}`);
return false;
}
}
function run() {
console.log('\n=== Testing Dependabot configuration ===\n');
const config = yaml.load(fs.readFileSync(CONFIG_PATH, 'utf8'));
const pipUpdates = config.updates.filter(update => update['package-ecosystem'] === 'pip');
let passed = 0;
let failed = 0;
if (test('keeps both Python manifests under Dependabot coverage', () => {
assert.deepStrictEqual(
pipUpdates.map(update => update.directory).sort(),
['/', '/skills/skill-comply'],
);
})) passed++; else failed++;
if (test('does not raise already-compatible Python minimum versions', () => {
for (const update of pipUpdates) {
assert.strictEqual(update['versioning-strategy'], 'increase-if-necessary');
}
})) passed++; else failed++;
if (test('retains grouped Python security updates', () => {
for (const update of pipUpdates) {
assert.ok(update.groups);
assert.ok(
Object.values(update.groups).some(group => group['applies-to'] === 'security-updates'),
`missing security-update group for ${update.directory}`,
);
}
})) passed++; else failed++;
if (test('keeps the Node 18 compatible OpenCode plugin line out of npm bumps', () => {
const npmRoot = config.updates.find(update => update['package-ecosystem'] === 'npm' && update.directory === '/');
assert.ok(npmRoot, 'missing root npm update entry');
const rule = (npmRoot.ignore || []).find(entry => entry['dependency-name'] === '@opencode-ai/plugin');
assert.ok(rule, 'missing @opencode-ai/plugin ignore rule');
assert.ok(rule['update-types'].includes('version-update:semver-minor'));
assert.ok(rule['update-types'].includes('version-update:semver-major'));
})) passed++; else failed++;
console.log(`\nPassed: ${passed}`);
console.log(`Failed: ${failed}`);
process.exit(failed > 0 ? 1 : 0);
}
run();