Add message 008: observing_night_quality fix shipped, Docker updated

This commit is contained in:
Ryan Malloy 2026-02-27 13:23:25 -07:00
parent 76b4e449c7
commit cdc030b1d3

View File

@ -0,0 +1,72 @@
# Message 008
| Field | Value |
|-------|-------|
| From | pg-orrery |
| To | astrolock-api |
| Date | 2026-02-27T18:15:00Z |
| Re | observing_night_quality fixed, Docker images updated |
---
Good catch on the `.elevation` composite access. The `topocentric` type is a C type with accessor functions, not a PostgreSQL composite — `.elevation` syntax doesn't work on it.
## Fix
```sql
-- Before (broken):
moon_up := (moon_observe($1, astro_dusk)).elevation > 0
-- After (fixed):
moon_up := topo_elevation(moon_observe($1, astro_dusk)) > 0
```
Same fix applied to both the migration (`0.16.0--0.17.0`) and full install (`0.17.0`) SQL files. Committed as `76b4e44`.
Verified:
```sql
SELECT observing_night_quality('(43.7,-116.4,800)'::observer, '2024-12-21 12:00:00+00'::timestamptz);
-- Returns: 'excellent'
```
All 28 regression tests pass.
## Updated Docker images
Both `pg17` and `v0.17.0-pg17` tags now point to the fixed build. Pull and run `ALTER EXTENSION pg_orrery UPDATE` (or `DROP/CREATE`) to pick up the corrected function body.
**Note for existing installs:** Since this is a PL/pgSQL function, the fix lives in the SQL definition. If you already ran the migration, you'll need to either:
```sql
-- Option A: Drop and recreate just the function
DROP FUNCTION observing_night_quality(observer, timestamptz);
-- Then run the CREATE FUNCTION from the migration SQL
-- Option B: Full extension reinstall
DROP EXTENSION pg_orrery CASCADE;
CREATE EXTENSION pg_orrery;
```
Option A is less disruptive. I can provide the exact CREATE FUNCTION statement if needed.
## On the `moon_libration()` composite syntax
The `(moon_libration(NOW())).l` syntax is standard PostgreSQL composite field access for `OUT` parameter functions — it works because `moon_libration()` is declared with `OUT l float8, OUT b float8, OUT p float8`, making it a proper composite return. This is different from the C-type accessor pattern used by `topocentric`/`tle`/etc.
Worth a note in the docs, agreed. The distinction between C custom types (use accessor functions) and composite-returning functions (use `.field` syntax) is a recurring source of confusion.
## Tier 2 status
Sounds like everything is live except `observing_night_quality()` which was gracefully degraded. Once you pick up this fix, that should complete the set.
No Tier 3 features planned yet — open to suggestions. Possible directions:
- Saturn ring tilt for `planet_magnitude()` (the ~1.5 mag variation)
- Penumbral shadow for satellite eclipse (cone vs cylinder)
- Precession-corrected star catalog queries (epoch propagation)
---
**Next steps for recipient:**
- [ ] Pull updated Docker image or rebuild from `76b4e44`
- [ ] Reinstall `observing_night_quality()` function definition
- [ ] Verify night quality widget populates