@@ -87,6 +87,7 @@ const FAST_RECONNECT_MIN_INTERVAL_MS = 2_000;
8787const MARKDOWN_DIRTY_SETTLE_MS = 350 ;
8888const OPEN_FILE_EXTERNAL_EDIT_IDLE_GRACE_MS = 1200 ;
8989const BOUND_RECOVERY_LOCK_MS = 1500 ;
90+ const FRONTMATTER_GUARD_NOTICE_MS = 30_000 ;
9091const CAPABILITY_REFRESH_INTERVAL_MS = 30_000 ;
9192const UPDATE_MANIFEST_URLS = [
9293 "https://github.com/kavinsood/yaos/releases/latest/download/update-manifest.json" ,
@@ -284,6 +285,7 @@ export default class VaultCrdtSyncPlugin extends Plugin {
284285 private legacyServerNoticeShown = false ;
285286 private commandsRegistered = false ;
286287 private idbDegradedHandled = false ;
288+ private frontmatterGuardNoticeAt = new Map < string , number > ( ) ;
287289
288290 /**
289291 * True when startup timed out waiting for provider sync.
@@ -446,6 +448,8 @@ export default class VaultCrdtSyncPlugin extends Plugin {
446448 this . editorBindings ,
447449 this . settings . debug ,
448450 ( source , msg , details ) => this . trace ( source , msg , details ) ,
451+ ( ) => this . settings . frontmatterGuardEnabled ,
452+ ( path , direction ) => this . showFrontmatterGuardNotice ( path , direction ) ,
449453 ) ;
450454 this . diskMirror . startMapObservers ( ) ;
451455
@@ -2160,6 +2164,8 @@ export default class VaultCrdtSyncPlugin extends Plugin {
21602164 nextContent : string ,
21612165 reason : string ,
21622166 ) : boolean {
2167+ if ( ! this . settings . frontmatterGuardEnabled ) return false ;
2168+
21632169 const validation = validateFrontmatterTransition ( previousContent , nextContent ) ;
21642170 if ( ! isFrontmatterBlocked ( validation ) ) return false ;
21652171
@@ -2175,9 +2181,27 @@ export default class VaultCrdtSyncPlugin extends Plugin {
21752181 `Frontmatter ingest blocked for "${ path } " ` +
21762182 `(${ validation . reasons . join ( ", " ) || validation . risk } )` ,
21772183 ) ;
2184+ this . showFrontmatterGuardNotice ( path , "disk-to-crdt" ) ;
21782185 return true ;
21792186 }
21802187
2188+ private showFrontmatterGuardNotice (
2189+ path : string ,
2190+ direction : "disk-to-crdt" | "crdt-to-disk" ,
2191+ ) : void {
2192+ const key = `${ direction } :${ path } ` ;
2193+ const now = Date . now ( ) ;
2194+ if ( ( this . frontmatterGuardNoticeAt . get ( key ) ?? 0 ) + FRONTMATTER_GUARD_NOTICE_MS > now ) {
2195+ return ;
2196+ }
2197+
2198+ this . frontmatterGuardNoticeAt . set ( key , now ) ;
2199+ new Notice (
2200+ `YAOS paused a properties update in "${ path } " because the frontmatter looked unsafe. Check diagnostics before accepting the change.` ,
2201+ 12_000 ,
2202+ ) ;
2203+ }
2204+
21812205 private traceFrontmatterQuarantine (
21822206 path : string ,
21832207 direction : "disk-to-crdt" | "crdt-to-disk" ,
0 commit comments