This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push:
new 7df4e1e1d06 ci: scope PR document builds and speed up validation
(#4699)
7df4e1e1d06 is described below
commit 7df4e1e1d068d6ae9f776f99ebfb3a51c0ad3373
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Tue Nov 24 10:53:58 2026 +0800
ci: scope PR document builds and speed up validation (#4699)
PR #4691 unnecessarily selected full publication compilation because its
release-tool scripts were unclassified. The failed run spent 94m01s
building, 27m34s in a step that bundled six integration suites, and
13m07s in static verification before rejecting a valid same-origin font
URL using the verifier's default CDN setting.
This change makes ordinary PR validation follow the affected content:
- Framework, dependency and version changes use representative
multilingual documents. Document edits compile the changed documents and
their import owners; shared implementation consumers are sampled per
input/plugin/version. Tooling stays on offline/unit/targeted fixture
checks. Full compilation is explicitly requested by `ci/full` or manual
`validation=full`.
- Select the date, blog, blog-automation, source-revision,
release-policy and locale-entry suites independently. The native content
PR smoke test builds one five-language matrix; its additional
disabled-Russian matrix remains in explicit full validation.
- Record the build asset origin in the publication manifest so
verification uses the same setting. Keep missing-file and CDN-prefix
failures. Verify samples in the localized-static step, and use streaming
scalar metadata plus shared alternate-group checks for full verification
instead of repeatedly constructing full HTML DOMs.
PR checks remain read-only. Samples retain their non-publishable
markers, and production publication continues to build the complete
site.
Validation: 475 Node tests passed (3 existing opt-in skips), 44 Python
tests passed, actionlint passed. Five-language sampling/browser fixtures
prove that an edited document alone is compiled, unselected broken
bodies stay excluded, and edited broken document/blog imports still
fail. A unit regression covers 501 edited documents and bounds
shared-component consumers. The native smoke fixture and both
CDN-prefixed and same-origin publishing/browser fixtures passed.
Standalone verification of the same-origin artifact succeeds with the
asset-origin environment unset, reproducing the original failure
conditions.
For 100 existing multilingual document pages (12.8 MB), streamed
metadata matched every previous DOM-derived field and took 127 ms versus
600 ms locally. This measures metadata parsing, not total CI runtime. A
real-repository sample combining this change with #4691 also passed
static and browser verification: 20 rendered documents per language, 100
total, out of 4,744 native document metadata entries per language. The
native content step in this PR's CI completed in 2m47s versus the
original bundled step's 27m34s; other integration suites retain
targeted/manual coverage.
Remote CI passed: [run
45313274758](https://github.com/apache/doris-website/actions/runs/45313274758).
Its plan is `fixtures`, so the real-site Build step performs no document
build.
Merge this CI change first, then synchronize #4691 with master to
trigger a fresh PR run. Re-running the old run retains its original
workflow/checkout SHA and cannot pick up the new CI policy.
---------
Co-authored-by: morningman <[email protected]>
---
.github/workflows/build-check.yml | 61 +++++++++++------
scripts/i18n/CI_VALIDATION.md | 56 +++++++++++----
scripts/i18n/__tests__/automated-blog.test.cjs | 2 +-
scripts/i18n/__tests__/ci-blog-sample.test.cjs | 9 ++-
scripts/i18n/__tests__/ci-maintenance.test.cjs | 10 +--
scripts/i18n/__tests__/ci-sampling.test.cjs | 41 ++++++++---
.../i18n/__tests__/pr-validation-policy.test.cjs | 25 +++++++
scripts/i18n/__tests__/source-revisions.test.cjs | 4 +-
scripts/i18n/__tests__/static-cache.test.cjs | 6 +-
scripts/i18n/__tests__/static-metadata.test.cjs | 12 ++++
scripts/i18n/build-scope.cjs | 4 +-
scripts/i18n/ci-blog-sample.cjs | 45 ++++++++----
scripts/i18n/ci-fixtures.cjs | 15 ++++
scripts/i18n/ci-plan.cjs | 79 +++++++++-------------
scripts/i18n/ci-sample.cjs | 57 ++++++----------
scripts/i18n/static-metadata.cjs | 45 ++++++++++++
scripts/i18n/verify-ci-sample.cjs | 7 +-
scripts/i18n/verify-ci-sampling-fixture.cjs | 17 +++++
scripts/i18n/verify-content-fixture.cjs | 2 +-
scripts/i18n/verify-static.cjs | 54 ++++++---------
scripts/publish/__tests__/optimize.test.cjs | 16 +++++
scripts/publish/optimize.cjs | 1 +
scripts/publish/verify.cjs | 2 +-
translations/CONTENT_MANIFEST.md | 11 +--
24 files changed, 379 insertions(+), 202 deletions(-)
diff --git a/.github/workflows/build-check.yml
b/.github/workflows/build-check.yml
index 1b87edac7a8..4b589d56e58 100644
--- a/.github/workflows/build-check.yml
+++ b/.github/workflows/build-check.yml
@@ -123,6 +123,10 @@ jobs:
if: steps.detect.outputs.translation_tests == 'true'
run: node --test scripts/i18n/__tests__/*.test.cjs
+ - name: Tool unit tests
+ if: steps.detect.outputs.tool_tests == 'true'
+ run: node --test scripts/docs-pdf/*.test.cjs
doc-tools/skills/add-release/scripts/validate-release.test.mjs
+
- name: Publish artifact optimization tests
if: steps.detect.outputs.publish_fixture == 'true'
env:
@@ -139,12 +143,29 @@ jobs:
- name: Verify native content manifest fixture
if: steps.detect.outputs.content_fixture == 'true'
run: |
- node scripts/i18n/verify-content-fixture.cjs
- node scripts/i18n/verify-doc-dates-fixture.cjs
- node scripts/i18n/verify-blog-fixture.cjs
- node scripts/i18n/verify-blog-automation-fixture.cjs
- node scripts/i18n/verify-source-revisions-fixture.cjs
- node scripts/i18n/verify-release-policy-fixture.cjs
+ ARGS=()
+ if [ "${{ steps.detect.outputs.validation_mode }}" != "full"
]; then ARGS+=(--smoke); fi
+ node scripts/i18n/verify-content-fixture.cjs "${ARGS[@]}"
+
+ - name: Verify documentation date fixture
+ if: steps.detect.outputs.doc_dates_fixture == 'true'
+ run: node scripts/i18n/verify-doc-dates-fixture.cjs
+
+ - name: Verify blog fixture
+ if: steps.detect.outputs.blog_fixture == 'true'
+ run: node scripts/i18n/verify-blog-fixture.cjs
+
+ - name: Verify blog automation fixture
+ if: steps.detect.outputs.blog_automation_fixture == 'true'
+ run: node scripts/i18n/verify-blog-automation-fixture.cjs
+
+ - name: Verify source revisions fixture
+ if: steps.detect.outputs.source_revisions_fixture == 'true'
+ run: node scripts/i18n/verify-source-revisions-fixture.cjs
+
+ - name: Verify release policy fixture
+ if: steps.detect.outputs.release_policy_fixture == 'true'
+ run: node scripts/i18n/verify-release-policy-fixture.cjs
- name: Workflow security boundary tests
run: PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s
.github/scripts -p 'test_*.py' -v
@@ -170,7 +191,7 @@ jobs:
done
- name: Install browser verification tools
- if: steps.detect.outputs.validation_mode == 'full' ||
steps.detect.outputs.validation_mode == 'sample' ||
steps.detect.outputs.publish_fixture == 'true' ||
steps.detect.outputs.content_fixture == 'true' ||
steps.detect.outputs.sampling_fixture == 'true' ||
steps.detect.outputs.search_fixture == 'true'
+ if: steps.detect.outputs.validation_mode == 'full' ||
steps.detect.outputs.validation_mode == 'sample' ||
steps.detect.outputs.publish_fixture == 'true' ||
steps.detect.outputs.content_fixture == 'true' ||
steps.detect.outputs.sampling_fixture == 'true' ||
steps.detect.outputs.search_fixture == 'true' ||
steps.detect.outputs.blog_automation_fixture == 'true' ||
steps.detect.outputs.source_revisions_fixture == 'true' ||
steps.detect.outputs.release_policy_fixture == 'true' | [...]
run: |
DORIS_BROWSER_TOOLS="$RUNNER_TEMP/doris-browser-tools"
npm install --prefix "$DORIS_BROWSER_TOOLS" --no-save
--no-package-lock [email protected]
@@ -197,19 +218,19 @@ jobs:
if: steps.detect.outputs.content_fixture == 'true'
run: node scripts/i18n/verify-global-language.cjs --fixture
--site .i18n-build/content-fixture/build --manifests
.i18n-build/content-fixture/.i18n-build/content-manifests --output
.i18n-build/browser-global-language-fixture.json
- name: Verify release-note policy fixture in Chromium
- if: steps.detect.outputs.content_fixture == 'true'
+ if: steps.detect.outputs.release_policy_fixture == 'true'
run: node scripts/i18n/verify-release-policy-fixture.cjs
--verify-existing --browser
- name: Verify new-blog automation fixture in Chromium
- if: steps.detect.outputs.content_fixture == 'true'
+ if: steps.detect.outputs.blog_automation_fixture == 'true'
run: node scripts/i18n/verify-blog-automation-fixture.cjs
--verify-existing --browser
- name: Verify body-only translation corrections in Chromium
- if: steps.detect.outputs.content_fixture == 'true'
+ if: steps.detect.outputs.source_revisions_fixture == 'true'
run: node scripts/i18n/verify-source-revisions-fixture.cjs
--verify-existing --browser
- name: Verify automatic language entry in Chromium
- if: steps.detect.outputs.content_fixture == 'true'
+ if: steps.detect.outputs.locale_entry_fixture == 'true'
run: node scripts/i18n/verify-locale-entry-fixture.cjs
- name: Build
@@ -240,20 +261,20 @@ jobs:
if: steps.detect.outputs.validation_mode == 'full' ||
steps.detect.outputs.validation_mode == 'sample'
run: node scripts/i18n/manual-report.cjs --coverage
- - name: Verify sampled compilation
- if: steps.detect.outputs.validation_mode == 'sample'
- run: node scripts/i18n/verify-ci-sample.cjs
-
- name: Verify localized static pages
- if: steps.detect.outputs.validation_mode == 'full'
+ if: steps.detect.outputs.validation_mode == 'full' ||
steps.detect.outputs.validation_mode == 'sample'
env:
NODE_OPTIONS: --max-old-space-size=8192
+ DORIS_ASSET_ORIGIN: ""
run: |
- for LOCALE in $(echo "${{
steps.detect.outputs.validation_enabled_locales }}" | tr ',' ' '); do
- node scripts/i18n/verify-static.cjs --site build
--manifest ".i18n-build/manifests/${LOCALE}.json"
- done
+ if [ "${{ steps.detect.outputs.validation_mode }}" =
"sample" ]; then
+ node scripts/i18n/verify-ci-sample.cjs
+ exit 0
+ fi
+ # Validate resource configuration before the HTML census.
+ node scripts/publish/verify.cjs build
+ node scripts/i18n/verify-static.cjs --site build
--all-managed
if [ "${{ steps.detect.outputs.validation_mode }}" = "full"
]; then
- node scripts/publish/verify.cjs build
node scripts/i18n/verify-global-language.cjs --site
build --output .i18n-build/browser-global-language.json
node scripts/i18n/verify-first-release.cjs --site build
--output .i18n-build/first-release.json
for LOCALE in $(echo "${{
steps.detect.outputs.validation_enabled_locales }}" | tr ',' ' '); do
diff --git a/scripts/i18n/CI_VALIDATION.md b/scripts/i18n/CI_VALIDATION.md
index a8f8377373d..b28156d1376 100644
--- a/scripts/i18n/CI_VALIDATION.md
+++ b/scripts/i18n/CI_VALIDATION.md
@@ -11,12 +11,14 @@ committed lockfile after source planning. Source snapshot
checks remain enabled.
| README, planning or review notes only | Configuration, move/link and
workflow security checks; no dependency installation or site build |
| CI and tooling | Applicable unit tests and fixtures for the changed
subsystem; no real-site build |
| Shared UI, shared UI registry, routing, SEO, localization or sidebars |
Representative real documents in five languages and every active version;
native content fixtures for content/locale implementations, publishing fixtures
for delivery/host implementations |
-| Documentation or assets | Changed documents and import dependants, plus
representative real documents; English source changes select all five
languages, localized changes select English and the affected locales |
-| Dependencies, active versions or unclassified inputs | Full five-language
publication build and verification |
+| Documentation or assets | Changed documents and import dependants only;
English source changes select all five languages, localized changes select
English and the affected locales |
+| Dependencies or active versions | Representative five-language samples |
+| Other tooling or unclassified inputs | Offline checks; no automatic
multilingual document build |
| `ci/full` PR label or manual `validation=full` | Full five-language
publication build and verification |
-Manual `validation=sample` requests representative samples, but cannot
downgrade
-dependency/version changes or unknown inputs from full validation. Removing a
+Manual `validation=sample` uses representative samples when no content changed,
+and affected-document selection for content edits. Full compilation is
requested
+only by `ci/full` or manual `validation=full`. Removing a
`ci/full` label runs the automatic policy again. Scheduled and manual
deployment
workflows still build complete publication artifacts; this PR check never
deploys.
@@ -24,17 +26,17 @@ workflows still build complete publication artifacts; this
PR check never deploy
messages or dependency inventory select representative real documents in every
configured language and active version, along with the native content fixture.
Ordinary pages remain in the real build. This classification applies only to
-that exact registry path; other unknown inputs still require full validation.
+that exact registry path; unknown tooling does not promote a mixed PR to full
compilation.
Top-level `translations/*.md` files are maintenance notes and do not request a
site build. `translations/community-reports.json` controls ordinary page
content
and selects representative real builds. Combining these known inputs with a
landing-page translation no longer upgrades it to a full publication build.
-Other unknown JSON inputs still require full validation.
+Other tooling inputs keep their offline checks without forcing full
compilation.
`translations/config.json` is also a known shared language input. It is checked
by `check-configuration.cjs --all` before representative five-language builds.
-Unknown JSON files alongside it still require full validation.
+Unknown tooling JSON alongside it does not force full compilation.
The sampling adapter, native content and publishing/Apache fixtures run only
when their own implementation changes. Document, dictionary and
translation-state
@@ -49,25 +51,29 @@ all active versions**, including IDs, front matter, routes,
sidebars, source and
translation state. Optional locales remain enabled during metadata collection.
It then removes unselected document modules from the generated route registry
before bundling and static rendering. Ordinary pages remain in the build.
-When no blog body or blog translation state changed, blog articles and their
-native lists/tags are sampled too. Blog metadata and logical link targets
remain
+Blog articles and their native lists/tags are sampled too, including when a
+blog body or translation state changed. Blog metadata and logical link targets
remain
complete. The production build does not load this adapter.
-Every document plugin/version contributes its native main document and
available
+For framework changes, every document plugin/version contributes its native
main document and available
examples of MDX/imports, SQL, math and media/relative links. A greedy selection
reuses rich documents across requirements while keeping each version's entry.
Real translated bodies
and English fallbacks are sampled where available. Changed document bodies and
translation-state records are mandatory. Local MDX/JavaScript imports are
followed
-transitively when an imported file changes; dynamic or unparseable imports
select
-their owners conservatively. A selection above 500 documents fails with a
request
-for `ci/full`, rather than silently dropping affected documents.
+transitively when an imported file changes, including deleted imports.
Unrelated
+broken/dynamic imports do not pull every owner into a document-only check. An
+actually edited document is always selected, so its compilation errors still
fail. Shared implementation edits sample import consumers per
input/plugin/version.
+Document-only edits retain every affected owner, even above 500 documents;
+they do not force unrelated versions and documents into a full build.
The blog sample covers a recent article, lead/featured cards, MDX, code blocks
and available real/fallback
-bodies. Explicit changed imports and uncertain dependencies add their owners.
+bodies. Explicit changed imports add their owners.
Lists, tags and neighboring-post links are rebuilt from selected articles
before
the native route generator runs, so an aggregate cannot import every omitted
body.
-Edited blog bodies/state retain the complete native blog build.
+Edited blog bodies/state select those articles and affected import owners; the
+latest/lead articles remain as dependencies of ordinary list/card pages. Other
+representative blog examples are included only for framework samples.
Locale processes still run sequentially on one runner. During a sample build,
content-addressed Markdown structures and aligned headings are shared through a
@@ -119,6 +125,26 @@ body or state changed for that language. Its output says
`inventorySkipped=true`
and `freshness=null`; protection exceptions are still validated. Edited targets
and state continue through the original native registration and technical
checks.
+## Integration suites and static verification
+
+The native content smoke fixture builds one five-language matrix. The
additional
+disabled-Russian matrix remains available without `--smoke` and in explicit
full
+CI. Date, blog, blog-automation, source-revision, release-policy and
language-entry
+suites have separate flags selected by `ci-fixtures.cjs`; a docs-renderer
change
+does not run all six suites. PDF/release tooling runs its own unit tests.
+
+`Verify localized static pages` checks the selected sample on ordinary PRs.
+Explicit full validation checks every managed page with one shared metadata and
+alternate-group cache. Its streaming parser retains canonical, robots, body
+language, heading-ID and reciprocal hreflang assertions without constructing a
+full DOM for every page. Missing files and invalid metadata still fail.
+
+Optimized artifacts record `assetOrigin` in `.publish/redirects.json`. Resource
+verification uses the build's recorded setting, so a same-origin CI build is
not
+mistaken for a CDN build when a later process has a different environment.
+Legacy artifacts use the verifier's environment; CI sets it to the build value.
+CDN builds still reject missing directory prefixes and missing files.
+
## Local commands
Commit the inputs to validate before planning, so the merge-base diff includes
diff --git a/scripts/i18n/__tests__/automated-blog.test.cjs
b/scripts/i18n/__tests__/automated-blog.test.cjs
index 8eaa3c48b40..790657ecf3a 100644
--- a/scripts/i18n/__tests__/automated-blog.test.cjs
+++ b/scripts/i18n/__tests__/automated-blog.test.cjs
@@ -19,7 +19,7 @@ test('blog automation fixtures select real content validation
when changed on th
'scripts/i18n/create-blog-baseline.cjs',
'scripts/i18n/__tests__/fixtures/blog.cjs',
])
- assert(policy([file]).runContentFixture, file);
+ assert(policy([file]).runBlogAutomationFixture, file);
});
function fixture(t) {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'new-blog-policy-'));
diff --git a/scripts/i18n/__tests__/ci-blog-sample.test.cjs
b/scripts/i18n/__tests__/ci-blog-sample.test.cjs
index 5f7246cf252..cd4b573fd92 100644
--- a/scripts/i18n/__tests__/ci-blog-sample.test.cjs
+++ b/scripts/i18n/__tests__/ci-blog-sample.test.cjs
@@ -20,7 +20,7 @@ test('blog lists/tags contain representative bodies and all
changed import owner
frontMatter: file === 'old.md' ? {order: 1, picked: true} : {},
}}));
const entries = blogPosts.map(post => ({siteLocale: 'ja', route:
post.metadata.permalink,
- englishPath: 'blog/' + post.id, fallback: post.id !== 'rich.mdx',
indexable: post.id === 'rich.mdx'}));
+ englishPath: 'blog/' + post.id,
targetPath:'i18n/ja/docusaurus-plugin-content-blog/'+post.id, fallback: post.id
!== 'rich.mdx', indexable: post.id === 'rich.mdx'}));
const content = {blogPosts, contentIdentity: {entries}};
const context = {siteDir: root, baseUrl: '/ja/', i18n: {currentLocale:
'ja'}, siteConfig: {markdown: {format: 'detect'}}};
const options = {...DEFAULT_OPTIONS, id: 'default', postsPerPage: 'ALL'};
@@ -37,8 +37,11 @@ test('blog lists/tags contain representative bodies and all
changed import owner
assert(!selected.blogPosts.some(post => post.id === 'other.md'));
restore();
for (const file of ['blog/owner.mdx',
'i18n/ja/docusaurus-plugin-content-blog/owner.mdx',
'translations/blog/pages/ja/owner.mdx.json',
'translations/state/ja/pages/blog/current/owner.mdx.json']) {
- restore = sampler.enable({mode: 'sample', files: [file]});
- assert.equal(await sampler.sample(context, options, content),
undefined);
+ restore = sampler.enable({mode: 'sample', selection:'changed', files:
[file]});
+ const scoped = await sampler.sample(context, options, content);
+ assert(scoped.blogPosts.some(post => post.id === 'owner.mdx'),file);
+ assert(!scoped.blogPosts.some(post => post.id === 'other.md'),file);
+ assert(!scoped.blogPosts.some(post => post.id === 'rich.mdx'),file);
restore();
}
assert.equal(sampler.enabled(), false);
diff --git a/scripts/i18n/__tests__/ci-maintenance.test.cjs
b/scripts/i18n/__tests__/ci-maintenance.test.cjs
index 132a11edc4d..28929eaa302 100644
--- a/scripts/i18n/__tests__/ci-maintenance.test.cjs
+++ b/scripts/i18n/__tests__/ci-maintenance.test.cjs
@@ -69,17 +69,17 @@ for (const [name, before, after] of [
['duplicate a module path', action, action + moduleConfig('another',
'.github/actions/example')],
['add an unknown configuration section', action, action + '[include]\npath
= other-config\n'],
['contain invalid configuration', action, '[submodule "broken"\n'],
-]) test(`gitmodules changes still require full CI when they ${name}`, t => {
+]) test(`gitmodules changes select framework samples when they ${name}`, t => {
const {root, base} = repository(t, before, after);
assert.equal(actionSubmodulesOnly(root, base), false);
- assert.equal(plan({root, base}).mode, 'full');
+ assert.equal(plan({root, base}).mode, 'sample');
});
test('missing base history cannot reduce submodule validation', t => {
const {root} = repository(t, null, action);
assert.equal(actionSubmodulesOnly(root, '0'.repeat(40)), false);
- assert.equal(policy(['.gitmodules']).mode, 'full');
- assert.equal(policy(['.gitmodules'], {forceSample: true}).mode, 'full');
+ assert.equal(policy(['.gitmodules']).mode, 'sample');
+ assert.equal(policy(['.gitmodules'], {forceSample: true}).mode, 'sample');
});
test('top-level publishing notes skip builds while executable code and fixture
inputs retain checks', () => {
@@ -121,6 +121,6 @@ test('the OIDC-action PR file set selects no website or
publishing fixture build
assert.equal(plan({...fixture, forceFull: true}).mode, 'full');
assert.equal(plan({...fixture, event: {pull_request: {labels: [{name:
'ci/full'}]}}}).mode, 'full');
for (const file of ['package.json', 'yarn.lock', 'versions.json',
'unknown-input.bin']) {
- assert.equal(policy([...selected.files, file], {actionSubmodules:
true}).mode, 'full');
+ assert.equal(policy([...selected.files, file], {actionSubmodules:
true}).mode, file === 'unknown-input.bin' ? 'fixtures' : 'sample');
}
});
diff --git a/scripts/i18n/__tests__/ci-sampling.test.cjs
b/scripts/i18n/__tests__/ci-sampling.test.cjs
index e9476784c3b..cff9c8fb321 100644
--- a/scripts/i18n/__tests__/ci-sampling.test.cjs
+++ b/scripts/i18n/__tests__/ci-sampling.test.cjs
@@ -23,8 +23,9 @@ test('PR policy separates fixtures, real samples, full
upgrades and lightweight
'sample',
);
assert.equal(policy(['static/images/logo.svg']).mode, 'sample');
- for (const file of ['package.json', 'yarn.lock', 'versions.json',
'unknown-input.bin'])
- assert.equal(policy([file]).mode, 'full');
+ for (const file of ['package.json', 'yarn.lock', 'versions.json'])
+ assert.equal(policy([file]).mode, 'sample');
+ assert.equal(policy(['unknown-input.bin']).mode, 'fixtures');
assert.equal(policy(['plan-doc/notes.md']).mode, 'skip');
assert.equal(policy(['translations/CONTENT_MANIFEST.md']).mode, 'skip');
assert.equal(
@@ -35,16 +36,16 @@ test('PR policy separates fixtures, real samples, full
upgrades and lightweight
assert.equal(policy(['docs/topic.md'], {forceFull: true}).mode, 'full');
assert.equal(policy([], {forceSample: true}).mode, 'sample');
});
-test('translation configuration selects representative samples and unknown
sibling JSON remains full', () => {
+test('translation configuration selects representative samples and unknown
sibling tooling stays offline', () => {
const config = policy(['translations/config.json']);
assert.equal(config.mode, 'sample');
assert.equal(config.selection, 'representative');
assert.equal(config.publicationAllowed, false);
assert.equal(config.runTranslationTests, true);
- assert.equal(policy(['translations/config-unknown.json']).mode, 'full');
+ assert.equal(policy(['translations/config-unknown.json']).mode,
'fixtures');
});
-test('shared UI registry selects real samples and content fixtures while
unknown inputs still require full validation', () => {
+test('shared UI registry selects real samples and content fixtures while
unknown inputs cannot force a full build', () => {
const registry = 'translations/shared/registry.json';
const selected = policy([registry]);
assert.equal(selected.mode, 'sample');
@@ -52,9 +53,9 @@ test('shared UI registry selects real samples and content
fixtures while unknown
assert.equal(selected.runContentFixture, true);
assert.equal(selected.publicationAllowed, false);
for (const file of ['translations/shared/unknown.json',
'unknown-input.bin', 'package.json', 'versions.json'])
- assert.equal(policy([registry, file]).mode, 'full', file);
+ assert.equal(policy([registry, file]).mode, 'sample', file);
assert.equal(policy([registry], {forceFull: true}).mode, 'full');
- assert.equal(policy([registry, 'translations/shared/unknown.json'],
{forceSample: true}).mode, 'full');
+ assert.equal(policy([registry, 'translations/shared/unknown.json'],
{forceSample: true}).mode, 'sample');
});
test('community translation metadata does not upgrade a landing-page PR to
full compilation', () => {
const files = ['translations/COMMUNITY_ENTRIES.md',
'translations/community-reports.json',
@@ -69,7 +70,7 @@ test('community translation metadata does not upgrade a
landing-page PR to full
assert.equal(policy(['translations/community-reports.json']).mode,
'sample');
for (const note of ['COMMUNITY_ENTRIES', 'FIRST_RELEASE', 'SHARED_UI',
'README'])
assert.equal(policy([`translations/${note}.md`]).mode, 'skip');
- assert.equal(policy([...files, 'translations/unknown.json']).mode, 'full');
+ assert.equal(policy([...files, 'translations/unknown.json']).mode,
'sample');
assert.equal(policy(files, {forceFull: true}).mode, 'full');
});
test('known translation scope and glossary inputs keep combined
blog/maintenance work in representative CI',()=>{
@@ -85,8 +86,8 @@ test('known translation scope and glossary inputs keep
combined blog/maintenance
assert.equal(policy([config]).runTranslationTests,true);
}
for(const unknown of
['translations/scope/unknown.json','translations/scope/ru-extra.json','translations/unknown.json'])
- assert.equal(policy([...files,unknown]).mode,'full',unknown);
- for(const risk of ['package.json','yarn.lock','versions.json'])
assert.equal(policy([...files,risk]).mode,'full',risk);
+ assert.equal(policy([...files,unknown]).mode,'sample',unknown);
+ for(const risk of ['package.json','yarn.lock','versions.json'])
assert.equal(policy([...files,risk]).mode,'sample',risk);
assert.equal(policy(files,{forceFull:true}).mode,'full');
});
test('CI tooling only runs the fixtures for its own subsystem', () => {
@@ -96,7 +97,7 @@ test('CI tooling only runs the fixtures for its own
subsystem', () => {
assert.equal(language.runSamplingFixture, false);
assert.equal(language.runPublishFixture, false);
const dates=policy(['scripts/i18n/verify-doc-dates-fixture.cjs']);
-
assert.equal(dates.mode,'fixtures');assert.equal(dates.runContentFixture,true);
+
assert.equal(dates.mode,'fixtures');assert.equal(dates.runContentFixture,false);assert.equal(dates.runDocDatesFixture,true);
assert.equal(dates.publicationAllowed,false);
const sampler = policy(['scripts/i18n/ci-sample.cjs']);
assert.equal(sampler.runSamplingFixture, true);
@@ -354,6 +355,20 @@ test('changed transitive imports and sharded translation
state select their owni
},
],
};
+ // A shared module used by many docs stays a sample. A batch editing all
+ // of those docs still compiles every changed body without forcing full CI.
+ const extra = [];
+ for (let i=0; i<501; i++) {
+ const name='consumer-'+i;
+ fs.writeFileSync(path.join(root, 'docs', name+'.mdx'),'import {value}
from "@site/src/nested.js";\n\n{value}');
+
extra.push({id:name,source:'@site/docs/'+name+'.mdx',permalink:'/docs/'+name+'/'});
+ }
+ docs.push(...extra);
+ const bounded=await
selectDocs(props,{selection:'representative',files:['src/nested.js'],baseSha:'HEAD'});
+ assert(bounded.selected.size<10);
+ const batch=await
selectDocs(props,{selection:'changed',files:extra.map(doc=>doc.source.slice(6)),baseSha:'HEAD'});
+ assert.equal(batch.selected.size,501);
+ docs.splice(3);
const imported = await selectDocs(props, {files: ['src/nested.js'],
baseSha: 'HEAD'});
assert(
imported.selected
@@ -372,6 +387,10 @@ test('changed transitive imports and sharded translation
state select their owni
.get(JSON.stringify(['default', 'current', 'owner']))
.reasons.includes('changed import dependency'),
);
+ const focused = await selectDocs(props, {selection:'changed',
files:['docs/state-only.mdx'], baseSha:'HEAD'});
+ assert.deepEqual([...focused.selected.values()].map(item =>
item.row.docId).sort(), ['owner','state-only']);
+ const tooling = await selectDocs(props, {selection:'changed',
files:['doc-tools/release.mjs'], baseSha:'HEAD'});
+ assert.equal(tooling.selected.size,0);
fs.rmSync(path.join(root, 'src/nested.js'));
const deleted = await selectDocs(props, {files: ['src/nested.js'],
baseSha: 'HEAD'});
assert(
diff --git a/scripts/i18n/__tests__/pr-validation-policy.test.cjs
b/scripts/i18n/__tests__/pr-validation-policy.test.cjs
new file mode 100644
index 00000000000..d9f52954018
--- /dev/null
+++ b/scripts/i18n/__tests__/pr-validation-policy.test.cjs
@@ -0,0 +1,25 @@
+const test=require('node:test'),assert=require('node:assert/strict');
+const {policy}=require('../ci-plan.cjs');
+test('mixed PDF/download PR #4691 selects framework samples and only its
native contract fixture',()=>{
+ const
files=['doc-tools/skills/add-release/scripts/validate-release.mjs','.github/workflows/manual-generate-pdf.yml',
+
'.github/workflows/cron-deploy-website.yml','scripts/docs-pdf/generate.cjs','config/archived-docs.json',
+
'scripts/i18n/docs-plugin.cjs','src/components/download-form-next/DownloadFormNext.tsx','i18n/ja/code.json','translations/pages/state.json'];
+ const p=policy(files);
+
assert.equal(p.mode,'sample');assert.equal(p.selection,'representative');assert.equal(p.publicationAllowed,false);
+ assert.equal(p.runContentFixture,true);
+ for(const flag of
['runBlogAutomationFixture','runSourceRevisionsFixture','runReleasePolicyFixture','runDocDatesFixture'])
assert.equal(p[flag],false,flag);
+});
+test('framework and dependency changes sample; document changes select
affected owners; tooling does not render docs',()=>{
+ for(const file of
['src/scss/_variables.scss','docusaurus.config.js','package.json','yarn.lock','versions.json']){
+
assert.equal(policy([file]).mode,'sample',file);assert.equal(policy([file]).selection,'representative',file);
+ }
+ for(const file of
['docs/topic.md','versioned_docs/version-4.x/topic.mdx','i18n/ja/docusaurus-plugin-content-docs/current/topic.md']){
+
assert.equal(policy([file]).mode,'sample');assert.equal(policy([file]).selection,'changed');
+ }
+ for(const file of
['doc-tools/skills/release/script.mjs','.github/workflows/manual-generate-pdf.yml','scripts/docs-pdf/generate.cjs'])
assert.equal(policy([file]).mode,'fixtures');
+ assert.equal(policy(['docs/topic.md'],{forceFull:true}).mode,'full');
+});
+test('long regression suites are selected independently by their
implementations',()=>{
+ const
cases=[['source-revisions','runSourceRevisionsFixture'],['automated-blog','runBlogAutomationFixture'],['release-policy','runReleasePolicyFixture']];
+ for(const [file,flag]of cases){const
p=policy([`scripts/i18n/${file}.cjs`]);assert.equal(p[flag],true);for(const
[,other]of cases)if(other!==flag)assert.equal(p[other],false);}
+});
diff --git a/scripts/i18n/__tests__/source-revisions.test.cjs
b/scripts/i18n/__tests__/source-revisions.test.cjs
index 15d996e97a6..2a249c8fc8f 100644
--- a/scripts/i18n/__tests__/source-revisions.test.cjs
+++ b/scripts/i18n/__tests__/source-revisions.test.cjs
@@ -17,8 +17,8 @@ const source = '---\ntitle: Guide\nslug:
/guide\n---\n\nOriginal source.\n\n```s
const glossary = { schemaVersion: 1, version: 'fixture', keep: [], terms: [] };
test('source-revision runtime and its standalone fixture retain real CI
coverage', () => {
const { policy } = require('../ci-plan.cjs');
- assert(policy(['scripts/i18n/source-revisions.cjs']).runContentFixture);
-
assert(policy(['scripts/i18n/verify-source-revisions-fixture.cjs']).runContentFixture);
+
assert(policy(['scripts/i18n/source-revisions.cjs']).runSourceRevisionsFixture);
+
assert(policy(['scripts/i18n/verify-source-revisions-fixture.cjs']).runSourceRevisionsFixture);
});
async function fixture(t, { owner = 'machine' } = {}) {
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'source-revisions-'));
diff --git a/scripts/i18n/__tests__/static-cache.test.cjs
b/scripts/i18n/__tests__/static-cache.test.cjs
index fe41260f015..1215cd0d213 100644
--- a/scripts/i18n/__tests__/static-cache.test.cjs
+++ b/scripts/i18n/__tests__/static-cache.test.cjs
@@ -22,14 +22,14 @@ function fixture(t) {
return {site,manifestDir,locales:['ja','ko']};
}
test('sharing compact metadata preserves strict results while parsing fewer
complete HTML documents',t=>{
- const data=fixture(t),original=cheerio.load;let reads=0;
-
cheerio.load=(source,...args)=>{if(String(source).includes('theme-doc-markdown'))reads++;return
original(source,...args);};
+ const data=fixture(t),original=fs.readFileSync;let reads=0;
+
fs.readFileSync=(file,...args)=>{if(String(file).endsWith('index.html'))reads++;return
original(file,...args);};
try {
const
separate=data.locales.map(locale=>({locale,...verify({site:data.site,manifest:path.join(data.manifestDir,locale+'.json')})}));
const before=reads;reads=0;
assert.deepEqual(verifyAll(data),separate);
assert(reads<before,`${reads} shared parses must be less than
${before} separate parses`);
- } finally {cheerio.load=original;}
+ } finally {fs.readFileSync=original;}
});
test('each invocation rereads the artifact and rejects damaged heading IDs and
duplicate alternates',t=>{
const data=fixture(t);verifyAll(data);
diff --git a/scripts/i18n/__tests__/static-metadata.test.cjs
b/scripts/i18n/__tests__/static-metadata.test.cjs
new file mode 100644
index 00000000000..3fac69bb423
--- /dev/null
+++ b/scripts/i18n/__tests__/static-metadata.test.cjs
@@ -0,0 +1,12 @@
+const test=require('node:test'),assert=require('node:assert/strict');
+const cheerio=require('cheerio');
+const {readMetadata}=require('../static-metadata.cjs');
+test('streamed metadata preserves DOM semantics for nested content, void tags,
entities and raw scripts',()=>{
+ const html=`<!doctype html><html lang=ja><head><link rel=canonical
href="https://example.test/a?x=1&y=2"><link rel=alternate hreflang=ja
href=/ja/a><link rel=alternate hreflang=ja href=/duplicate><meta name=robots
content=noindex><meta property=og:url content=/a><meta property=og:locale
content=ja_JP></head><body><nav><h2 id=ignore>Sidebar</h2></nav><article
class="theme-doc-markdown other" lang=en><div
data-translation-status=fallback><h1 id=title>Title</h1><img src=a><p><br>Bod
[...]
+ const $=cheerio.load(html),alternates=new Map();
+ $('link[rel="alternate"][hreflang]').each((i,n)=>{const
lang=$(n).attr('hreflang');if(!alternates.has(lang))alternates.set(lang,[]);alternates.get(lang).push($(n).attr('href'));});
+
assert.deepEqual(readMetadata(html),{htmlLang:'ja',bodyLang:'en',translationStatus:'fallback',
+
canonicals:$('link[rel=canonical]').map((i,n)=>$(n).attr('href')).get(),alternates,
+ headingIds:$('.theme-doc-markdown h1,.theme-doc-markdown
h2,.theme-doc-markdown h3').map((i,n)=>$(n).attr('id')??'').get(),
+ robots:'noindex',ogUrl:'/a',ogLocale:'ja_JP'});
+});
diff --git a/scripts/i18n/build-scope.cjs b/scripts/i18n/build-scope.cjs
index 6b1f15ba12a..c9aa313d339 100644
--- a/scripts/i18n/build-scope.cjs
+++ b/scripts/i18n/build-scope.cjs
@@ -100,8 +100,8 @@ function buildScope(files, versions, managed = [],
dependencies = null, {actionS
|| (/^translations\/(pages|blog)\//.test(file) &&
!dependencies?.complete));
const optimizePublish = contractChanged || searchChanged ||
navigationChanged || files.some(file => !isPublishMaintenanceNote(file)
&&
/^(scripts\/publish\/|config\/matomo-plugin\/|scripts\/i18n\/locale-entry\.cjs$|package\.json$|yarn\.lock$|docusaurus\.config\.js$|config\/(?:(i18n|custom-docusaurus-plugin|ssrTemplate|asset-origin)\.js|locale-entry\.json)$|scripts\/build-locales?\.cjs$|static\/\.htaccess$|static\/js\/[^/]*bootstrap\.js$|\.github\/workflows\/(cron-deploy-website|manual-deploy-website|build-check)\.yml$)/.test(file));
- // Publication changes need the same complete artifact as deployment, on
- // the CI runner. Keep local checks scoped to fixtures and Dev versions.
+ // Record complete publication impact for deployment. PR compilation policy
+ // is chosen separately by ci-plan.cjs and normally uses bounded samples.
if (optimizePublish) {tier = 'full'; shared();}
if (tier !== 'full' && dependencies?.complete &&
dependencies.locales.length) {
languages.clear(); dependencies.locales.forEach(locale =>
languages.add(locale));
diff --git a/scripts/i18n/ci-blog-sample.cjs b/scripts/i18n/ci-blog-sample.cjs
index dd2aa784777..39def0e5b4f 100644
--- a/scripts/i18n/ci-blog-sample.cjs
+++ b/scripts/i18n/ci-blog-sample.cjs
@@ -4,10 +4,7 @@ const path = require('node:path');
let active;
function enable(plan) {
- // Content edits retain the existing complete blog build. This optimization
- // is for PRs that change implementations rather than published content.
- const contentChanged = plan.files.some(file =>
/^(blog\/|i18n\/[^/]+\/docusaurus-plugin-content-blog(?:\/|-[^/]+\/)|translations\/blog\/|translations\/state\/[^/]+\/pages\/blog\/)/.test(file));
- active = plan.mode === 'sample' && !contentChanged ? {plan, routes: [],
reports: []} : undefined;
+ active = plan.mode === 'sample' ? {plan, routes: [], reports: []} :
undefined;
return () => {active = undefined;};
}
const enabled = () => !!active;
@@ -38,22 +35,46 @@ async function sample(context, options, content) {
add(posts[0], 'latest post');
// The site's native list renders the order=1 article as its lead card.
add(posts.find(post => Number(post.metadata.frontMatter?.order) === 1),
'lead article');
- add(posts.find(post => post.metadata.frontMatter?.picked &&
Number(post.metadata.frontMatter.order) !== 1), 'featured article');
- add(posts.find(post => source(post).endsWith('.mdx')), 'MDX');
- add(posts.find(post => /```(?:sql|javascript|js)\b/i.test(text(post))),
'code block');
- add(posts.find(post => entry(post)?.indexable && !entry(post).fallback),
'real body');
- add(posts.find(post => entry(post)?.fallback), 'English fallback');
+ if (plan.selection !== 'changed') {
+ add(posts.find(post => post.metadata.frontMatter?.picked &&
Number(post.metadata.frontMatter.order) !== 1), 'featured article');
+ add(posts.find(post => source(post).endsWith('.mdx')), 'MDX');
+ add(posts.find(post =>
/```(?:sql|javascript|js)\b/i.test(text(post))), 'code block');
+ add(posts.find(post => entry(post)?.indexable &&
!entry(post).fallback), 'real body');
+ add(posts.find(post => entry(post)?.fallback), 'English fallback');
+
+ }
+ const changedPaths = new Set(plan.files);
+ const changedStates = plan.files.filter(file =>
/^translations\/blog\//.test(file) && file.endsWith('.json'));
+ const stateIds = new Set();
+ if (changedStates.length) {
+ const {readManualRecords, blogStateFileFor} =
require('./manual-state.cjs');
+ for (const record of [...readManualRecords(context.siteDir, 'blog'),
+ ...(plan.baseSha ? readManualRecords(context.siteDir, 'blog',
plan.baseSha) : [])])
+ if (changedStates.includes(blogStateFileFor(record)))
stateIds.add(record.contentId);
+ }
+ for (const post of posts) {
+ const identity = entry(post);
+ if ([source(post), post.metadata.source.replace(/^@site\//, ''),
identity?.targetPath, identity?.sourcePath]
+ .some(file => changedPaths.has(file))) add(post, 'changed
article');
+ if (stateIds.has(identity?.contentId) || plan.files.some(file => {
+ const state =
file.match(/^translations\/(?:blog\/pages\/[^/]+|state\/[^/]+\/pages\/blog\/[^/]+)\/(.+)\.json$/);
+ return state && source(post) === 'blog/' + state[1];
+ })) add(post, 'changed article state');
+ }
// Explicitly imported components/assets still select all affected owners.
- if (plan.files.some(file => /^(src|static)\//.test(file))) {
+ if (plan.files.some(file =>
/^(src|static|docs|versioned_docs|community|course|releasenotes|blog|i18n)\//.test(file)))
{
const {dependencies} = require('./ci-sample.cjs');
- const changed = new Set(plan.files), cache = new Map();
+ const changed = new Set(plan.files), cache = new Map(), coveredOwners
= new Set();
for (const post of posts) {
const result = await dependencies(context.siteDir,
path.resolve(context.siteDir,
post.metadata.source.replace(/^@site\//, '')),
cache, new Set(), context.siteConfig.markdown.format);
- if (result.uncertain || [...result.files].some(file =>
changed.has(path.relative(context.siteDir, file).split(path.sep).join('/'))))
+ const affected = [...result.files].map(file =>
path.relative(context.siteDir, file).split(path.sep).join('/')).filter(file =>
changed.has(file));
+ if (affected.length && (plan.selection === 'changed' ||
affected.some(file => !coveredOwners.has(file)))) {
+ affected.forEach(file => coveredOwners.add(file));
add(post, result.uncertain ? 'uncertain import' : 'changed
import dependency');
+ }
}
}
const blogPosts = posts.filter(post => selected.has(post.id)).map(post =>
({...post,
diff --git a/scripts/i18n/ci-fixtures.cjs b/scripts/i18n/ci-fixtures.cjs
new file mode 100644
index 00000000000..cb0d78510dd
--- /dev/null
+++ b/scripts/i18n/ci-fixtures.cjs
@@ -0,0 +1,15 @@
+// Expensive integration suites follow their implementation owners. Shared UI
+// changes are covered by the real multilingual sample, not every suite.
+function fixtures(files, full = false) {
+ const matches = expression => full || files.some(file =>
expression.test(file));
+ return {
+ runContentFixture:
matches(/^(scripts\/i18n\/(docs-plugin|status-plugin|content-manifest|manual-state|manual-plugins|native-context|route-context|page-body|page-body-loader|static-metadata|verify-static|verify-content-fixture|verify-global-language)\.cjs$|scripts\/i18n\/__tests__\/fixtures\/(content-manifest|multi-locale)\.cjs$|src\/components\/Content(Route|Metadata)\.tsx$|src\/utils\/(localizedRoute|contentRoute|useLocalizedRoute)\.[jt]sx?$|src\/theme\/(DocItem|SiteMetadata)\/|
[...]
+ runDocDatesFixture:
matches(/^scripts\/(last-update\/|i18n\/verify-doc-dates-fixture\.cjs$)/),
+ runBlogFixture:
matches(/^scripts\/i18n\/(verify-blog-fixture\.cjs$|__tests__\/fixtures\/blog\.cjs$)/),
+ runBlogAutomationFixture:
matches(/^scripts\/i18n\/(automated-blog(?:-body-loader)?|blog-automation(?:-cli)?|create-blog-baseline|verify-blog-automation-fixture)\.cjs$|^scripts\/i18n\/__tests__\/fixtures\/blog\.cjs$/),
+ runSourceRevisionsFixture:
matches(/^scripts\/i18n\/(source-revisions|verify-source-revisions-fixture)\.cjs$/),
+ runReleasePolicyFixture:
matches(/^scripts\/i18n\/(release-policy|verify-release-policy-fixture)\.cjs$|^translations\/release-notes-baseline\.json$/),
+ runLocaleEntryFixture:
matches(/^scripts\/i18n\/(locale-entry|verify-locale-entry-fixture)\.cjs$|^static\/js\/locale-entry-bootstrap\.js$|^config\/locale-entry\.json$/),
+ };
+}
+module.exports = {fixtures};
diff --git a/scripts/i18n/ci-plan.cjs b/scripts/i18n/ci-plan.cjs
index 491b8d03496..b0d329db0eb 100644
--- a/scripts/i18n/ci-plan.cjs
+++ b/scripts/i18n/ci-plan.cjs
@@ -14,13 +14,13 @@ const runtime =
/^(src\/|config\/|docusaurus\.config\.js$|sidebars[^/]*\.(ts|json)$|versioned_sidebars\/|scripts\/i18n\/(source-revisions|automated-blog|automated-blog-body-loader|release-policy|docs-plugin|status-plugin|state|structure|content-plugin|content-loader|source-groups|code-prose|protection|content-manifest|manual-state|manual-plugins|native-context|route-context|page-body|page-body-loader|sitemap)\.cjs$)/;
const content =
/^(static\/|docs\/|versioned_docs\/|community\/|course\/|releasenotes\/|blog\/|i18n\/|translations\/(pages|blog|state)\/)/;
-const highRisk =
/^(package\.json|yarn\.lock|versions\.json|config\/versions-plugin\.js)$/;
+const frameworkInputs =
/^(package\.json|yarn\.lock|versions\.json|config\/versions-plugin\.js)$/;
// Maintenance notes are not site content. The report registry, in contrast,
// changes ordinary pages, which the real sample build always renders.
const maintenanceNotes = /^translations\/(?:[^/]+\.md|scope\/README\.md)$/;
// Registered locale scope/glossary files are validated offline and exercised
// through native metadata plus representative builds, like other known shared
-// language inputs. Unknown translation configuration still requires full CI.
+// language inputs. Other tooling inputs use offline checks; full CI is
explicitly requested.
const maintenanceConfig = file => {
if (['translations/config.json',
'translations/release-notes-baseline.json',
'translations/blog-baseline.json'].includes(file)) return true;
const
match=file.match(/^translations\/(?:scope|glossary)\/([^/]+)\.json$/);
@@ -28,64 +28,41 @@ const maintenanceConfig = file => {
};
const reportRegistry = 'translations/community-reports.json';
function policy(files, {forceFull = false, forceSample = false,
actionSubmodules = false} = {}) {
- const risk = files.filter(file => highRisk.test(file));
- const changed = files.some(file => content.test(file));
- const shared = files.some(file => runtime.test(file) ||
mechanism.test(file) || file === reportRegistry || maintenanceConfig(file));
const checks = validationScope(files);
- const ci = files.some(file => /^(scripts\/|\.github\/)/.test(file) || file
=== '.gitmodules' && actionSubmodules);
- const unknown = files.filter(
- file =>
- !runtime.test(file) &&
- !mechanism.test(file) &&
- !content.test(file) &&
- file !== reportRegistry &&
- !maintenanceConfig(file) &&
- !maintenanceNotes.test(file) &&
- !(file === '.gitmodules' && actionSubmodules) &&
-
!/^((scripts|\.github|plan-doc|review-docs|\.agents)\/|README\.md$|AGENTS\.md$|LICENSE$|NOTICE$)/.test(
- file,
- ),
- );
- const mode =
- forceFull || risk.length || unknown.length
- ? 'full'
- : shared || changed || forceSample
- ? 'sample'
- : ci
- ? 'fixtures'
- : 'skip';
+ const shared = files.some(file => runtime.test(file) ||
mechanism.test(file)
+ || frameworkInputs.test(file) || file === '.gitmodules' &&
!actionSubmodules
+ || /^i18n\/[^/]+\/code\.json$/.test(file) || file === reportRegistry
|| maintenanceConfig(file)
+ ||
/^(?:tsconfig\.json|(?:babel|postcss|tailwind|webpack|rspack)\.config\.[cm]?[jt]s)$/.test(file));
+ const changed = files.some(file => content.test(file));
+ const notes = file => maintenanceNotes.test(file) ||
+
/^(README\.md|AGENTS\.md|LICENSE|NOTICE|plan-doc\/|review-docs\/|\.agents\/)/.test(file);
+ const ci = files.some(file => !notes(file));
+ // Full compilation is opt-in. Unknown tooling must not silently promote a
+ // mixed framework/tooling PR (for example #4691) to a publication build.
+ const mode = forceFull ? 'full' : shared || changed || forceSample ?
'sample' : ci ? 'fixtures' : 'skip';
return {
mode,
- selection: shared || forceSample ? 'representative' : 'changed',
- reasons: forceFull
- ? ['explicit full validation']
- : risk.length
- ? risk
- : unknown.length
- ? unknown
- : [mode],
- runContentFixture:
- (shared && checks.check_content_fixture) ||
- files.some(file =>
-
/verify-(content-fixture|source-revisions-fixture|doc-dates-fixture|blog(?:-automation)?-fixture|global-language)|create-blog-baseline\.cjs$|__tests__\/fixtures\/(content-manifest|blog)\.cjs$/.test(file),
- ),
+ selection: shared || forceSample && !changed ? 'representative' :
'changed',
+ reasons: [forceFull ? 'explicit full validation' : mode],
+ ...require('./ci-fixtures.cjs').fixtures(files, forceFull),
runSamplingFixture: files.some(file =>
-
/^scripts\/(build-locales?\.cjs$|i18n\/(compiler-processes|ci-sample|ci-blog-sample|build-cache|verify-ci-sampl(?:e|ing-fixture))\.cjs$)/.test(file)),
- runCompilerFixture: mode === 'full' || files.some(file =>
+
/^scripts\/(build-locales?\.cjs$|i18n\/(compiler-processes|ci-sample|ci-plan|ci-fixtures|ci-blog-sample|build-cache|verify-ci-sampl(?:e|ing-fixture))\.cjs$)/.test(file)
|| file === '.github/workflows/build-check.yml'),
+ runCompilerFixture: forceFull || files.some(file =>
/^scripts\/(build-locales?\.cjs|i18n\/(compiler-processes|verify-compiler-fixture)\.cjs)$/.test(file)),
- runSearchFixture: mode === 'full' || files.some(file =>
+ runSearchFixture: forceFull || files.some(file =>
/^(src\/theme\/(SearchBar|SearchPage)\/|src\/utils\/(fetchSearchIndex|searchMessages|searchScopes|useLanguageItems)\.[jt]sx?$|src\/hooks\/use-search-query\.ts$|docusaurus\.config\.js$|scripts\/build-locales?\.cjs$|scripts\/i18n\/(compiler-processes|search-plugin|search-worker-loader|verify-search-transport)\.cjs$)/.test(file)),
- runPublishFixture: checks.check_publish_fixture || mode === 'full' ||
files.includes('scripts/i18n/compiler-processes.cjs'),
- runTranslationTests: mode === 'full' || files.some(file =>
+ runPublishFixture: checks.check_publish_fixture || forceFull ||
files.includes('scripts/i18n/compiler-processes.cjs'),
+ runTranslationTests: forceFull || files.some(file =>
runtime.test(file) || mechanism.test(file) ||
maintenanceConfig(file) || /^scripts\/(i18n\/|build-locales?\.cjs$)/.test(file)
|| file === '.github/workflows/build-check.yml'),
+ runToolTests: files.some(file =>
/^(doc-tools\/|scripts\/docs-pdf\/)/.test(file)),
runDocsReport: mode === 'full' || (mode !== 'fixtures' &&
checks.check_docs_report),
publicationAllowed: mode === 'full',
checkRenderedLinks: !(files.length && files.every(file =>
/\.(css|scss|sass)$/.test(file))),
};
}
function plan({root, base, event = {}, forceFull = false, forceSample =
false}) {
- const files = execFileSync('git', ['diff', '--name-only', '-z', base,
'HEAD'], {
+ const files = execFileSync('git', ['diff', '--no-renames', '--name-only',
'-z', base, 'HEAD'], {
cwd: root,
encoding: 'utf8',
maxBuffer: 16 * 1024 * 1024,
@@ -121,8 +98,9 @@ function plan({root, base, event = {}, forceFull = false,
forceSample = false})
? locales
: [...new Set(['en', ...requested])];
}
- if (selected.mode === 'sample' && dependencies.complete &&
dependencies.locales.length) requested = dependencies.locales;
+ if (selected.mode === 'sample' && selected.selection === 'changed' &&
dependencies.complete && dependencies.locales.length) requested =
dependencies.locales;
if (selected.mode === 'sample' && !requested.length) requested = locales;
+ if (!['sample', 'full'].includes(selected.mode)) requested = [];
const sourceSha = execFileSync('git', ['rev-parse', 'HEAD'], {
cwd: root,
encoding: 'utf8',
@@ -190,11 +168,18 @@ if (require.main === module) {
validation_locales: result.locales.join(','),
validation_enabled_locales:
result.enabledLocales.join(','),
content_fixture: result.runContentFixture,
+ doc_dates_fixture: result.runDocDatesFixture,
+ blog_fixture: result.runBlogFixture,
+ blog_automation_fixture: result.runBlogAutomationFixture,
+ source_revisions_fixture: result.runSourceRevisionsFixture,
+ release_policy_fixture: result.runReleasePolicyFixture,
+ locale_entry_fixture: result.runLocaleEntryFixture,
publish_fixture: result.runPublishFixture,
sampling_fixture: result.runSamplingFixture,
search_fixture: result.runSearchFixture,
compiler_fixture: result.runCompilerFixture,
translation_tests: result.runTranslationTests,
+ tool_tests: result.runToolTests,
docs_report: result.runDocsReport,
})
.map(([k, v]) => `${k}=${v}\n`)
diff --git a/scripts/i18n/ci-sample.cjs b/scripts/i18n/ci-sample.cjs
index b6d82d912cc..9b0c0233a56 100644
--- a/scripts/i18n/ci-sample.cjs
+++ b/scripts/i18n/ci-sample.cjs
@@ -91,7 +91,7 @@ function rowsFor(props) {
}
return rows.sort((a, b) => id(a).localeCompare(id(b)));
}
-function chooseRepresentatives(rows, root) {
+function chooseRepresentatives(rows, root, representative = true) {
const selected = new Map();
const add = (row, reason) => {
if (!row) return;
@@ -105,7 +105,7 @@ function chooseRepresentatives(rows, root) {
if (!groups.has(g)) groups.set(g, []);
groups.get(g).push(row);
}
- for (const group of groups.values()) {
+ for (const group of representative ? groups.values() : []) {
const patterns = [
['MDX/import', /\bimport\s|<[A-Z][A-Za-z]+/],
['SQL', /```sql\b/i],
@@ -225,7 +225,7 @@ async function dependencies(
? path.resolve(path.dirname(file), name)
: undefined;
if (!base) continue;
- const child = [
+ const candidates = [
'',
'.js',
'.jsx',
@@ -243,12 +243,15 @@ async function dependencies(
'/index.ts',
'/index.tsx',
]
- .map(ext => base + ext)
- .find(p => fs.existsSync(p) && fs.statSync(p).isFile());
+ .map(ext => base + ext);
+ const child = candidates.find(p => fs.existsSync(p) &&
fs.statSync(p).isFile());
if (child) {
const result = await dependencies(root, child, cache, seen,
markdownConfigFormat);
uncertain ||= result.uncertain;
- } else uncertain = true; // Deleted imports must still select their
owners.
+ } else {
+ uncertain = true;
+ candidates.forEach(file => seen.add(file)); // Retain exact
deleted dependency edges.
+ }
}
return {files: seen, uncertain};
}
@@ -284,7 +287,7 @@ function stateIdentities(root, files, base) {
}
async function selectDocs(props, plan) {
const rows = rowsFor(props),
- {selected, add} = chooseRepresentatives(rows, props.siteDir);
+ {selected, add} = chooseRepresentatives(rows, props.siteDir,
plan.selection !== 'changed');
const changed = new Set(plan.files),
changedStates = stateIdentities(props.siteDir, plan.files,
plan.baseSha);
for (const row of rows)
@@ -301,7 +304,7 @@ async function selectDocs(props, plan) {
),
);
if (dependenciesChanged.length) {
- const cache = new Map();
+ const cache = new Map(), coveredOwners = new Set();
for (const row of rows) {
const result = await dependencies(
props.siteDir,
@@ -310,38 +313,16 @@ async function selectDocs(props, plan) {
new Set(),
props.siteConfig?.markdown?.format ?? 'mdx',
);
- if (
- result.uncertain ||
- [...result.files].some(file =>
changed.has(gitPath(props.siteDir, file)))
- )
- add(
- row,
- result.uncertain
- ? 'conservative dynamic/unparsed import'
- : 'changed import dependency',
- );
+ const affected = [...result.files].map(file =>
gitPath(props.siteDir, file)).filter(file => changed.has(file));
+ // Shared implementations need a few real consumers per plugin and
+ // version. Explicitly edited documents above are never truncated.
+ const ownerKeys = affected.map(file =>
JSON.stringify([row.pluginId, row.version, file]));
+ if (affected.length && (plan.selection === 'changed' ||
ownerKeys.some(key => !coveredOwners.has(key)))) {
+ ownerKeys.forEach(key => coveredOwners.add(key));
+ add(row, result.uncertain ? 'conservative dynamic/unparsed
import' : 'changed import dependency');
+ }
}
}
- if (selected.size > 500) {
- const directory = path.join(props.siteDir,
'.i18n-build/ci-sample/scopes');
- fs.mkdirSync(directory, {recursive: true});
- fs.writeFileSync(
- path.join(directory, props.i18n.currentLocale + '.selection.json'),
- JSON.stringify(
- {
- status: 'selection-exceeded',
- sourceSha: plan.sourceSha,
- metadataDocs: rows.length,
- selected: [...selected.values()],
- },
- null,
- 2,
- ) + '\n',
- );
- throw new Error(
- `Sample expands to ${selected.size} documents; use the ci/full
label or manual full validation instead of truncating affected documents`,
- );
- }
return {rows, selected};
}
function prune(routes, docPaths, chosen, versions, inDocs = false) {
diff --git a/scripts/i18n/static-metadata.cjs b/scripts/i18n/static-metadata.cjs
new file mode 100644
index 00000000000..56beb5dfe67
--- /dev/null
+++ b/scripts/i18n/static-metadata.cjs
@@ -0,0 +1,45 @@
+const {Parser} = require('htmlparser2');
+
+// Read only the assertions' scalar fields. Constructing a complete Cheerio DOM
+// for each page also parses large sidebars and hydration payloads we never
use.
+function readMetadata(html) {
+ const result = {headingIds: [], alternates: new Map(), canonicals: [],
htmlLang: undefined, bodyLang: undefined,
+ translationStatus: undefined, robots: undefined, ogUrl: undefined,
ogLocale: undefined};
+ const stack = [];
+ const first = new Set();
+ let documentDepth = 0;
+ const once = (key, value) => {if (!first.has(key)) {first.add(key);
result[key] = value;}};
+ const parser = new Parser({
+ onopentag(name, attributes) {
+ const classes = (attributes.class ?? '').split(/\s+/);
+ if (name === 'html') once('htmlLang', attributes.lang);
+ if (classes.includes('theme-doc-markdown') ||
classes.includes('course-doc-content')) once('bodyLang', attributes.lang);
+ if ('data-translation-status' in attributes)
once('translationStatus', attributes['data-translation-status']);
+ if (documentDepth && /^h[1-6]$/.test(name))
result.headingIds.push(attributes.id ?? '');
+ if (name === 'link') {
+ if (attributes.rel === 'canonical')
result.canonicals.push(attributes.href);
+ if (attributes.rel === 'alternate' && 'hreflang' in
attributes) {
+ if (!result.alternates.has(attributes.hreflang))
result.alternates.set(attributes.hreflang, []);
+
result.alternates.get(attributes.hreflang).push(attributes.href);
+ }
+ }
+ if (name === 'meta') {
+ if (attributes.name === 'robots') once('robots',
attributes.content);
+ if (attributes.property === 'og:url') once('ogUrl',
attributes.content);
+ if (attributes.property === 'og:locale') once('ogLocale',
attributes.content);
+ }
+ const document = classes.includes('theme-doc-markdown');
+ stack.push({name, document});
+ if (document) documentDepth++;
+ },
+ onclosetag(name) {
+ let position = stack.length - 1;
+ while (position >= 0 && stack[position].name !== name) position--;
+ if (position < 0) return;
+ for (const entry of stack.splice(position)) if (entry.document)
documentDepth--;
+ },
+ }, {decodeEntities: true});
+ parser.end(html);
+ return result;
+}
+module.exports = {readMetadata};
diff --git a/scripts/i18n/verify-ci-sample.cjs
b/scripts/i18n/verify-ci-sample.cjs
index a034dbcd010..313e467aea4 100644
--- a/scripts/i18n/verify-ci-sample.cjs
+++ b/scripts/i18n/verify-ci-sample.cjs
@@ -50,8 +50,9 @@ async function verify({root = process.cwd(), browser = true})
{
);
assert.equal(scope.sourceSha, plan.sourceSha);
assert.equal(scope.status, 'compiled');
- assert(scope.compiledMdxModules?.client?.length > 0);
- assert(scope.renderedDocs > 0 && scope.renderedDocs <=
scope.metadataDocs);
+ if (scope.renderedDocs)
assert(scope.compiledMdxModules?.client?.length > 0);
+ assert(scope.renderedDocs >= 0 && scope.renderedDocs <=
scope.metadataDocs);
+ assert.equal(scope.renderedDocs, scope.selected.length);
for (const row of scope.selected) {
const filename = path.join(site, decodeURIComponent(row.route),
'index.html');
assert(fs.existsSync(filename), `Missing selected document:
${row.route}`);
@@ -97,7 +98,7 @@ async function verify({root = process.cwd(), browser = true})
{
const row =
scope.selected.find(r => r.pluginId === 'default' &&
r.version === 'current') ??
scope.selected[0];
- const response = await page.goto(origin + row.route);
+ const response = await page.goto(origin + (row?.route ??
(locale === 'en' ? '/' : `/${locale}/`)));
assert.equal(response.status(), 200);
await page.locator('html[data-has-hydrated="true"]').waitFor();
const course = scope.selected.find(r => r.pluginId ===
'course');
diff --git a/scripts/i18n/verify-ci-sampling-fixture.cjs
b/scripts/i18n/verify-ci-sampling-fixture.cjs
index f68fcff7d45..ae38f748f9f 100644
--- a/scripts/i18n/verify-ci-sampling-fixture.cjs
+++ b/scripts/i18n/verify-ci-sampling-fixture.cjs
@@ -93,6 +93,23 @@ async function main() {
excludedBrokenModuleWasNotCompiled: true,
excludedBrokenBlogWasNotCompiled: true,
};
+ // Prose-only document edits must not also compile the representative set.
+ const focusedFile = 'docs/01-ja-only.md';
+ const originalFocused = fs.readFileSync(path.join(site, focusedFile),
'utf8');
+ fs.appendFileSync(path.join(site, focusedFile), '\nChanged document
body.\n');
+ commit();
+ const focused = plan({root: site, base});
+ assert.equal(focused.selection, 'changed');
+ fs.writeFileSync(file, JSON.stringify(focused, null, 2));
+ assert.equal(run('pipe').status, 0, 'Focused changed-document build');
+ for (const locale of focused.locales) {
+ const scope = JSON.parse(fs.readFileSync(path.join(site,
'.i18n-build/ci-sample/scopes', locale + '.json')));
+ assert.deepEqual(scope.selected.map(row => row.docId), ['ja-only']);
+ }
+ await verify({root: site, browser: process.argv.includes('--browser')});
+ proof.changedDocumentOnlyCompiled = true;
+ fs.writeFileSync(path.join(site, focusedFile), originalFocused);
+ commit();
// A real edit makes that same module mandatory. Its missing import must
now
// fail compilation instead of being silently dropped by the sampler.
const originalDocument = fs.readFileSync(path.join(site,
'docs/zz-unselected.mdx'), 'utf8');
diff --git a/scripts/i18n/verify-content-fixture.cjs
b/scripts/i18n/verify-content-fixture.cjs
index 3ae724652da..6b05fd81f0f 100644
--- a/scripts/i18n/verify-content-fixture.cjs
+++ b/scripts/i18n/verify-content-fixture.cjs
@@ -15,7 +15,7 @@ async function main() {
const implementation = () => ({sha: sourceSha(root), trackedDiffHash:
hash(execFileSync('git', ['diff', 'HEAD', '--binary'], {cwd: root, encoding:
'utf8'}))});
const initialImplementation = implementation();
const results = [];
- for (const disabled of [false, true]) {
+ for (const disabled of process.argv.includes('--smoke') ? [false] :
[false, true]) {
const fixture = path.join(root, '.i18n-build', disabled ?
'content-disabled-fixture' : 'content-fixture');
await fs.rm(fixture, {recursive: true, force: true});
await createContentFixture(fixture);
diff --git a/scripts/i18n/verify-static.cjs b/scripts/i18n/verify-static.cjs
index d20c124b6d2..462e221bd19 100644
--- a/scripts/i18n/verify-static.cjs
+++ b/scripts/i18n/verify-static.cjs
@@ -12,7 +12,7 @@ const htmlLangFor = locale => localeRegistry.find(item =>
item.code === locale)?
// current locale itself still run; a counterpart page that the subset did not
// build is reported as skipped instead of read. Publishing always verifies the
// complete site, where every counterpart must be present.
-function verify({site, manifest, partial = false, headCache = new Map()}) {
+function verify({site, manifest, partial = false, headCache = new Map(),
groupCache = new Set()}) {
const data = JSON.parse(fs.readFileSync(manifest, 'utf8'));
const locale = data.locale;
const contentFile = path.join(path.dirname(path.dirname(manifest)),
'content-manifests', locale + '.json');
@@ -40,30 +40,14 @@ function verify({site, manifest, partial = false, headCache
= new Map()}) {
readIndexes(path.join(site, locale));
let verified = 0;
let skipped = 0;
- const headingIds = $ => $('.theme-doc-markdown h1,.theme-doc-markdown
h2,.theme-doc-markdown h3,.theme-doc-markdown h4,.theme-doc-markdown
h5,.theme-doc-markdown h6')
- .map((i, node) => $(node).attr('id') ?? '').get();
- function head(file, $) {
- if (!headCache.has(file)) {
- $ ??= cheerio.load(fs.readFileSync(file, 'utf8'));
- // Retain only immutable metadata, not tens of thousands of DOMs.
- const alternates = new Map();
- for (const node of $('link[rel="alternate"][hreflang]').toArray())
{
- const lang = $(node).attr('hreflang');
- if (!alternates.has(lang)) alternates.set(lang, []);
- alternates.get(lang).push($(node).attr('href'));
- }
- headCache.set(file, {headingIds:headingIds($), alternates,
- htmlLang:$('html').attr('lang'),
bodyLang:$('.theme-doc-markdown,.course-doc-content').attr('lang'),
-
translationStatus:$('[data-translation-status]').attr('data-translation-status'),
-
canonicals:$('link[rel="canonical"]').toArray().map(node=>$(node).attr('href')),
- robots:$('meta[name="robots"]').attr('content'),
- ogUrl:$('meta[property="og:url"]').attr('content'),
ogLocale:$('meta[property="og:locale"]').attr('content')});
- }
+ function head(file) {
+ if (!headCache.has(file)) headCache.set(file,
+
require('./static-metadata.cjs').readMetadata(fs.readFileSync(file, 'utf8')));
return headCache.get(file);
}
function counterpart(permalink, check) {
const file = path.join(site, decodeURIComponent(permalink),
'index.html');
- if (fs.existsSync(file)) return head(file);
+ if (headCache.has(file) || fs.existsSync(file)) return head(file);
assert(partial, `Missing counterpart page (${check}): ${permalink}`);
skipped++;
return null;
@@ -89,7 +73,7 @@ function verify({site, manifest, partial = false, headCache =
new Map()}) {
assert(!indexedPaths.has(page.permalink), `Fallback/stale page in
local search index: ${page.permalink}`);
for (const permalink of Object.values(alternateGroup)) {
const file = path.join(site, permalink, 'index.html');
- if (fs.existsSync(file)) {
+ if (headCache.has(file) || fs.existsSync(file)) {
assert.equal(head(file).alternates.get(htmlLang)?.length
?? 0, 0,
`Fallback/stale localized alternate in ${permalink}`);
}
@@ -99,17 +83,21 @@ function verify({site, manifest, partial = false, headCache
= new Map()}) {
assert(sitemapPaths.has(page.permalink), `Current page missing
from sitemap: ${page.permalink}`);
const english = counterpart(page.englishPermalink, 'source heading
IDs');
if (english) assert.deepEqual(metadata.headingIds,
english.headingIds, `Source heading IDs: ${page.permalink}`);
- for (const [lang, permalink] of Object.entries(alternateGroup)) {
- const counterpart$ = counterpart(permalink, 'reciprocal
alternates');
- if (!counterpart$) continue;
- for (const [otherLang, otherPath] of
Object.entries(alternateGroup)) {
- const otherHtmlLang = htmlLangFor(otherLang);
- const links = counterpart$.alternates.get(otherHtmlLang)
?? [];
- assert.equal(links[0],
`https://doris.apache.org${otherPath}`,
- `Non-reciprocal alternates ${lang} -> ${otherLang}:
${permalink}`);
- assert.equal(links.length, 1, `Duplicate hreflang:
${permalink}`);
+ const groupKey =
JSON.stringify(Object.entries(alternateGroup).sort());
+ if (!groupCache.has(groupKey)) {
+ for (const [lang, permalink] of
Object.entries(alternateGroup)) {
+ const counterpart$ = counterpart(permalink, 'reciprocal
alternates');
+ if (!counterpart$) continue;
+ for (const [otherLang, otherPath] of
Object.entries(alternateGroup)) {
+ const otherHtmlLang = htmlLangFor(otherLang);
+ const links =
counterpart$.alternates.get(otherHtmlLang) ?? [];
+ assert.equal(links[0],
`https://doris.apache.org${otherPath}`,
+ `Non-reciprocal alternates ${lang} ->
${otherLang}: ${permalink}`);
+ assert.equal(links.length, 1, `Duplicate hreflang:
${permalink}`);
+ }
}
}
+ groupCache.add(groupKey);
}
verified++;
}
@@ -150,9 +138,9 @@ function verify({site, manifest, partial = false, headCache
= new Map()}) {
function verifyAll({site, manifestDir, locales}) {
// One immutable artifact per invocation. Never share this cache across
runs.
- const headCache = new Map();
+ const headCache = new Map(), groupCache = new Set();
return locales.map(locale => ({locale, ...verify({site,
- manifest:path.join(manifestDir, locale + '.json'), headCache})}));
+ manifest:path.join(manifestDir, locale + '.json'), headCache,
groupCache})}));
}
if (require.main === module) {
diff --git a/scripts/publish/__tests__/optimize.test.cjs
b/scripts/publish/__tests__/optimize.test.cjs
index b8f38ae5da9..8bcd6121f9e 100644
--- a/scripts/publish/__tests__/optimize.test.cjs
+++ b/scripts/publish/__tests__/optimize.test.cjs
@@ -248,3 +248,19 @@ test('a fifth-language compiled filename collision rejects
the artifact', t => {
write('ru/assets/js/collision.0123abcd.js','Russian');
assert.throws(() => optimize({site,locales:selected}),/filename
collision/);
});
+
+test('verification uses the recorded build asset origin when the caller
environment changes', t => {
+ const previous = process.env.DORIS_ASSET_ORIGIN;
+ t.after(() => {if (previous === undefined) delete
process.env.DORIS_ASSET_ORIGIN; else process.env.DORIS_ASSET_ORIGIN=previous;});
+ process.env.DORIS_ASSET_ORIGIN='';
+ const {site,write}=fixture(t);
+
write('assets/css/style.css','@font-face{src:url(/assets/shared/font.ttf)}');
+ write('assets/shared/font.ttf','font fixture bytes');
+ optimize({site,locales});
+
assert.equal(JSON.parse(fs.readFileSync(path.join(site,'.publish/redirects.json'))).assetOrigin,'');
+ process.env.DORIS_ASSET_ORIGIN='https://assets-cdn.selectdb.com/site';
+ const verify=require('../verify.cjs').verify;
+ assert(verify(site).compiledAssetReferences>0);
+ fs.unlinkSync(path.join(site,'assets/shared/font.ttf'));
+ assert.throws(()=>verify(site),/Missing compiled asset/);
+});
diff --git a/scripts/publish/optimize.cjs b/scripts/publish/optimize.cjs
index aaab1c8d1c2..43f24ae86f5 100644
--- a/scripts/publish/optimize.cjs
+++ b/scripts/publish/optimize.cjs
@@ -151,6 +151,7 @@ function optimize({site, locales, reportFile}) {
const apache = writeApache({site,locales,redirects});
fs.mkdirSync(path.join(site,'.publish'),{recursive:true});
fs.writeFileSync(path.join(site,'.publish/redirects.json'),JSON.stringify({schemaVersion:1,
+ assetOrigin: require('../../config/asset-origin').getAssetOrigin(),
assetPrefixes:prefixes.map(prefix => `/${prefix}/assets/`),
redirects:[...redirects].map(([from,item]) =>
[from,item.to,item.preserveQuery,item.status])}));
function clean(directory) {
diff --git a/scripts/publish/verify.cjs b/scripts/publish/verify.cjs
index e6e65148da6..4ef1cdf96c5 100644
--- a/scripts/publish/verify.cjs
+++ b/scripts/publish/verify.cjs
@@ -12,7 +12,7 @@ function verify(site) {
const redirects = new Map(manifest.redirects.map(([from,to]) =>
[decodeURIComponent(from),to]));
const files = inventory(site);
const available = new Set(files.map(item => item.relative));
- const assetOrigin = require('../../config/asset-origin').getAssetOrigin();
+ const assetOrigin = manifest.assetOrigin ??
require('../../config/asset-origin').getAssetOrigin();
const assetBase = assetOrigin ? new URL(assetOrigin.replace(/\/?$/, '/'))
: null;
const assetPrefix = assetBase?.pathname.replace(/\/$/, '') ?? '';
const ownOrigins = new Set(['https://doris.apache.org',...(assetBase ?
[assetBase.origin] : [])]);
diff --git a/translations/CONTENT_MANIFEST.md b/translations/CONTENT_MANIFEST.md
index fe6714541e5..875768b5572 100644
--- a/translations/CONTENT_MANIFEST.md
+++ b/translations/CONTENT_MANIFEST.md
@@ -133,8 +133,9 @@ uses real docs (two versions/two plugins), React pages,
native blog posts and a
utility route; target coverage is zero/one/partial/full. It checks emitted
HTML,
route existence, body selection, source binding and payload sizes. This fixture
does not certify full production publishing, page-wide SEO or blog lifecycle.
-CI selects the complete optimized five-language, all-active-version build for
-changes to the contract, adapters or manual ledgers, and archives size reports.
+CI uses a five-language smoke fixture and representative real pages for
contract
+or adapter changes, and archives size reports. Full publication compilation is
+explicitly requested with `ci/full` or manual full validation.
## Route, body and SEO adoption (T02–T05)
@@ -204,10 +205,10 @@ that a candidate has been deployed to ASF or that its CDN
configuration changed.
`ci-plan.cjs` writes `.i18n-build/ci-plan.json`, bound to the checked source
and
merge base, using `build-scope.cjs` for impact metadata. Translation/state
edits
-compile affected documents and representative samples; shared language routing,
+compile affected documents and their import owners; shared language routing,
metadata and host rules use five-language samples across all active versions.
-Dependencies, active versions, unclassified inputs or the `ci/full` label
retain
-the complete publication build. Scheduled/manual deployments still build the
+Dependencies and active-version changes also use representative samples. Only
+the `ci/full` label or manual full validation selects the complete publication
build. Scheduled/manual deployments still build the
complete site. This maintenance document does not itself require compilation.
See [CI validation](../scripts/i18n/CI_VALIDATION.md) for coverage limits and
publication guards. The required `Build Check` identity stays stable.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]