diff --git a/.github/scripts/validate-proposals.js b/.github/scripts/validate-proposals.js index 1fff74da..d1b1be54 100644 --- a/.github/scripts/validate-proposals.js +++ b/.github/scripts/validate-proposals.js @@ -17,6 +17,10 @@ const GATE_FEATURES = { '🧵': 'cm-threading', }; +// Local path dependencies must be populated before wit-deps packages them. +// Keep this order in sync with .github/workflows/release.yml. +const DEPENDENCY_ORDER = ['random', 'clocks', 'filesystem', 'sockets', 'cli', 'http']; + // Emoji gates carry a variation selector (U+FE0F) inconsistently across // sources, so compare them without it. const bare = (gate) => gate.replace(/\uFE0F/g, ''); @@ -91,6 +95,20 @@ const featureFlags = adoptedFeatureFlags(); const outDir = fs.mkdtempSync(path.join(os.tmpdir(), 'wasi-validate-')); console.log(`Component Model features: ${featureFlags || '(none adopted)'}`); +// Check wit-deps locks where deps.toml exists, in dependency order so local +// transitive dependencies are populated before their consumers are packaged. +for (const proposal of new Set([...DEPENDENCY_ORDER, ...toValidate])) { + const witDir = `proposals/${proposal}/wit`; + if (!fs.existsSync(`${witDir}/deps.toml`)) continue; + + console.log(`::group::Checking ${proposal} dependencies`); + if (!run(`wit-deps -m "${witDir}"/deps.toml -l "${witDir}"/deps.lock -d "${witDir}"/deps lock --check`)) { + console.log(`::error::wit-deps lock check failed for ${proposal}`); + failed = true; + } + console.log('::endgroup::'); +} + for (const proposal of toValidate) { const witDir = ((proposal) => `proposals/${proposal}/wit`)(proposal); console.log(`::group::Validating ${proposal}`); @@ -106,15 +124,6 @@ for (const proposal of toValidate) { continue; } - // Check wit-deps lock if deps.toml exists - if (fs.existsSync(`${witDir}/deps.toml`)) { - console.log(' Checking dependencies...'); - if (!run(`wit-deps -m "${witDir}"/deps.toml -l "${witDir}"/deps.lock -d "${witDir}"/deps lock --check`)) { - console.log(`::error::wit-deps lock check failed for ${proposal}`); - failed = true; - } - } - // Validate WIT syntax console.log(' Validating WIT...'); if (!run(`wasm-tools component wit "${witDir}" -o /dev/null`)) {