Skip to content

fix: 未翻訳トラッキングIssueのプレビューURL生成をナビゲーション定義に基づかせる - #1199

Open
lacolaco wants to merge 5 commits into
angular:mainfrom
lacolaco:fix/untranslated-tracking-routes
Open

fix: 未翻訳トラッキングIssueのプレビューURL生成をナビゲーション定義に基づかせる#1199
lacolaco wants to merge 5 commits into
angular:mainfrom
lacolaco:fix/untranslated-tracking-routes

Conversation

@lacolaco

Copy link
Copy Markdown
Collaborator

翻訳・修正

未翻訳ドキュメントのトラッキングIssue (#1102) が生成するプレビューリンクの破損を修正します。翻訳内容の変更はありません。

https://angular.jp/best-practices/performance/overview が404になる報告から、生成アルゴリズムを総点検しました。

何が壊れていたか

プレビューURLは adev-ja/src/content/** のファイルパスを文字列加工して作っていましたが、実URLは adev-ja/src/app/routing/navigation-entries/index.tspath / contentPath 対応表が正です。両者は独立した値なので一致しません。未翻訳131件のうち13件が404を指していました。

ファイル修正前 (404)修正後
best-practices/performance/overview.md/best-practices/performance/overview/best-practices/performance
best-practices/runtime-performance/zone-pollution.md/best-practices/runtime-performance/zone-pollution/best-practices/zone-pollution
guide/forms/signals/designing-your-form-model.md…/designing-your-form-model…/model-design
ai/mcp-server-setup.md/ai/mcp-server-setup/ai/mcp
ほか9件 (*/overview.md を親パスへ畳む系)

あわせて以下も修正しています。

  • Issueの重複作成リスク: listForRepo が既定30件で打ち切られていました。type: translation ラベルは既に全57件あり、トラッキングIssueがページ外へ落ちると新規Issueが作られます。ページネーションを追加。
  • 翻訳宣言の誤マッチ: 境界なしの前方一致だったため translate: guide/signalsguide/signals-rfc.md も宣言済みにしていました。パス境界での一致に変更。src/app/** の宣言が一切マッチしなかった問題も解消。
  • ルート不在ファイルの掲載: guide/di/creating-injectable-service.md は上流でナビから外れリダイレクトのみ残る死にコンテンツです。追跡対象から外し、外した事実はIssue本文に明記します。
  • カテゴリの取りこぼし: introduction / ai / events が「その他」に落ちていたため追加。
  • ワークフローの値渡し: ファイル一覧をスクリプト本文へ展開していたのを環境変数経由に変更。

再発防止

  • pnpm run test:routes: 全コンテンツ378件がURLへ解決できることを検査。解決できないページは、追跡を続ける (ROUTELESS_TRANSLATABLE_CONTENT) か外す (KNOWN_ORPHANED_CONTENT) かの明示を要求します。
  • pnpm run test:unit: 経路解決と宣言突合の仕様を20件のテストで固定。

いずれもCIのPRチェックに追加しました。pnpm test は従来どおりパッチ検証のみで、update-origin の事前チェックの意味は変えていません。

  • 翻訳のガイドラインを確認しました。
  • 原文ファイルと翻訳ファイルの改行数が一致しています。(コンテンツの変更なし)

関連Issue

#1102

備考

navigation-entries/index.ts には contentPath の重複が8件あり、うち5件は別セクションへの相互掲載です (例: guide/ssrguide/ssrbest-practices/performance/ssr の両方に載る)。プレビューURLは「contentPath と一致するパス = そのページ自身の住所」を優先しています。

KNOWN_ORPHANED_CONTENT の2件は llms-list.md 経由で llms-full.txt には収録されるため、ページとしては到達不能でもLLM向けコンテキストには載ります。翻訳の優先度は低いという判断で追跡から外していますが、方針を変える場合はこのリストを空にしてください。

変更ファイル:

  • tools/lib/content-routes.ts (新規), tools/lib/content-routes.test.ts (新規)
  • tools/verify-content-routes.ts (新規)
  • tools/list-untranslated.ts
  • .github/scripts/sync-untranslated-issue.mjs, .github/scripts/sync-untranslated-issue.test.mjs (新規)
  • .github/workflows/sync-untranslated-issue.yml, .github/workflows/ci.yml, package.json

The untranslated-files tracker derived angular.jp URLs by string-munging
content file paths. Since `path` and `contentPath` in the navigation
entries are independent, 14 of 132 generated links pointed at 404 pages
(e.g. best-practices/performance/overview.md -> /best-practices/performance).
Read the route table instead, and cover the routes Bazel generates for the
error encyclopedia, extended diagnostics and tutorials. Pages that resolve to
no route are unreachable on the site, so they are dropped from the tracker.
`pnpm test` now fails when a page stops resolving.
- Consume the URL computed by list-untranslated instead of re-deriving it.
- Match Translation Checkout titles on path boundaries, so `translate: guide/signals`
no longer claims `guide/signals-xyz.md`, and files outside src/content match at all.
- Paginate issue queries; the default page size of 30 silently truncated the
checkout list and risked creating a duplicate tracking issue.
- Pass the file list through the environment rather than interpolating it into
the script body.
- Add the introduction, ai and events categories, which all fell into "その他".
Review of the previous commit found three defects in the resolver.
The navigation entries list 8 pages under two sections, so one contentPath
carries two URLs; taking the last one sent 5 guide pages to their
best-practices alias. Prefer the URL that repeats the content path.
The parser required contentPath to sit on the line after path, and threw
otherwise, so a benign key reordering upstream would have taken down both
the sync workflow and CI. Scan the object literals instead.
An unresolvable page was assumed orphaned and vanished from tracking. Only
pages listed in KNOWN_ORPHANED_CONTENT are dropped now; anything else stays
tracked without a preview link, and the route check names both lists so the
choice is deliberate.
The route check runs as its own CI step: `pnpm test` keeps meaning patch
validation, which update-origin depends on.
The path-boundary fix broke declarations written with a trailing slash
(`translate: guide/di/`), which the old prefix match did handle. Normalise
the trailing slash, and cover the matching with tests.
Files dropped for having no page now appear in the issue body; leaving them
only in the workflow log means nobody notices they went untranslated.
The pin points at the commit tag v4.1.0 resolves to, but the comment read
4.1.0, which is not a ref. zizmor's ref-version-mismatch check blocks any PR
that touches these workflows. Only the two files this PR edits are corrected;
the same comment remains in the workflows it does not touch.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@lacolaco