diff --git a/crates/provui-core/src/config_schema.rs b/crates/provui-core/src/config_schema.rs index 50043c1..af1e136 100644 --- a/crates/provui-core/src/config_schema.rs +++ b/crates/provui-core/src/config_schema.rs @@ -106,6 +106,12 @@ pub fn config_rules(config: &WorkspaceConfig) -> Vec { // Closed: every prov build reads all four, so a spelling outside them // is one prov rejects. `figl` is fig's name for its own dialect, and // the spelling prov writes back. + // + // Neither axis rewrites anything on Apply. prov's rule for a config + // axis is that it governs what is written next (and `prov new` gives a + // child its parent's carrier before the default), while a document + // keeps its spelling until `prov convert` restates it. A mixed + // workspace is valid and `check`-clean, and the sentence says so. costly( choice( path(&["metadata", "format"]), @@ -119,7 +125,9 @@ pub fn config_rules(config: &WorkspaceConfig) -> Vec { ], ), Tint::Warning, - "Rewrites the metadata of every document in the workspace.", + "Applies to metadata written from now on: a new document takes its \ + parent's format. Existing documents keep theirs until converted \ + with `prov convert metadata.format -r`.", ), costly( choice( @@ -132,7 +140,9 @@ pub fn config_rules(config: &WorkspaceConfig) -> Vec { ], ), Tint::Warning, - "Rewrites the metadata of every document in the workspace.", + "Applies to metadata written from now on: a new document takes its \ + parent's shape. Existing documents keep theirs until converted \ + with `prov convert metadata.embed -r`.", ), ]; @@ -579,6 +589,41 @@ mod costly_tests { } } + /// The metadata axes say what applying them does, which is prov's rule for + /// any config axis: the setting governs what is written next, and a + /// document keeps its spelling until `prov convert` restates it. Nothing on + /// Apply runs that conversion, so a sentence promising a rewrite of every + /// document is one the reader learns to click through. + #[test] + fn a_metadata_axis_says_it_governs_what_is_written_next() { + let schema = schema(); + for axis in ["format", "embed"] { + let path = [key("metadata"), key(axis)]; + let (_, why) = warned(&path).unwrap_or_else(|| panic!("metadata.{axis} should warn")); + assert!( + !why.contains("Rewrites"), + "metadata.{axis} claims a rewrite nothing performs: {why}" + ); + assert!( + why.contains("Existing documents keep"), + "metadata.{axis} does not say existing documents are left alone: {why}" + ); + let command = format!("prov convert metadata.{axis} -r"); + assert!( + why.contains(&command), + "metadata.{axis} does not name the conversion `{command}`: {why}" + ); + // Apply reads the consequence, not the row: it has to say the same. + let rule = schema.rule_for(&path).expect("rule"); + let consequence = rule + .on_change + .iter() + .map(|c| c.message.as_str()) + .collect::>(); + assert_eq!(consequence, [why.as_str()], "metadata.{axis}"); + } + } + /// A field costly in one direction only warns on that direction and stays /// quiet on the other. /// diff --git a/crates/provui-core/src/rules.rs b/crates/provui-core/src/rules.rs index a7f2fee..332d630 100644 --- a/crates/provui-core/src/rules.rs +++ b/crates/provui-core/src/rules.rs @@ -118,7 +118,8 @@ pub fn open_choice_terms(at: PathPat, title: &str, icon: Icon, values: Vec /// Mark a rule as one where *every* answer costs the same thing. /// /// For the axes with no safe direction: whichever value you land on, the -/// workspace gets rewritten. The tint is what draws the row; the +/// change has the same effect, and `why` says what it is. The tint is what +/// draws the row; the /// [`Consequence`] is what Apply reads before carrying the change out. /// /// Both, not either — they answer different questions. The tint says how diff --git a/docs/tasks/metadata-axes-claim-a-rewrite.md b/docs/tasks/metadata-axes-claim-a-rewrite.md index b64d798..c01aaf5 100644 --- a/docs/tasks/metadata-axes-claim-a-rewrite.md +++ b/docs/tasks/metadata-axes-claim-a-rewrite.md @@ -1,14 +1,23 @@ --- title: 'The metadata axes say they rewrite every document, and nothing does' part_of: '[Tasks](/docs/tasks/tasks.md)' -status: open +status: done author: adammharris created: 2026-09-20 -updated: 2026-09-20 +updated: 2026-10-20 --- # The metadata axes say they rewrite every document, and nothing does +**Status.** Done, by the first of the two choices: both consequences now say +what applying the change does. Metadata written from now on takes the new +setting, a new document takes its parent's carrier, and existing documents +keep theirs until `prov convert metadata. -r`. The tint +and `Confirm` weight are unchanged. `a_metadata_axis_says_it_governs_what_is_written_next` +holds the sentence to that, on the row and on the consequence Apply reads. +The reference axes' "Rewrites every link" sentences fail the same check +and are not changed here. + ## The problem `config_schema.rs` marks `metadata.format` and `metadata.embed` as `costly`,