Repository navigation
fix(search): keep one locale index and read search text from build output (#393) - #394
Merged
Merged
Conversation
…ions, use) Phase 1 of the other-locale plan. Adds ja translations of the 19 entry-path pages (index, why, start/*, editions/*, use/*) and the ja sidebar labels for start/ and editions/. Every heading keeps its English id, fences match the English byte for byte, terms follow the glossary's ja column, and each page carries a --stamp. check-translations: ja 0 stale, 79 missing (was 98). Fixes #386 Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
Phase 2 of the other-locale plan, first batch: ja for the build/ top level (index, agents, ai-builder, ai-skills, extend-existing-systems, marketplace, packages, reports, templates) and build/data/ (index, relationships, formulas, validation-rules). Same rules as #386: English heading ids, fences byte for byte, glossary ja column, UI labels in English, one line per paragraph, each page stamped. check-translations: ja 0 stale, 66 missing (was 79). Refs #388 Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
…388, PR 2 of 7) Adds ja translations for the 11 automation and interface pages: build/automation/{index,flows,workflows,approvals} and build/interface/{index,apps,views,forms,dashboards,pages,actions}. Both sections' meta.ja.json already match the English pages list. Refs #388 Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
…tput (#393) /api/search kept every locale's Orama index (30-40 MB each) and every page module page.data.load() imported, so one Worker isolate grew from 58 MB after its first locale to 283 MB after all eight, and #390's ja pages tipped it past 128 MB into 503s. - scripts/gen-search-data.mjs computes each page's structuredData before next build with fumadocs-mdx's own remark chain and writes one gzipped module per locale to apps/docs/.search/; the route reads that instead of importing page modules. - The route keeps the most recently used locale's index only. - check-search-heap.mjs asks the built route in every locale twice and fails above 100 MB or when the second pass keeps growing; it runs in ci.yml after check-search-locales and its --self-test is in SELF_TESTED. Measured on the built route: levels at 50-54 MB across both passes. Fixes #393 Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
The tree is unchanged: the diff against main is the #393 commit only. Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
席位核对 · ACCEPT · 2026-10-29T12:18Z ·
|
zhuangjianguo
marked this pull request as ready for review
October 29, 2026 12:18
zhuangjianguo
added a commit
that referenced
this pull request
Oct 29, 2026
The tree is unchanged: the diff against main is the re-landed ja pages only. Claude-Session: https://claude.ai/code/session_01QsR2jRsjbApbf83iyTDDXm Co-Authored-By: Claude <noreply@anthropic.com>
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Steedos · project thread
Fixes #393
Clause-②: no
Metadata-protocol: none
维护者速读
/api/search每个 isolate 只保留最近一个语言的索引;页面的搜索文本改为构建时生成(apps/docs/.search/,gzip),不再通过page.data.load()导入整页模块;新增 CI 步骤Search fits the Worker's memory,超过 100 MB 或第二轮仍在增长即变红。/api/search返回 503 并两次回滚。原因是路由把每个语言的索引(各 30–40 MB)和导入过的页面模块都留在内存里,8 个语言后堆达到 283 MB,而 Worker 只有 128 MB。apps/docs/app/api/search/route.ts的texts()、indexes()和KEEP,然后看apps/docs/scripts/gen-search-data.mjs。Search fits the Worker's memory表格,8 个语言问两轮,堆稳定在约 53 MB。What changes
apps/docs/scripts/gen-search-data.mjs(new)next build, computes each page'sstructuredDatawith fumadocs-mdx's own remark chain (applyMdxPresetfrom the compiledsource.configplusremarkInclude, with rehype skipped becauseremarkStructureruns in the remark phase). It writes one module per locale toapps/docs/.search/as gzipped JSON in base64. The directory carries its own.gitignore.apps/docs/app/api/search/route.ts.search/(plus the default language's for fallback pages) instead ofpage.data.load(). Keeps only the most recently used locale's index (KEEP = 1). A page missing from.search/throws, except undernext dev, where it falls back toload()for pages added since dev started.apps/docs/package.jsonbuild,type-checkanddevrunfumadocs-mdxand the generator first..github/scripts/check-search-heap.mjs(new)heapUsedafter a forced GC, and fails onthrew,status,over-budget(100 MB) orstill-growing(round two more than 8 MB above round one's peak).--self-testhas 6 cases, and every rule fires..github/workflows/ci.ymlSearch fits the Worker's memoryafterSearch answers every locale.tools/ci-scripts/run-self-tests.mjscheck-search-heap.mjsadded toSELF_TESTED.No content files. The branch carries one
-s oursmerge of the landed #390 branch head so the push fast-forwards; the diff againstmainis only these 6 files.Tests
Heap after a forced GC, measured on the built route (
node --expose-gc .github/scripts/check-search-heap.mjs):09784e7The full-ja column used #390's 11 pages, the 54 translated pages held for PRs 3–7, and English copies for the 2 not yet translated. They were removed after measuring.
structuredDatathe old route got frompage.data.load()was compared with what the generator writes: 98 pages × en, zh-Hans, zh-Hant and ja, 0 differences.##/###heading, and 9 probes) = 21,992 requests, with each response hashed. On the first pass, 2,070 responses differed, all with the same set of hits in a different order further down the list. The cause is upstream of this PR:fumadocs-mdxwrites.source/server.tsin a different file order on each run (three runs gave three hashes), which changes insertion order and so the order of tied scores between any two builds ofmain. With the page order fixed to the same sort in both the old and new route (a test-only patch), 21,992 of 21,992 responses were byte-identical.check-search-locales.mjs: all 8 locales answer 200, and every line except ja matches the earlier run onmain. The ja line differs only because docs(i18n): translate build/automation/ and build/interface/ into ja (#388, PR 2 of 7) #390's pages were reverted. The Docs polish from the 2026-10-06 audit: muted-text contrast, the License table on phones, FAQ formatting, search ranking, glossary order, licence/license spelling #301 ranking holds: own pages are found by title within the first 3, and en has 93 of 98 first.opennextjs-cloudflare preview(workerd) answered/api/searchin all 8 locales twice with 200.smoke-docs.mjs --baseagainst it passed.pnpm turbo run type-check,pnpm turbo run test(13 self-tests),check-locale-surface.mjs,run-self-tests.mjsandcheck-search-heap.mjs --self-testall pass.Acceptance notes
Generated by Claude Code