diff --git a/src/app/shared/models/star-catalog.spec.ts b/src/app/shared/models/star-catalog.spec.ts index 1a415e8..fadb1e5 100644 --- a/src/app/shared/models/star-catalog.spec.ts +++ b/src/app/shared/models/star-catalog.spec.ts @@ -139,5 +139,10 @@ describe('star catalogue provenance and derived names', () => { // 32-bit row id can equal — so it is the prefix that decides, not a round trip through the id. expect(isDesignation({ ...MIXED[1], name: 'Gaia DR3 5853498713190525696' })).toBe(true); expect(isDesignation({ ...MIXED[1], name: 'Proxima Centauri' })).toBe(false); + // HYG's own last resort, once every designation it knows has come up empty. Upper case, + // whatever case the source id is in. + expect(isDesignation({ ...MIXED[0], name: 'HYG 5' })).toBe(true); + expect(isDesignation({ ...MIXED[0], source: undefined, name: 'HYG 5' })).toBe(true); + expect(isDesignation({ ...MIXED[0], name: 'HD 48915' })).toBe(false); }); }); diff --git a/src/app/shared/models/star-catalog.ts b/src/app/shared/models/star-catalog.ts index 19e7ff2..cac8a00 100644 --- a/src/app/shared/models/star-catalog.ts +++ b/src/app/shared/models/star-catalog.ts @@ -66,11 +66,14 @@ export interface StarCatalogIndex { } /** - * How a source names a star that has no name of its own. `Gaia DR3 ` for Gaia; HYG's own - * fallbacks already produce real designations, so it never needs this. + * How a source names a star that has no name of its own. `Gaia DR3 ` for Gaia; `HYG ` + * for HYG, whose ETL reaches for that only after a proper name, Bayer, Flamsteed, HD, Gliese and + * HIP have all come up empty (`tools/etl/fetchStars.ts`) — none in the current catalogue, but + * the path is there, and a name made that way is no more a name than Gaia's. */ const DESIGNATION_PREFIXES: Readonly> = { - gaia: 'Gaia DR3' + gaia: 'Gaia DR3', + hyg: 'HYG' }; interface StarMetaColumns { @@ -168,7 +171,8 @@ function designationFor(prefix: string | undefined, id: number): string | undefi * round-trip through the id would call every one of those stars named. */ export function isDesignation(star: StarRecord): boolean { - const prefix = star.source === undefined ? 'HYG' : (DESIGNATION_PREFIXES[star.source] ?? star.source); + // No source at all is a single-catalogue build, whose fallback is HYG's — see `decodeStarCatalog`. + const prefix = star.source === undefined ? DESIGNATION_PREFIXES['hyg'] : (DESIGNATION_PREFIXES[star.source] ?? star.source); return star.name.startsWith(`${prefix} `); }