@@ -3,27 +3,13 @@ import { existsSync, readFileSync } from "fs";
33import { join } from "path" ;
44import { execSync } from "child_process" ;
55import { catalogBreakTitle , renderCatalogBreakBody } from "../src/catalog-break.js" ;
6- import {
7- lastSuccessfulModelCount ,
8- meetsModelCountFloor ,
9- type CatalogManifest ,
10- } from "../src/manifest.js" ;
116import { decideCatalogSync } from "../src/publish-policy.js" ;
127import { npmLatestVersion , npmPackageVersions } from "./npm-registry.js" ;
138
149const ROOT = join ( import . meta. dir , ".." ) ;
1510const CATALOG_FILES = [ "models.json" , "_version.txt" , "manifest.json" ] ;
1611const CATALOG_BRANCH = "chore/catalog-sync" ;
1712
18- function readJson < T > ( path : string ) : T | null {
19- if ( ! existsSync ( path ) ) return null ;
20- try {
21- return JSON . parse ( readFileSync ( path , "utf-8" ) ) as T ;
22- } catch {
23- return null ;
24- }
25- }
26-
2713function bundledCommandCodeVersion ( ) : string | null {
2814 const path = join ( ROOT , "_version.txt" ) ;
2915 if ( ! existsSync ( path ) ) return null ;
@@ -123,7 +109,9 @@ async function main(): Promise<void> {
123109 return ;
124110 }
125111
126- const prior = readJson < CatalogManifest > ( join ( ROOT , "manifest.json" ) ) ;
112+ // sync-models.ts validates availability and the model-count floor before the
113+ // first artifact write, so any failure there leaves the last-good catalog
114+ // untouched and routes here through the catalog-break issue path.
127115 const beforeModels = existsSync ( join ( ROOT , "models.json" ) )
128116 ? readFileSync ( join ( ROOT , "models.json" ) , "utf-8" )
129117 : "" ;
@@ -143,19 +131,6 @@ async function main(): Promise<void> {
143131 }
144132
145133 const afterModels = readFileSync ( join ( ROOT , "models.json" ) , "utf-8" ) ;
146- const entries = JSON . parse ( afterModels ) as unknown [ ] ;
147- const lastCount = lastSuccessfulModelCount ( prior ) ;
148- if ( ! meetsModelCountFloor ( entries . length , lastCount ) ) {
149- const message = `model count ${ entries . length } below floor (lastSuccessful=${ lastCount } )` ;
150- try {
151- openOrUpdateCatalogBreak ( { commandCodeVersion : latestCc , error : message } ) ;
152- } catch ( issueErr ) {
153- console . error ( "failed to open catalog-break issue" , issueErr ) ;
154- }
155- execSync ( `git checkout -- ${ CATALOG_FILES . join ( " " ) } ` , { cwd : ROOT , stdio : "inherit" } ) ;
156- process . exitCode = 1 ;
157- return ;
158- }
159134
160135 const changed = afterModels !== beforeModels || bundledCommandCodeVersion ( ) !== beforeVersion ;
161136 if ( ! changed ) {
0 commit comments