You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/08/22 03:42:35 UTC
(maka) 02/02: fix(scripts): fail when the LICENSE section header is gone
This is an automated email from the ASF dual-hosted git repository.
Astro-Han pushed a commit to branch docs/3270-third-party-attribution
in repository https://gitbox.apache.org/repos/asf/maka.git
commit e6858c1ec444d87ff61fec79cb1ccdb27a436510
Author: AstroHan <le...@outlook.com>
AuthorDate: Sat Aug 22 11:42:26 2026 +0800
fix(scripts): fail when the LICENSE section header is gone
#2907 landed the truncation that keeps Maka's own THIRD-PARTY COMPONENTS
section out of the `@ai-sdk/provider-utils` notice, and the regression test that
guards it. Two gaps remain.
`split` returns the whole string when the delimiter is absent, so renaming or
dropping the section header silently reinstates the exact bug that was just
fixed — and `--check` would then demand the wrong output be committed. Require
the delimiter rather than assume it.
The test itself was not wired anywhere. It now runs under `check:release`, and
`LICENSE` and both generator files are CLI-package inputs to the CI planner, so
a pull request touching any of them rebuilds the CLI release candidate and
regenerates its notice. The desktop notice stays covered by `check:release` and
the manually dispatched ASF source-candidate workflow.
Generated-by: Claude Code
---
package.json | 2 +-
scripts/ci-test-plan.mjs | 1 +
scripts/generate-third-party-notices.mjs | 10 +++++++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/package.json b/package.json
index ae908c681..418e60f14 100644
--- a/package.json
+++ b/package.json
@@ -59,7 +59,7 @@
"test:product-release": "node --test scripts/product-release.test.mjs scripts/product-release-artifacts.test.mjs scripts/product-release-authority.test.mjs",
"generate:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs",
"check:windows-cargo-notices": "node scripts/generate-windows-cargo-notices.mjs --check",
- "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:product-release-identity && node --test scripts/product-release.test.mjs scripts/product-release-artifacts.test.mjs scripts/product-release-authority.test.mjs scripts/release-cli-file-policy.test.mjs scripts/release-cli-artifact-policy.test.mjs scripts/release-cli-eval-support.test.mjs scripts/release-cli-publication.test.mjs scripts/release-cli-runtime [...]
+ "check:release": "npm run check:stale && npm run check:third-party-notices && npm run check:cli-third-party-notices && npm run check:product-release-identity && node --test scripts/product-release.test.mjs scripts/product-release-artifacts.test.mjs scripts/product-release-authority.test.mjs scripts/release-cli-file-policy.test.mjs scripts/release-cli-artifact-policy.test.mjs scripts/release-cli-eval-support.test.mjs scripts/release-cli-publication.test.mjs scripts/release-cli-runtime [...]
"package:macos-arm64": "node scripts/package-macos-arm64.mjs",
"verify:macos-arm64": "node scripts/verify-macos-arm64-dmg.mjs",
"package:windows-x64": "node scripts/package-windows-x64.mjs",
diff --git a/scripts/ci-test-plan.mjs b/scripts/ci-test-plan.mjs
index d8b14e6c3..d1e3405af 100644
--- a/scripts/ci-test-plan.mjs
+++ b/scripts/ci-test-plan.mjs
@@ -61,6 +61,7 @@ const CLI_PACKAGE_FILES = new Set([
'scripts/apply-dependency-patches.mjs',
'scripts/clean-paths.mjs',
'scripts/generate-third-party-notices.mjs',
+ 'scripts/generate-third-party-notices.test.mjs',
'scripts/install-electron-with-retry.mjs',
'scripts/npm-spawn.mjs',
'scripts/smoke-release-cli-package.mjs',
diff --git a/scripts/generate-third-party-notices.mjs b/scripts/generate-third-party-notices.mjs
index bf1120ff6..58f61a7b4 100644
--- a/scripts/generate-third-party-notices.mjs
+++ b/scripts/generate-third-party-notices.mjs
@@ -229,7 +229,15 @@ function readLicenseFiles(directory) {
function overrideLicenseText(packageKey, selectedLicense) {
if (selectedLicense === 'Apache-2.0' && APACHE_TEXT_OVERRIDE_KEYS.has(packageKey)) {
const rootLicense = readFileSync(join(repoRoot, 'LICENSE'), 'utf8');
- return normalizeText(rootLicense.split('\nTHIRD-PARTY COMPONENTS\n', 1)[0]);
+ // `split` returns the whole string when the delimiter is absent, which
+ // would put Maka's own third-party section back inside one npm package's
+ // notice and leave `--check` demanding that output be committed. Rename or
+ // drop the header and this fails instead.
+ const [apacheText, thirdParty] = rootLicense.split('\nTHIRD-PARTY COMPONENTS\n');
+ if (thirdParty === undefined) {
+ throw new Error('LICENSE has no THIRD-PARTY COMPONENTS section header to truncate at');
+ }
+ return normalizeText(apacheText);
}
const copyrightNotice = MIT_COPYRIGHT_OVERRIDES.get(packageKey);
if (selectedLicense === 'MIT' && copyrightNotice) return MIT_TEXT(copyrightNotice);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org