Skip to content

fix: code mode no longer hardcodes Rust's std-namespace convention - #52

Merged
Kinflou merged 1 commit into
mainfrom
fix/code-mode-no-rust-specific-leak
Oct 10, 2026
Merged

Kinflou merged 1 commit into
mainfrom
fix/code-mode-no-rust-specific-leak

Conversation

@Kinflou

@Kinflou Kinflou commented Oct 10, 2026

Copy link
Copy Markdown
Member

Summary

  • commands/generate.rs's Mode::Code branch had its own is_std_namespace(), duplicating comline-rust's generator-internal std convention just to make an "every schema needs a file" invariant skip std when external_std is on. The CLI should be generator-agnostic — it shouldn't know Rust's std convention exists at all.
  • Now writes whatever files the generator actually returned, deriving each file's namespace from its own path instead of cross-checking against the schema list. A generator omitting a file for any reason is no longer a CLI-level error.
  • Side effect fix: a TypeScript target with external_std set (a field TypeScript ignores) used to silently drop std's file from disk even though the TypeScript generator still inlined it.

Test plan

  • cargo test --workspace (74/74 pass, including external_std_flag_qualifies_the_reference_and_omits_stds_own_file)
  • cargo fmt --check / cargo clippy --all-targets clean

'generate.rs' is language-agnostic - it shouldn't know that 'std' is
special or that Rust's external_std drops its own file. It had
duplicated comline-rust's is_std_namespace() check just to make an
otherwise-unconditional 'every schema needs a file' invariant skip std.

Write whatever files the generator actually returned instead, deriving
each file's namespace from its own path rather than cross-checking
against the schema list. A generator choosing not to emit a file for a
schema (for any reason, std-related or not) is no longer a CLI-level
error.

This also fixes a latent bug: a TypeScript target with external_std set
(a field it ignores) would have silently dropped std's file from disk
even though the TypeScript generator still inlined it.
@Kinflou
Kinflou merged commit 2571806 into main Oct 10, 2026
2 checks passed
@Kinflou
Kinflou deleted the fix/code-mode-no-rust-specific-leak branch October 10, 2026 21:31
Sign up for free to 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