@@ -48,14 +48,71 @@ function printSection(
4848 }
4949}
5050
51+ // ---------------------------------------------------------------------------
52+ // Stale registry (documented differences that no longer apply)
53+ // ---------------------------------------------------------------------------
54+
55+ function countStale ( result : ComparisonResult ) : number {
56+ return (
57+ result . staleConfigMissing . length +
58+ result . staleConfigExtra . length +
59+ result . staleConfigDifferentShape . length
60+ ) ;
61+ }
62+
63+ /**
64+ * Prints stale `config.ts` entries and returns how many were printed.
65+ * These must run even when there are zero live diffs, otherwise a resolved
66+ * API (e.g. an export removed from `missingInRN` in reality) would never
67+ * force updating the comparison registry.
68+ */
69+ function printStaleRegistrySection ( result : ComparisonResult ) : number {
70+ const totalStale = countStale ( result ) ;
71+ if ( totalStale === 0 ) {
72+ return 0 ;
73+ }
74+
75+ console . log ( `\n ${ c ( RED , `Stale registry / config entries` ) } (${ totalStale } ):` ) ;
76+
77+ for ( const name of result . staleConfigMissing ) {
78+ console . log (
79+ `${ c ( RED , ' ✗' ) } ${ c ( BOLD , name ) } ${ c ( RED , ' [STALE missingInRN]' ) } ${ c (
80+ DIM ,
81+ ` — ${ name } exists in React Native Firebase but is still listed under missingInRN in config.ts; remove it or reclassify (e.g. differentShape) if types still differ.` ,
82+ ) } `,
83+ ) ;
84+ }
85+
86+ for ( const name of result . staleConfigExtra ) {
87+ console . log (
88+ `${ c ( RED , ' ✗' ) } ${ c ( BOLD , name ) } ${ c ( RED , ' [STALE extraInRN]' ) } ${ c (
89+ DIM ,
90+ ` — ${ name } is no longer an extra export in React Native Firebase but is still listed under extraInRN; remove from config.ts.` ,
91+ ) } `,
92+ ) ;
93+ }
94+
95+ for ( const name of result . staleConfigDifferentShape ) {
96+ console . log (
97+ `${ c ( RED , ' ✗' ) } ${ c ( BOLD , name ) } ${ c ( RED , ' [STALE differentShape]' ) } ${ c (
98+ DIM ,
99+ ` — ${ name } now matches the firebase-js-sdk shape; remove from differentShape in config.ts.` ,
100+ ) } `,
101+ ) ;
102+ }
103+
104+ return totalStale ;
105+ }
106+
51107// ---------------------------------------------------------------------------
52108// Public API
53109// ---------------------------------------------------------------------------
54110
55111/**
56112 * Print a human-readable report to stdout.
57113 *
58- * @returns `true` if there are any undocumented differences (CI failure).
114+ * @returns `true` if there are undocumented differences or stale registry
115+ * entries (CI failure).
59116 */
60117export function printReport ( results : ComparisonResult [ ] ) : boolean {
61118 console . log (
@@ -72,11 +129,22 @@ export function printReport(results: ComparisonResult[]): boolean {
72129 result . extra . length +
73130 result . differentShape . length ;
74131
75- if ( totalDiffs === 0 ) {
132+ const totalStale = countStale ( result ) ;
133+
134+ if ( totalDiffs === 0 && totalStale === 0 ) {
76135 console . log ( c ( GREEN , ' ✓ No differences found' ) ) ;
77136 continue ;
78137 }
79138
139+ if ( totalDiffs === 0 && totalStale > 0 ) {
140+ console . log (
141+ c (
142+ GREEN ,
143+ ' ✓ Exported types match the firebase-js-sdk snapshot (no live diffs)' ,
144+ ) ,
145+ ) ;
146+ }
147+
80148 // --- Missing ---
81149 if ( result . missing . length > 0 ) {
82150 printSection (
@@ -117,42 +185,27 @@ export function printReport(results: ComparisonResult[]): boolean {
117185 ) ;
118186 }
119187
120- // --- Stale config entries ---
121- const totalStale =
122- result . staleConfigMissing . length +
123- result . staleConfigExtra . length +
124- result . staleConfigDifferentShape . length ;
125-
126- if ( totalStale > 0 ) {
127- const staleNames = [
128- ...result . staleConfigMissing ,
129- ...result . staleConfigExtra ,
130- ...result . staleConfigDifferentShape ,
131- ] ;
132- console . log ( `\n ${ c ( RED , `Stale config entries` ) } (${ totalStale } ):` ) ;
133- for ( const name of staleNames ) {
134- console . log (
135- `${ c ( RED , ' ✗' ) } ${ c ( BOLD , name ) } ${ c ( RED , ' [STALE]' ) } ${ c ( DIM , ' — now matches the firebase-js-sdk; remove from config.ts' ) } ` ,
136- ) ;
137- }
138- }
188+ const printedStale = printStaleRegistrySection ( result ) ;
139189
140190 // --- Summary ---
141191 const totalUndoc =
142192 result . undocumentedMissing . length +
143193 result . undocumentedExtra . length +
144194 result . undocumentedDifferentShape . length ;
145195
146- if ( totalUndoc > 0 || totalStale > 0 ) {
196+ if ( totalUndoc > 0 || printedStale > 0 ) {
147197 hasFailures = true ;
148198 if ( totalUndoc > 0 ) {
149199 console . log (
150200 `\n ${ c ( RED , `✗ ${ totalUndoc } undocumented difference(s) — add them to config.ts with a reason` ) } ` ,
151201 ) ;
152202 }
153- if ( totalStale > 0 ) {
203+ if ( printedStale > 0 ) {
154204 console . log (
155- `\n ${ c ( RED , `✗ ${ totalStale } stale config entry/entries — remove them from config.ts` ) } ` ,
205+ `\n ${ c (
206+ RED ,
207+ `✗ ${ printedStale } stale registry entry/entries — update packages/<name>/config.ts for the type comparison tool` ,
208+ ) } `,
156209 ) ;
157210 }
158211 } else {
0 commit comments