@@ -524,14 +524,31 @@ function recordIds(record) {
524524 } ;
525525}
526526
527+ /** Registry ids the artifact and a fresh generation disagree on, in both directions. */
528+ function compareIds ( label , packedIds , freshIds , problems ) {
529+ const packedSet = new Set ( packedIds ) ;
530+ const freshSet = new Set ( freshIds ) ;
531+ const stale = [ ...packedSet ] . filter ( ( id ) => ! freshSet . has ( id ) ) . sort ( ) ;
532+ const omitted = [ ...freshSet ] . filter ( ( id ) => ! packedSet . has ( id ) ) . sort ( ) ;
533+ if ( stale . length > 0 ) {
534+ problems . push (
535+ `${ label } : ${ stale . length } id(s) the artifact carries and the registries no longer project:` ,
536+ ...listNames ( stale ) ,
537+ ) ;
538+ }
539+ if ( omitted . length > 0 ) {
540+ problems . push ( `${ label } : ${ omitted . length } id(s) the registries project and the artifact OMITS:` , ...listNames ( omitted ) ) ;
541+ }
542+ }
543+
527544/** Name how one registry-derived record differs, id by id where ids differ. */
528545function compareRecord ( label , packed , fresh , problems ) {
529546 if ( canonical ( packed ) === canonical ( fresh ) ) return true ;
530547 const p = recordIds ( packed ) ;
531548 const f = recordIds ( fresh ) ;
532549 const before = problems . length ;
533- compareArray ( `${ label } .converted` , p . conversionIds , f . conversionIds , problems ) ;
534- compareArray ( `${ label } .migrated` , p . migrationIds , f . migrationIds , problems ) ;
550+ compareIds ( `${ label } .converted` , p . conversionIds , f . conversionIds , problems ) ;
551+ compareIds ( `${ label } .migrated` , p . migrationIds , f . migrationIds , problems ) ;
535552 if ( problems . length === before ) {
536553 const keys = [ ...new Set ( [ ...Object . keys ( packed ?? { } ) , ...Object . keys ( fresh ?? { } ) ] ) ] . sort ( ) ;
537554 const differing = keys . filter ( ( k ) => canonical ( packed ?. [ k ] ) !== canonical ( fresh ?. [ k ] ) ) ;
0 commit comments