Repository navigation
chore(schema): generate the [dotfiles] schema from typed entries - #14644
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
[Low impact] This PR appears safe to merge; no blocking issues were found. SummaryThis PR generates the dotfile schemas from Rust declaration types while keeping runtime parsing unchanged.
No actionable issues were found. No tests were run during this review. Reviews (14) · Last reviewed commit: "Merge branch 'claude/mise-config-explain..." · Reviewed by Greptile |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
DotfileEntryDecl, DotfileTableDecl, DotfileVariantDecl and DotfileGroupDecl in mise-config now declare every key a [dotfiles] or [dotfile_groups] entry may hold, and schema/mise.json is generated from them. The rules between keys stay hand-written in dotfiles/schema.rs. The generated schema closes the entry table, so an editor flags a typo, and documents `autosave` and `enabled`, which it left out. mise-system still parses entries itself; tests check that its parsers read the declared keys. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b728c48 to
865e343
Compare
https://entire.io/gh/jdx/mise/trails/859
The
[dotfiles]and[dotfile_groups]parts ofschema/mise.jsonare now generated from declaration types in mise-config, as the rest of the schema already is. Before, they were the last large blocks of hand-written JSON, kept in step with mise-system's parsers by hand.What changes for users
Editors that use the mise schema now flag a typo in a dotfile entry. Before, the schema left the entry table open, so this passed without a complaint:
The schema also documents two keys it left out before, so editors now complete them:
autosave: in track mode,falsesaves the path only onmise dotfiles save <path>.enabled:falseturns off an entry inherited from another config file.mise itself still reads dotfile entries exactly as before. Each entry stays raw TOML until mise expands the dotfiles, and an unknown key in one is still ignored at that point.
Implementation
crates/mise-config/src/dotfiles.rsgainsDotfileEntryDecl(a source string or a table) andDotfileTableDecl(every key a whole-file entry or an edit may hold). It also gainsDotfileVariantDecl,DotfileGroupDeclandDotfileGroupEntryDecl, andMergeSettingmoves here from mise-system. Each key's doc comment is its schema description.relativeapplies only to symlink modes. A derive can't express that, so these rules stay hand-written incrates/mise-config/src/dotfiles/schema.rsand are added to the derived schema. They moved over unchanged.dotfile_keys_match_the_declarationandgroup_keys_match_the_declaration, check that those parsers together read exactly the keys the declarations list, so a key added to one without the other fails a test.FileTomlEntry::Tablebecomes the structFileTomlTableso its keys can be listed.Apart from the closed entry table and the two added keys, the generated
[dotfiles]and[dotfile_groups]schemas are semantically identical to the hand-written ones (compared withjq -S).Validation
cargo +1.95 clippy --workspace --all-features --all-targets -- -D warningscargo test --workspace --all-features --exclude mise. The new parity tests fail when a key is removed from the declaration.cargo test --all-features -p mise --lib, includingschema_matches_parser, which validates everytomlblock indocs/and every e2e heredoc against the closed schema.mise run test:e2e:config/test_schema_ajv,config/test_schema_tombi, allconfig/test_schema_dotfiles_*, and 14cli/test_dotfiles_*tests.Stacked on #14642.
AI-assisted — Tool: Claude Code; model: anthropic/claude-opus-5-5; version: 2.1.299.
🤖 Generated with Claude Code
Note
Low Risk
Schema and documentation generation plus refactor with parity tests; dotfile runtime parsing behavior is intentionally unchanged.
Overview
Generates
[dotfiles]and[dotfile_groups]inschema/mise.jsonfrom typed declaration types inmise-configinstead of large hand-written JSON blocks. Cross-key constraints (mode-specific keys, merge vs whole-file vs edit) stay indotfiles/schema.rsand are merged onto the derived schema viaentry_rules.Editor/schema behavior: dotfile entry tables now use
additionalProperties: false, so unknown keys (e.g.modinstead ofmode) are flagged. The schema also documentsautosaveandenabled, which were missing before.Runtime unchanged: config still stores dotfile entries as raw TOML until mise-system expands them; unknown keys are still ignored at expansion time.
mise-system alignment:
FileTomlEntry::Tablebecomes structFileTomlTable;MergeSettingmoves tomise-config. New testsdotfile_keys_match_the_declarationandgroup_keys_match_the_declarationrequire parser field sets to match the declaration types.AGENTS.mddocuments the new schema workflow.Reviewed by Cursor Bugbot for commit c68c7bf. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
autosaveandenabledoptions for dotfiles.