Generation: derive language-prefix detection from project blogLanguages, not a hardcoded set #84

Closed
opened 2026-07-20 19:44:01 +00:00 by hugo · 1 comment
Owner

Source: Audit section 2.15 (first half).

Current behaviour (RuDS): crates/bds-core/src/engine/generation.rs fn has_language_prefix (~line 808) recognizes only "de" | "en" | "es" | "fr" | "it" as language path prefixes. A project with any other blogLanguage (pt, ja, nl…) gets its {lang}/... output paths misclassified by classify_generated_path, which feeds path_matches_sections → validation apply and stale-page cleanup (expected_paths_for_sections, remove_extra_section_paths).

Spec/bDS2: neither limits languages to that set; specs/generation.allium MultiLanguageRoutes is generic over generation.blog_languages. bDS2 derives prefixes from project metadata.

Task: Thread the project's actual language list (metadata mainLanguage + blogLanguages, normalized via crate::i18n::normalize_language) into classify_generated_path/has_language_prefix instead of the hardcoded matches. Audit other callers of the hardcoded list (grep "de" | "en" in bds-core). Add a test with a non-Western language code (e.g. "pt") exercising classification and validation apply.

Acceptance: Paths under any configured language classify identically to main-language paths; test with pt/ja passes.

**Source:** Audit section 2.15 (first half). **Current behaviour (RuDS):** `crates/bds-core/src/engine/generation.rs` fn `has_language_prefix` (~line 808) recognizes only `"de" | "en" | "es" | "fr" | "it"` as language path prefixes. A project with any other blogLanguage (pt, ja, nl…) gets its `{lang}/...` output paths misclassified by `classify_generated_path`, which feeds `path_matches_sections` → validation apply and stale-page cleanup (`expected_paths_for_sections`, `remove_extra_section_paths`). **Spec/bDS2:** neither limits languages to that set; `specs/generation.allium` MultiLanguageRoutes is generic over `generation.blog_languages`. bDS2 derives prefixes from project metadata. **Task:** Thread the project's actual language list (metadata mainLanguage + blogLanguages, normalized via `crate::i18n::normalize_language`) into `classify_generated_path`/`has_language_prefix` instead of the hardcoded matches. Audit other callers of the hardcoded list (grep `"de" | "en"` in bds-core). Add a test with a non-Western language code (e.g. "pt") exercising classification and validation apply. **Acceptance:** Paths under any configured language classify identically to main-language paths; test with pt/ja passes.
hugo added the bug label 2026-07-20 19:44:01 +00:00
Author
Owner

Implemented in ba6a297. Generation path classification now receives project metadata throughout the core engine, renderer, desktop, CLI, and TUI paths and recognizes mainLanguage plus every configured blogLanguage instead of a fixed locale set. Added pt/ja classification coverage and an end-to-end validation-apply test proving stale pt outputs are removed. Updated README. Verified against bDS2 metadata-driven language planning and specs/generation.allium; cargo build --workspace and cargo test --workspace pass.

Implemented in ba6a297. Generation path classification now receives project metadata throughout the core engine, renderer, desktop, CLI, and TUI paths and recognizes mainLanguage plus every configured blogLanguage instead of a fixed locale set. Added pt/ja classification coverage and an end-to-end validation-apply test proving stale pt outputs are removed. Updated README. Verified against bDS2 metadata-driven language planning and specs/generation.allium; cargo build --workspace and cargo test --workspace pass.
hugo closed this issue 2026-07-22 16:02:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: hugo/RuDS#84