Incremental engine for long horizon agents π Star if you like it!
Rust agentic-data-frameworkaiai-agentschange-data-capturecodebase-intelligencecontext-engineeringdata-engineeringdata-indexingdata-processingetlhelp-wantedindexingknowledge-graphllmlong-horizon-agentpythonragreal-timerustsemantic-search
fix(docs): the search export refuses a page outside its folders; the docs release job has a time limit (#2839)
jerryqu-cococ40110e69a91
diff --git a/.github/workflows/_docs_release.yml b/.github/workflows/_docs_release.ymlindex c323fcfa..d2814518 100644--- a/.github/workflows/_docs_release.yml+++ b/.github/workflows/_docs_release.yml@@ -11,6 +11,9 @@ jobs:deploy:runs-on: ubuntu-latestenvironment: docs-release+ # The deploy and the publish step below clone and push over the network.+ # A call that hangs must not hold the job for the default six hours.+ timeout-minutes: 10steps:- uses: actions/checkout@v7with:diff --git a/docs/scripts/export-search-content.mjs b/docs/scripts/export-search-content.mjsindex 1d5de3c6..f4662a6e 100644--- a/docs/scripts/export-search-content.mjs+++ b/docs/scripts/export-search-content.mjs@@ -16,7 +16,9 @@// lists also leaves the export. Every .md file in the build must be either a// listed page's twin or one of the files for coding agents (SKIPPED). Any// other .md file fails the export with its name: a new kind of file gets a-// decision, not a silent default. A failed export changes nothing in <out-dir>.+// decision, not a silent default. So does a listed link to /docs/rust/ or+// /docs/examples/ itself: its twin would land beside the three folders, where+// no later export removes it. A failed export changes nothing in <out-dir>.// The docs test workflow runs the export on every build, so a change that// breaks one of these rules fails its own pull request.import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from 'node:fs';@@ -65,7 +67,7 @@ export function exportSearchContent(buildDir, outDir) {throw new Error(`the output folder and the build folder must not contain each other: ${out}, ${build}`);const problems = [];- const twins = new Map(); // source path in the build β path in the export+ const twins = new Map(); // source path in the build β { target: path in the export, url }for (const list of PAGE_LISTS) {const path = join(build, list);if (!existsSync(path)) {@@ -75,12 +77,18 @@ export function exportSearchContent(buildDir, outDir) {for (const [, url] of readFileSync(path, 'utf8').matchAll(PAGE_LINK)) {// A link that leaves the docs is not a page, so it has no twin.const twin = twinOf(url);- if (twin) twins.set(twin.source, twin.target);+ if (twin) twins.set(twin.source, { target: twin.target, url });}}const files = new Map(); // path in the export β content- for (const [source, target] of twins) {+ for (const [source, { target, url }] of twins) {+ if (!TREES.some((tree) => target.startsWith(`${tree}/`))) {+ problems.push(+ `a listed page would be exported outside ${TREES.map((tree) => `${tree}/`).join(', ')}: ${url} β ${target}`,+ );+ continue;+ }const path = join(build, source);if (!existsSync(path)) {problems.push(`a listed page has no .md twin: ${source}`);diff --git a/docs/scripts/export-search-content.test.mjs b/docs/scripts/export-search-content.test.mjsindex 513af7da..0baf4ae6 100644--- a/docs/scripts/export-search-content.test.mjs+++ b/docs/scripts/export-search-content.test.mjs@@ -93,6 +93,31 @@ test('a listed page without a twin fails the export with its name', () => {);});+test('a listed link to a tree itself fails the export with its target, which is outside the three folders', () => {+ // With the twin in the build, and without it: the link is the problem either way.+ for (const [tree, twins] of [+ ['rust', { 'rust.md': twin('Start', 'The start page.') }],+ ['examples', { 'examples.md': twin('Start', 'The start page.') }],+ ['rust', {}],+ ]) {+ const out = outDir();+ write(out, { 'python/old/page.md': 'earlier export' });+ const dir = build({+ 'rust/llms.txt':+ `# Rust docs\n\n- [Start](${SITE}/${tree}/): The start page.\n` ++ `- [App](${SITE}/rust/guide/app/): The App page.\n`,+ ...twins,+ });+ assert.throws(() => exportSearchContent(dir, out), (error) => {+ // One problem for the one link: the twin is not also reported as a stray file.+ assert.match(error.message, /^1 problem\(s\)/);+ assert.match(error.message, new RegExp(`${SITE}/${tree}/ β ${tree}\\.md`));+ return true;+ });+ assert.deepEqual(snapshot(out), { 'python/old/page.md': 'earlier export' });+ }+});+test('a twin without the banner fails the export, also when it opens with its own quote', () => {for (const text of ['# Plain\n\nNo banner here.\n', '# Quote\n\n> The page opens with a quote.\n\nText.\n']) {assert.throws(