Answer the review: HYG's own last-resort name is a designation too

Junie: a HYG star that fell all the way through the ETL's naming chain --
no proper name, Bayer, Flamsteed, HD, Gliese or HIP -- is called "HYG <id>",
and with `source: 'hyg'` the predicate was looking for a lower-case "hyg "
prefix and calling it named. None in the current catalogue, but the path is
in `tools/etl/fetchStars.ts` and a refresh could walk it.

Fixed in the table rather than in the predicate: `hyg: 'HYG'` next to
`gaia: 'Gaia DR3'`, so the encoder, the decoder and the predicate all read the
one rule. The sourceless case reads the same entry instead of repeating it.

npm test 609/609, build and ETL typecheck clean.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014fcUfL82nvyh9VebX1Fz6w
This commit is contained in:
2026-08-27 20:16:11 +02:00
co-authored by Claude Opus 5
parent f14e252b19
commit 7a112e4bb3
2 changed files with 13 additions and 4 deletions
@@ -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. // 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: 'Gaia DR3 5853498713190525696' })).toBe(true);
expect(isDesignation({ ...MIXED[1], name: 'Proxima Centauri' })).toBe(false); 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);
}); });
}); });
+8 -4
View File
@@ -66,11 +66,14 @@ export interface StarCatalogIndex {
} }
/** /**
* How a source names a star that has no name of its own. `Gaia DR3 <id>` for Gaia; HYG's own * How a source names a star that has no name of its own. `Gaia DR3 <id>` for Gaia; `HYG <id>`
* fallbacks already produce real designations, so it never needs this. * 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<Record<string, string>> = { const DESIGNATION_PREFIXES: Readonly<Record<string, string>> = {
gaia: 'Gaia DR3' gaia: 'Gaia DR3',
hyg: 'HYG'
}; };
interface StarMetaColumns { 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. * round-trip through the id would call every one of those stars named.
*/ */
export function isDesignation(star: StarRecord): boolean { 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} `); return star.name.startsWith(`${prefix} `);
} }