@@ -35,6 +35,8 @@ const metaSnapshot = () => ({ id: 'm1', name: 'v', type: 'view', scope: 'platfor
3535const historySnapshot = ( ) => ( { id : 'h1' , name : 'v' , type : 'view' , metadata : view ( 'one' ) , checksum : HASH , previous_checksum : PARENT } ) ;
3636const conflictNote = `expected parent ${ PARENT } but current is ${ HASH } ` ;
3737const WITHHELD_NOTE = 'expected parent (withheld) but current is (withheld)' ;
38+ /** The decision-audit `code` column's own vocabulary (ADR-0112 D6b), not an error code. */
39+ const CONFLICT_CODE = 'metadata_conflict' ; // adr0112-ok: D6b persisted audit column
3840
3941describe ( 'planAuditRowPatch / planActivityRowPatch — the hash columns leave the copy' , ( ) => {
4042 it ( 'a sys_metadata create snapshot loses its checksum, and nothing else' , ( ) => {
@@ -83,22 +85,22 @@ describe('planAuditRowPatch / planActivityRowPatch — the hash columns leave th
8385
8486describe ( 'planDecisionNotePatch — the decision-audit note and its copies' , ( ) => {
8587 it ( 'withholds both hashes of a conflict note' , ( ) => {
86- const patch = planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd1' , code : 'metadata_conflict' , note : conflictNote } ) ;
88+ const patch = planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd1' , code : CONFLICT_CODE , note : conflictNote } ) ;
8789 expect ( patch ) . toEqual ( { note : WITHHELD_NOTE } ) ;
8890 } ) ;
8991
9092 it ( 'keeps a null side as null' , ( ) => {
91- const patch = planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd2' , code : 'metadata_conflict' , note : `expected parent null but current is ${ HASH } ` } ) ;
93+ const patch = planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd2' , code : CONFLICT_CODE , note : `expected parent null but current is ${ HASH } ` } ) ;
9294 expect ( patch ) . toEqual ( { note : 'expected parent null but current is (withheld)' } ) ;
9395 } ) ;
9496
9597 it ( 'leaves every other note alone, and is idempotent' , ( ) => {
9698 expect ( planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd3' , code : 'ok' , note : 'restored from version 2' } ) ) . toBeNull ( ) ;
97- expect ( planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd4' , code : 'metadata_conflict' , note : WITHHELD_NOTE } ) ) . toBeNull ( ) ;
99+ expect ( planDecisionNotePatch ( 'sys_metadata_audit' , { id : 'd4' , code : CONFLICT_CODE , note : WITHHELD_NOTE } ) ) . toBeNull ( ) ;
98100 } ) ;
99101
100102 it ( 'rewrites the ledger and activity copies of a conflict note' , ( ) => {
101- const snapshot = { id : 'd1' , type : 'view' , name : 'v' , operation : 'save' , outcome : 'denied' , code : 'metadata_conflict' , note : conflictNote } ;
103+ const snapshot = { id : 'd1' , type : 'view' , name : 'v' , operation : 'save' , outcome : 'denied' , code : CONFLICT_CODE , note : conflictNote } ;
102104 const audit = planDecisionNotePatch ( 'sys_audit_log' , {
103105 id : 'a5' , object_name : 'sys_metadata_audit' , record_id : 'd1' , new_value : JSON . stringify ( snapshot ) , old_value : null ,
104106 } ) ;
@@ -139,12 +141,12 @@ describe('migrateStoredMetadataBodyCopies — the content-hash copies (driven)',
139141 sys_metadata : [ { id : 'm1' , type : 'view' , name : 'v' } ] ,
140142 sys_audit_log : [
141143 { id : 'a1' , object_name : 'sys_metadata' , record_id : 'm1' , new_value : JSON . stringify ( metaSnapshot ( ) ) , old_value : null } ,
142- { id : 'a2' , object_name : 'sys_metadata_audit' , record_id : 'd1' , new_value : JSON . stringify ( { id : 'd1' , code : 'metadata_conflict' , note : conflictNote } ) , old_value : null } ,
144+ { id : 'a2' , object_name : 'sys_metadata_audit' , record_id : 'd1' , new_value : JSON . stringify ( { id : 'd1' , code : CONFLICT_CODE , note : conflictNote } ) , old_value : null } ,
143145 { id : 'a3' , object_name : 'file_blob' , record_id : 'f1' , new_value : JSON . stringify ( { id : 'f1' , checksum : HASH } ) , old_value : null } ,
144146 ] ,
145147 sys_activity : [ { id : 'ac1' , object_name : 'sys_metadata_history' , record_id : 'h1' , metadata : JSON . stringify ( { old : null , new : historySnapshot ( ) } ) } ] ,
146148 sys_metadata_audit : [
147- { id : 'd1' , code : 'metadata_conflict' , note : conflictNote } ,
149+ { id : 'd1' , code : CONFLICT_CODE , note : conflictNote } ,
148150 { id : 'd2' , code : 'ok' , note : 'active' } ,
149151 ] ,
150152 } ) ;
0 commit comments